001package org.hl7.fhir.dstu2.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024import java.math.BigDecimal;
025
026/*
027  Copyright (c) 2011+, HL7, Inc.
028  All rights reserved.
029  
030  Redistribution and use in source and binary forms, with or without modification, 
031  are permitted provided that the following conditions are met:
032  
033   * Redistributions of source code must retain the above copyright notice, this 
034     list of conditions and the following disclaimer.
035   * Redistributions in binary form must reproduce the above copyright notice, 
036     this list of conditions and the following disclaimer in the documentation 
037     and/or other materials provided with the distribution.
038   * Neither the name of HL7 nor the names of its contributors may be used to 
039     endorse or promote products derived from this software without specific 
040     prior written permission.
041  
042  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
043  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
044  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
045  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
046  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
047  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
048  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
049  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
050  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
051  POSSIBILITY OF SUCH DAMAGE.
052  
053*/
054
055// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
056import java.util.ArrayList;
057import java.util.Date;
058import java.util.List;
059
060import ca.uhn.fhir.model.api.annotation.Block;
061import ca.uhn.fhir.model.api.annotation.Child;
062import ca.uhn.fhir.model.api.annotation.Description;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
066import org.hl7.fhir.exceptions.FHIRException;
067import org.hl7.fhir.utilities.Utilities;
068/**
069 * A provider issued list of services and products provided, or to be provided, to a patient which is provided to an insurer for payment recovery.
070 */
071@ResourceDef(name="Claim", profile="http://hl7.org/fhir/Profile/Claim")
072public class Claim extends DomainResource {
073
074    public enum ClaimType {
075        /**
076         * A claim for Institution based, typically in-patient, goods and services.
077         */
078        INSTITUTIONAL, 
079        /**
080         * A claim for Oral Health (Dentist, Denturist, Hygienist) goods and services.
081         */
082        ORAL, 
083        /**
084         * A claim for Pharmacy based goods and services.
085         */
086        PHARMACY, 
087        /**
088         * A claim for Professional, typically out-patient, goods and services.
089         */
090        PROFESSIONAL, 
091        /**
092         * A claim for Vision (Ophthamologist, Optometrist and Optician) goods and services.
093         */
094        VISION, 
095        /**
096         * added to help the parsers
097         */
098        NULL;
099        public static ClaimType fromCode(String codeString) throws FHIRException {
100            if (codeString == null || "".equals(codeString))
101                return null;
102        if ("institutional".equals(codeString))
103          return INSTITUTIONAL;
104        if ("oral".equals(codeString))
105          return ORAL;
106        if ("pharmacy".equals(codeString))
107          return PHARMACY;
108        if ("professional".equals(codeString))
109          return PROFESSIONAL;
110        if ("vision".equals(codeString))
111          return VISION;
112        throw new FHIRException("Unknown ClaimType code '"+codeString+"'");
113        }
114        public String toCode() {
115          switch (this) {
116            case INSTITUTIONAL: return "institutional";
117            case ORAL: return "oral";
118            case PHARMACY: return "pharmacy";
119            case PROFESSIONAL: return "professional";
120            case VISION: return "vision";
121            default: return "?";
122          }
123        }
124        public String getSystem() {
125          switch (this) {
126            case INSTITUTIONAL: return "http://hl7.org/fhir/claim-type-link";
127            case ORAL: return "http://hl7.org/fhir/claim-type-link";
128            case PHARMACY: return "http://hl7.org/fhir/claim-type-link";
129            case PROFESSIONAL: return "http://hl7.org/fhir/claim-type-link";
130            case VISION: return "http://hl7.org/fhir/claim-type-link";
131            default: return "?";
132          }
133        }
134        public String getDefinition() {
135          switch (this) {
136            case INSTITUTIONAL: return "A claim for Institution based, typically in-patient, goods and services.";
137            case ORAL: return "A claim for Oral Health (Dentist, Denturist, Hygienist) goods and services.";
138            case PHARMACY: return "A claim for Pharmacy based goods and services.";
139            case PROFESSIONAL: return "A claim for Professional, typically out-patient, goods and services.";
140            case VISION: return "A claim for Vision (Ophthamologist, Optometrist and Optician) goods and services.";
141            default: return "?";
142          }
143        }
144        public String getDisplay() {
145          switch (this) {
146            case INSTITUTIONAL: return "Institutional";
147            case ORAL: return "Oral Health";
148            case PHARMACY: return "Pharmacy";
149            case PROFESSIONAL: return "Professional";
150            case VISION: return "Vision";
151            default: return "?";
152          }
153        }
154    }
155
156  public static class ClaimTypeEnumFactory implements EnumFactory<ClaimType> {
157    public ClaimType fromCode(String codeString) throws IllegalArgumentException {
158      if (codeString == null || "".equals(codeString))
159            if (codeString == null || "".equals(codeString))
160                return null;
161        if ("institutional".equals(codeString))
162          return ClaimType.INSTITUTIONAL;
163        if ("oral".equals(codeString))
164          return ClaimType.ORAL;
165        if ("pharmacy".equals(codeString))
166          return ClaimType.PHARMACY;
167        if ("professional".equals(codeString))
168          return ClaimType.PROFESSIONAL;
169        if ("vision".equals(codeString))
170          return ClaimType.VISION;
171        throw new IllegalArgumentException("Unknown ClaimType code '"+codeString+"'");
172        }
173        public Enumeration<ClaimType> fromType(Base code) throws FHIRException {
174          if (code == null || code.isEmpty())
175            return null;
176          String codeString = ((PrimitiveType) code).asStringValue();
177          if (codeString == null || "".equals(codeString))
178            return null;
179        if ("institutional".equals(codeString))
180          return new Enumeration<ClaimType>(this, ClaimType.INSTITUTIONAL);
181        if ("oral".equals(codeString))
182          return new Enumeration<ClaimType>(this, ClaimType.ORAL);
183        if ("pharmacy".equals(codeString))
184          return new Enumeration<ClaimType>(this, ClaimType.PHARMACY);
185        if ("professional".equals(codeString))
186          return new Enumeration<ClaimType>(this, ClaimType.PROFESSIONAL);
187        if ("vision".equals(codeString))
188          return new Enumeration<ClaimType>(this, ClaimType.VISION);
189        throw new FHIRException("Unknown ClaimType code '"+codeString+"'");
190        }
191    public String toCode(ClaimType code) {
192      if (code == ClaimType.INSTITUTIONAL)
193        return "institutional";
194      if (code == ClaimType.ORAL)
195        return "oral";
196      if (code == ClaimType.PHARMACY)
197        return "pharmacy";
198      if (code == ClaimType.PROFESSIONAL)
199        return "professional";
200      if (code == ClaimType.VISION)
201        return "vision";
202      return "?";
203      }
204    }
205
206    public enum Use {
207        /**
208         * The treatment is complete and this represents a Claim for the services.
209         */
210        COMPLETE, 
211        /**
212         * The treatment is proposed and this represents a Pre-authorization for the services.
213         */
214        PROPOSED, 
215        /**
216         * The treatment is proposed and this represents a Pre-determination for the services.
217         */
218        EXPLORATORY, 
219        /**
220         * A locally defined or otherwise resolved status.
221         */
222        OTHER, 
223        /**
224         * added to help the parsers
225         */
226        NULL;
227        public static Use fromCode(String codeString) throws FHIRException {
228            if (codeString == null || "".equals(codeString))
229                return null;
230        if ("complete".equals(codeString))
231          return COMPLETE;
232        if ("proposed".equals(codeString))
233          return PROPOSED;
234        if ("exploratory".equals(codeString))
235          return EXPLORATORY;
236        if ("other".equals(codeString))
237          return OTHER;
238        throw new FHIRException("Unknown Use code '"+codeString+"'");
239        }
240        public String toCode() {
241          switch (this) {
242            case COMPLETE: return "complete";
243            case PROPOSED: return "proposed";
244            case EXPLORATORY: return "exploratory";
245            case OTHER: return "other";
246            default: return "?";
247          }
248        }
249        public String getSystem() {
250          switch (this) {
251            case COMPLETE: return "http://hl7.org/fhir/claim-use-link";
252            case PROPOSED: return "http://hl7.org/fhir/claim-use-link";
253            case EXPLORATORY: return "http://hl7.org/fhir/claim-use-link";
254            case OTHER: return "http://hl7.org/fhir/claim-use-link";
255            default: return "?";
256          }
257        }
258        public String getDefinition() {
259          switch (this) {
260            case COMPLETE: return "The treatment is complete and this represents a Claim for the services.";
261            case PROPOSED: return "The treatment is proposed and this represents a Pre-authorization for the services.";
262            case EXPLORATORY: return "The treatment is proposed and this represents a Pre-determination for the services.";
263            case OTHER: return "A locally defined or otherwise resolved status.";
264            default: return "?";
265          }
266        }
267        public String getDisplay() {
268          switch (this) {
269            case COMPLETE: return "Complete";
270            case PROPOSED: return "Proposed";
271            case EXPLORATORY: return "Exploratory";
272            case OTHER: return "Other";
273            default: return "?";
274          }
275        }
276    }
277
278  public static class UseEnumFactory implements EnumFactory<Use> {
279    public Use fromCode(String codeString) throws IllegalArgumentException {
280      if (codeString == null || "".equals(codeString))
281            if (codeString == null || "".equals(codeString))
282                return null;
283        if ("complete".equals(codeString))
284          return Use.COMPLETE;
285        if ("proposed".equals(codeString))
286          return Use.PROPOSED;
287        if ("exploratory".equals(codeString))
288          return Use.EXPLORATORY;
289        if ("other".equals(codeString))
290          return Use.OTHER;
291        throw new IllegalArgumentException("Unknown Use code '"+codeString+"'");
292        }
293        public Enumeration<Use> fromType(Base code) throws FHIRException {
294          if (code == null || code.isEmpty())
295            return null;
296          String codeString = ((PrimitiveType) code).asStringValue();
297          if (codeString == null || "".equals(codeString))
298            return null;
299        if ("complete".equals(codeString))
300          return new Enumeration<Use>(this, Use.COMPLETE);
301        if ("proposed".equals(codeString))
302          return new Enumeration<Use>(this, Use.PROPOSED);
303        if ("exploratory".equals(codeString))
304          return new Enumeration<Use>(this, Use.EXPLORATORY);
305        if ("other".equals(codeString))
306          return new Enumeration<Use>(this, Use.OTHER);
307        throw new FHIRException("Unknown Use code '"+codeString+"'");
308        }
309    public String toCode(Use code) {
310      if (code == Use.COMPLETE)
311        return "complete";
312      if (code == Use.PROPOSED)
313        return "proposed";
314      if (code == Use.EXPLORATORY)
315        return "exploratory";
316      if (code == Use.OTHER)
317        return "other";
318      return "?";
319      }
320    }
321
322    @Block()
323    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
324        /**
325         * Party to be reimbursed: Subscriber, provider, other.
326         */
327        @Child(name = "type", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
328        @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
329        protected Coding type;
330
331        /**
332         * The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned).
333         */
334        @Child(name = "provider", type = {Practitioner.class}, order=2, min=0, max=1, modifier=false, summary=true)
335        @Description(shortDefinition="Provider who is the payee", formalDefinition="The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned)." )
336        protected Reference provider;
337
338        /**
339         * The actual object that is the target of the reference (The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
340         */
341        protected Practitioner providerTarget;
342
343        /**
344         * The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned).
345         */
346        @Child(name = "organization", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
347        @Description(shortDefinition="Organization who is the payee", formalDefinition="The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned)." )
348        protected Reference organization;
349
350        /**
351         * The actual object that is the target of the reference (The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
352         */
353        protected Organization organizationTarget;
354
355        /**
356         * The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned).
357         */
358        @Child(name = "person", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=true)
359        @Description(shortDefinition="Other person who is the payee", formalDefinition="The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned)." )
360        protected Reference person;
361
362        /**
363         * The actual object that is the target of the reference (The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
364         */
365        protected Patient personTarget;
366
367        private static final long serialVersionUID = -503108488L;
368
369    /*
370     * Constructor
371     */
372      public PayeeComponent() {
373        super();
374      }
375
376        /**
377         * @return {@link #type} (Party to be reimbursed: Subscriber, provider, other.)
378         */
379        public Coding getType() { 
380          if (this.type == null)
381            if (Configuration.errorOnAutoCreate())
382              throw new Error("Attempt to auto-create PayeeComponent.type");
383            else if (Configuration.doAutoCreate())
384              this.type = new Coding(); // cc
385          return this.type;
386        }
387
388        public boolean hasType() { 
389          return this.type != null && !this.type.isEmpty();
390        }
391
392        /**
393         * @param value {@link #type} (Party to be reimbursed: Subscriber, provider, other.)
394         */
395        public PayeeComponent setType(Coding value) { 
396          this.type = value;
397          return this;
398        }
399
400        /**
401         * @return {@link #provider} (The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
402         */
403        public Reference getProvider() { 
404          if (this.provider == null)
405            if (Configuration.errorOnAutoCreate())
406              throw new Error("Attempt to auto-create PayeeComponent.provider");
407            else if (Configuration.doAutoCreate())
408              this.provider = new Reference(); // cc
409          return this.provider;
410        }
411
412        public boolean hasProvider() { 
413          return this.provider != null && !this.provider.isEmpty();
414        }
415
416        /**
417         * @param value {@link #provider} (The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
418         */
419        public PayeeComponent setProvider(Reference value) { 
420          this.provider = value;
421          return this;
422        }
423
424        /**
425         * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
426         */
427        public Practitioner getProviderTarget() { 
428          if (this.providerTarget == null)
429            if (Configuration.errorOnAutoCreate())
430              throw new Error("Attempt to auto-create PayeeComponent.provider");
431            else if (Configuration.doAutoCreate())
432              this.providerTarget = new Practitioner(); // aa
433          return this.providerTarget;
434        }
435
436        /**
437         * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
438         */
439        public PayeeComponent setProviderTarget(Practitioner value) { 
440          this.providerTarget = value;
441          return this;
442        }
443
444        /**
445         * @return {@link #organization} (The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
446         */
447        public Reference getOrganization() { 
448          if (this.organization == null)
449            if (Configuration.errorOnAutoCreate())
450              throw new Error("Attempt to auto-create PayeeComponent.organization");
451            else if (Configuration.doAutoCreate())
452              this.organization = new Reference(); // cc
453          return this.organization;
454        }
455
456        public boolean hasOrganization() { 
457          return this.organization != null && !this.organization.isEmpty();
458        }
459
460        /**
461         * @param value {@link #organization} (The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
462         */
463        public PayeeComponent setOrganization(Reference value) { 
464          this.organization = value;
465          return this;
466        }
467
468        /**
469         * @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
470         */
471        public Organization getOrganizationTarget() { 
472          if (this.organizationTarget == null)
473            if (Configuration.errorOnAutoCreate())
474              throw new Error("Attempt to auto-create PayeeComponent.organization");
475            else if (Configuration.doAutoCreate())
476              this.organizationTarget = new Organization(); // aa
477          return this.organizationTarget;
478        }
479
480        /**
481         * @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
482         */
483        public PayeeComponent setOrganizationTarget(Organization value) { 
484          this.organizationTarget = value;
485          return this;
486        }
487
488        /**
489         * @return {@link #person} (The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
490         */
491        public Reference getPerson() { 
492          if (this.person == null)
493            if (Configuration.errorOnAutoCreate())
494              throw new Error("Attempt to auto-create PayeeComponent.person");
495            else if (Configuration.doAutoCreate())
496              this.person = new Reference(); // cc
497          return this.person;
498        }
499
500        public boolean hasPerson() { 
501          return this.person != null && !this.person.isEmpty();
502        }
503
504        /**
505         * @param value {@link #person} (The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
506         */
507        public PayeeComponent setPerson(Reference value) { 
508          this.person = value;
509          return this;
510        }
511
512        /**
513         * @return {@link #person} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
514         */
515        public Patient getPersonTarget() { 
516          if (this.personTarget == null)
517            if (Configuration.errorOnAutoCreate())
518              throw new Error("Attempt to auto-create PayeeComponent.person");
519            else if (Configuration.doAutoCreate())
520              this.personTarget = new Patient(); // aa
521          return this.personTarget;
522        }
523
524        /**
525         * @param value {@link #person} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned).)
526         */
527        public PayeeComponent setPersonTarget(Patient value) { 
528          this.personTarget = value;
529          return this;
530        }
531
532        protected void listChildren(List<Property> childrenList) {
533          super.listChildren(childrenList);
534          childrenList.add(new Property("type", "Coding", "Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, type));
535          childrenList.add(new Property("provider", "Reference(Practitioner)", "The provider who is to be reimbursed for the claim (the party to whom any benefit is assigned).", 0, java.lang.Integer.MAX_VALUE, provider));
536          childrenList.add(new Property("organization", "Reference(Organization)", "The organization who is to be reimbursed for the claim (the party to whom any benefit is assigned).", 0, java.lang.Integer.MAX_VALUE, organization));
537          childrenList.add(new Property("person", "Reference(Patient)", "The person other than the subscriber who is to be reimbursed for the claim (the party to whom any benefit is assigned).", 0, java.lang.Integer.MAX_VALUE, person));
538        }
539
540      @Override
541      public void setProperty(String name, Base value) throws FHIRException {
542        if (name.equals("type"))
543          this.type = castToCoding(value); // Coding
544        else if (name.equals("provider"))
545          this.provider = castToReference(value); // Reference
546        else if (name.equals("organization"))
547          this.organization = castToReference(value); // Reference
548        else if (name.equals("person"))
549          this.person = castToReference(value); // Reference
550        else
551          super.setProperty(name, value);
552      }
553
554      @Override
555      public Base addChild(String name) throws FHIRException {
556        if (name.equals("type")) {
557          this.type = new Coding();
558          return this.type;
559        }
560        else if (name.equals("provider")) {
561          this.provider = new Reference();
562          return this.provider;
563        }
564        else if (name.equals("organization")) {
565          this.organization = new Reference();
566          return this.organization;
567        }
568        else if (name.equals("person")) {
569          this.person = new Reference();
570          return this.person;
571        }
572        else
573          return super.addChild(name);
574      }
575
576      public PayeeComponent copy() {
577        PayeeComponent dst = new PayeeComponent();
578        copyValues(dst);
579        dst.type = type == null ? null : type.copy();
580        dst.provider = provider == null ? null : provider.copy();
581        dst.organization = organization == null ? null : organization.copy();
582        dst.person = person == null ? null : person.copy();
583        return dst;
584      }
585
586      @Override
587      public boolean equalsDeep(Base other) {
588        if (!super.equalsDeep(other))
589          return false;
590        if (!(other instanceof PayeeComponent))
591          return false;
592        PayeeComponent o = (PayeeComponent) other;
593        return compareDeep(type, o.type, true) && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true)
594           && compareDeep(person, o.person, true);
595      }
596
597      @Override
598      public boolean equalsShallow(Base other) {
599        if (!super.equalsShallow(other))
600          return false;
601        if (!(other instanceof PayeeComponent))
602          return false;
603        PayeeComponent o = (PayeeComponent) other;
604        return true;
605      }
606
607      public boolean isEmpty() {
608        return super.isEmpty() && (type == null || type.isEmpty()) && (provider == null || provider.isEmpty())
609           && (organization == null || organization.isEmpty()) && (person == null || person.isEmpty())
610          ;
611      }
612
613  public String fhirType() {
614    return "Claim.payee";
615
616  }
617
618  }
619
620    @Block()
621    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
622        /**
623         * Sequence of diagnosis which serves to order and provide a link.
624         */
625        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
626        @Description(shortDefinition="Sequence of diagnosis", formalDefinition="Sequence of diagnosis which serves to order and provide a link." )
627        protected PositiveIntType sequence;
628
629        /**
630         * The diagnosis.
631         */
632        @Child(name = "diagnosis", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
633        @Description(shortDefinition="Patient's list of diagnosis", formalDefinition="The diagnosis." )
634        protected Coding diagnosis;
635
636        private static final long serialVersionUID = -795010186L;
637
638    /*
639     * Constructor
640     */
641      public DiagnosisComponent() {
642        super();
643      }
644
645    /*
646     * Constructor
647     */
648      public DiagnosisComponent(PositiveIntType sequence, Coding diagnosis) {
649        super();
650        this.sequence = sequence;
651        this.diagnosis = diagnosis;
652      }
653
654        /**
655         * @return {@link #sequence} (Sequence of diagnosis which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
656         */
657        public PositiveIntType getSequenceElement() { 
658          if (this.sequence == null)
659            if (Configuration.errorOnAutoCreate())
660              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
661            else if (Configuration.doAutoCreate())
662              this.sequence = new PositiveIntType(); // bb
663          return this.sequence;
664        }
665
666        public boolean hasSequenceElement() { 
667          return this.sequence != null && !this.sequence.isEmpty();
668        }
669
670        public boolean hasSequence() { 
671          return this.sequence != null && !this.sequence.isEmpty();
672        }
673
674        /**
675         * @param value {@link #sequence} (Sequence of diagnosis which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
676         */
677        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
678          this.sequence = value;
679          return this;
680        }
681
682        /**
683         * @return Sequence of diagnosis which serves to order and provide a link.
684         */
685        public int getSequence() { 
686          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
687        }
688
689        /**
690         * @param value Sequence of diagnosis which serves to order and provide a link.
691         */
692        public DiagnosisComponent setSequence(int value) { 
693            if (this.sequence == null)
694              this.sequence = new PositiveIntType();
695            this.sequence.setValue(value);
696          return this;
697        }
698
699        /**
700         * @return {@link #diagnosis} (The diagnosis.)
701         */
702        public Coding getDiagnosis() { 
703          if (this.diagnosis == null)
704            if (Configuration.errorOnAutoCreate())
705              throw new Error("Attempt to auto-create DiagnosisComponent.diagnosis");
706            else if (Configuration.doAutoCreate())
707              this.diagnosis = new Coding(); // cc
708          return this.diagnosis;
709        }
710
711        public boolean hasDiagnosis() { 
712          return this.diagnosis != null && !this.diagnosis.isEmpty();
713        }
714
715        /**
716         * @param value {@link #diagnosis} (The diagnosis.)
717         */
718        public DiagnosisComponent setDiagnosis(Coding value) { 
719          this.diagnosis = value;
720          return this;
721        }
722
723        protected void listChildren(List<Property> childrenList) {
724          super.listChildren(childrenList);
725          childrenList.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to order and provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
726          childrenList.add(new Property("diagnosis", "Coding", "The diagnosis.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
727        }
728
729      @Override
730      public void setProperty(String name, Base value) throws FHIRException {
731        if (name.equals("sequence"))
732          this.sequence = castToPositiveInt(value); // PositiveIntType
733        else if (name.equals("diagnosis"))
734          this.diagnosis = castToCoding(value); // Coding
735        else
736          super.setProperty(name, value);
737      }
738
739      @Override
740      public Base addChild(String name) throws FHIRException {
741        if (name.equals("sequence")) {
742          throw new FHIRException("Cannot call addChild on a primitive type Claim.sequence");
743        }
744        else if (name.equals("diagnosis")) {
745          this.diagnosis = new Coding();
746          return this.diagnosis;
747        }
748        else
749          return super.addChild(name);
750      }
751
752      public DiagnosisComponent copy() {
753        DiagnosisComponent dst = new DiagnosisComponent();
754        copyValues(dst);
755        dst.sequence = sequence == null ? null : sequence.copy();
756        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
757        return dst;
758      }
759
760      @Override
761      public boolean equalsDeep(Base other) {
762        if (!super.equalsDeep(other))
763          return false;
764        if (!(other instanceof DiagnosisComponent))
765          return false;
766        DiagnosisComponent o = (DiagnosisComponent) other;
767        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true);
768      }
769
770      @Override
771      public boolean equalsShallow(Base other) {
772        if (!super.equalsShallow(other))
773          return false;
774        if (!(other instanceof DiagnosisComponent))
775          return false;
776        DiagnosisComponent o = (DiagnosisComponent) other;
777        return compareValues(sequence, o.sequence, true);
778      }
779
780      public boolean isEmpty() {
781        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (diagnosis == null || diagnosis.isEmpty())
782          ;
783      }
784
785  public String fhirType() {
786    return "Claim.diagnosis";
787
788  }
789
790  }
791
792    @Block()
793    public static class CoverageComponent extends BackboneElement implements IBaseBackboneElement {
794        /**
795         * A service line item.
796         */
797        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
798        @Description(shortDefinition="Service instance identifier", formalDefinition="A service line item." )
799        protected PositiveIntType sequence;
800
801        /**
802         * The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
803         */
804        @Child(name = "focal", type = {BooleanType.class}, order=2, min=1, max=1, modifier=false, summary=true)
805        @Description(shortDefinition="The focal Coverage", formalDefinition="The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated." )
806        protected BooleanType focal;
807
808        /**
809         * Reference to the program or plan identification, underwriter or payor.
810         */
811        @Child(name = "coverage", type = {Coverage.class}, order=3, min=1, max=1, modifier=false, summary=true)
812        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
813        protected Reference coverage;
814
815        /**
816         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
817         */
818        protected Coverage coverageTarget;
819
820        /**
821         * The contract number of a business agreement which describes the terms and conditions.
822         */
823        @Child(name = "businessArrangement", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
824        @Description(shortDefinition="Business agreement", formalDefinition="The contract number of a business agreement which describes the terms and conditions." )
825        protected StringType businessArrangement;
826
827        /**
828         * The relationship of the patient to the subscriber.
829         */
830        @Child(name = "relationship", type = {Coding.class}, order=5, min=1, max=1, modifier=false, summary=true)
831        @Description(shortDefinition="Patient relationship to subscriber", formalDefinition="The relationship of the patient to the subscriber." )
832        protected Coding relationship;
833
834        /**
835         * A list of references from the Insurer to which these services pertain.
836         */
837        @Child(name = "preAuthRef", type = {StringType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
838        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
839        protected List<StringType> preAuthRef;
840
841        /**
842         * The Coverages adjudication details.
843         */
844        @Child(name = "claimResponse", type = {ClaimResponse.class}, order=7, min=0, max=1, modifier=false, summary=true)
845        @Description(shortDefinition="Adjudication results", formalDefinition="The Coverages adjudication details." )
846        protected Reference claimResponse;
847
848        /**
849         * The actual object that is the target of the reference (The Coverages adjudication details.)
850         */
851        protected ClaimResponse claimResponseTarget;
852
853        /**
854         * The style (standard) and version of the original material which was converted into this resource.
855         */
856        @Child(name = "originalRuleset", type = {Coding.class}, order=8, min=0, max=1, modifier=false, summary=true)
857        @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
858        protected Coding originalRuleset;
859
860        private static final long serialVersionUID = 621250924L;
861
862    /*
863     * Constructor
864     */
865      public CoverageComponent() {
866        super();
867      }
868
869    /*
870     * Constructor
871     */
872      public CoverageComponent(PositiveIntType sequence, BooleanType focal, Reference coverage, Coding relationship) {
873        super();
874        this.sequence = sequence;
875        this.focal = focal;
876        this.coverage = coverage;
877        this.relationship = relationship;
878      }
879
880        /**
881         * @return {@link #sequence} (A service line item.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
882         */
883        public PositiveIntType getSequenceElement() { 
884          if (this.sequence == null)
885            if (Configuration.errorOnAutoCreate())
886              throw new Error("Attempt to auto-create CoverageComponent.sequence");
887            else if (Configuration.doAutoCreate())
888              this.sequence = new PositiveIntType(); // bb
889          return this.sequence;
890        }
891
892        public boolean hasSequenceElement() { 
893          return this.sequence != null && !this.sequence.isEmpty();
894        }
895
896        public boolean hasSequence() { 
897          return this.sequence != null && !this.sequence.isEmpty();
898        }
899
900        /**
901         * @param value {@link #sequence} (A service line item.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
902         */
903        public CoverageComponent setSequenceElement(PositiveIntType value) { 
904          this.sequence = value;
905          return this;
906        }
907
908        /**
909         * @return A service line item.
910         */
911        public int getSequence() { 
912          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
913        }
914
915        /**
916         * @param value A service line item.
917         */
918        public CoverageComponent setSequence(int value) { 
919            if (this.sequence == null)
920              this.sequence = new PositiveIntType();
921            this.sequence.setValue(value);
922          return this;
923        }
924
925        /**
926         * @return {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
927         */
928        public BooleanType getFocalElement() { 
929          if (this.focal == null)
930            if (Configuration.errorOnAutoCreate())
931              throw new Error("Attempt to auto-create CoverageComponent.focal");
932            else if (Configuration.doAutoCreate())
933              this.focal = new BooleanType(); // bb
934          return this.focal;
935        }
936
937        public boolean hasFocalElement() { 
938          return this.focal != null && !this.focal.isEmpty();
939        }
940
941        public boolean hasFocal() { 
942          return this.focal != null && !this.focal.isEmpty();
943        }
944
945        /**
946         * @param value {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
947         */
948        public CoverageComponent setFocalElement(BooleanType value) { 
949          this.focal = value;
950          return this;
951        }
952
953        /**
954         * @return The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
955         */
956        public boolean getFocal() { 
957          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
958        }
959
960        /**
961         * @param value The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
962         */
963        public CoverageComponent setFocal(boolean value) { 
964            if (this.focal == null)
965              this.focal = new BooleanType();
966            this.focal.setValue(value);
967          return this;
968        }
969
970        /**
971         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
972         */
973        public Reference getCoverage() { 
974          if (this.coverage == null)
975            if (Configuration.errorOnAutoCreate())
976              throw new Error("Attempt to auto-create CoverageComponent.coverage");
977            else if (Configuration.doAutoCreate())
978              this.coverage = new Reference(); // cc
979          return this.coverage;
980        }
981
982        public boolean hasCoverage() { 
983          return this.coverage != null && !this.coverage.isEmpty();
984        }
985
986        /**
987         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
988         */
989        public CoverageComponent setCoverage(Reference value) { 
990          this.coverage = value;
991          return this;
992        }
993
994        /**
995         * @return {@link #coverage} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
996         */
997        public Coverage getCoverageTarget() { 
998          if (this.coverageTarget == null)
999            if (Configuration.errorOnAutoCreate())
1000              throw new Error("Attempt to auto-create CoverageComponent.coverage");
1001            else if (Configuration.doAutoCreate())
1002              this.coverageTarget = new Coverage(); // aa
1003          return this.coverageTarget;
1004        }
1005
1006        /**
1007         * @param value {@link #coverage} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
1008         */
1009        public CoverageComponent setCoverageTarget(Coverage value) { 
1010          this.coverageTarget = value;
1011          return this;
1012        }
1013
1014        /**
1015         * @return {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
1016         */
1017        public StringType getBusinessArrangementElement() { 
1018          if (this.businessArrangement == null)
1019            if (Configuration.errorOnAutoCreate())
1020              throw new Error("Attempt to auto-create CoverageComponent.businessArrangement");
1021            else if (Configuration.doAutoCreate())
1022              this.businessArrangement = new StringType(); // bb
1023          return this.businessArrangement;
1024        }
1025
1026        public boolean hasBusinessArrangementElement() { 
1027          return this.businessArrangement != null && !this.businessArrangement.isEmpty();
1028        }
1029
1030        public boolean hasBusinessArrangement() { 
1031          return this.businessArrangement != null && !this.businessArrangement.isEmpty();
1032        }
1033
1034        /**
1035         * @param value {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
1036         */
1037        public CoverageComponent setBusinessArrangementElement(StringType value) { 
1038          this.businessArrangement = value;
1039          return this;
1040        }
1041
1042        /**
1043         * @return The contract number of a business agreement which describes the terms and conditions.
1044         */
1045        public String getBusinessArrangement() { 
1046          return this.businessArrangement == null ? null : this.businessArrangement.getValue();
1047        }
1048
1049        /**
1050         * @param value The contract number of a business agreement which describes the terms and conditions.
1051         */
1052        public CoverageComponent setBusinessArrangement(String value) { 
1053          if (Utilities.noString(value))
1054            this.businessArrangement = null;
1055          else {
1056            if (this.businessArrangement == null)
1057              this.businessArrangement = new StringType();
1058            this.businessArrangement.setValue(value);
1059          }
1060          return this;
1061        }
1062
1063        /**
1064         * @return {@link #relationship} (The relationship of the patient to the subscriber.)
1065         */
1066        public Coding getRelationship() { 
1067          if (this.relationship == null)
1068            if (Configuration.errorOnAutoCreate())
1069              throw new Error("Attempt to auto-create CoverageComponent.relationship");
1070            else if (Configuration.doAutoCreate())
1071              this.relationship = new Coding(); // cc
1072          return this.relationship;
1073        }
1074
1075        public boolean hasRelationship() { 
1076          return this.relationship != null && !this.relationship.isEmpty();
1077        }
1078
1079        /**
1080         * @param value {@link #relationship} (The relationship of the patient to the subscriber.)
1081         */
1082        public CoverageComponent setRelationship(Coding value) { 
1083          this.relationship = value;
1084          return this;
1085        }
1086
1087        /**
1088         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1089         */
1090        public List<StringType> getPreAuthRef() { 
1091          if (this.preAuthRef == null)
1092            this.preAuthRef = new ArrayList<StringType>();
1093          return this.preAuthRef;
1094        }
1095
1096        public boolean hasPreAuthRef() { 
1097          if (this.preAuthRef == null)
1098            return false;
1099          for (StringType item : this.preAuthRef)
1100            if (!item.isEmpty())
1101              return true;
1102          return false;
1103        }
1104
1105        /**
1106         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1107         */
1108    // syntactic sugar
1109        public StringType addPreAuthRefElement() {//2 
1110          StringType t = new StringType();
1111          if (this.preAuthRef == null)
1112            this.preAuthRef = new ArrayList<StringType>();
1113          this.preAuthRef.add(t);
1114          return t;
1115        }
1116
1117        /**
1118         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1119         */
1120        public CoverageComponent addPreAuthRef(String value) { //1
1121          StringType t = new StringType();
1122          t.setValue(value);
1123          if (this.preAuthRef == null)
1124            this.preAuthRef = new ArrayList<StringType>();
1125          this.preAuthRef.add(t);
1126          return this;
1127        }
1128
1129        /**
1130         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1131         */
1132        public boolean hasPreAuthRef(String value) { 
1133          if (this.preAuthRef == null)
1134            return false;
1135          for (StringType v : this.preAuthRef)
1136            if (v.equals(value)) // string
1137              return true;
1138          return false;
1139        }
1140
1141        /**
1142         * @return {@link #claimResponse} (The Coverages adjudication details.)
1143         */
1144        public Reference getClaimResponse() { 
1145          if (this.claimResponse == null)
1146            if (Configuration.errorOnAutoCreate())
1147              throw new Error("Attempt to auto-create CoverageComponent.claimResponse");
1148            else if (Configuration.doAutoCreate())
1149              this.claimResponse = new Reference(); // cc
1150          return this.claimResponse;
1151        }
1152
1153        public boolean hasClaimResponse() { 
1154          return this.claimResponse != null && !this.claimResponse.isEmpty();
1155        }
1156
1157        /**
1158         * @param value {@link #claimResponse} (The Coverages adjudication details.)
1159         */
1160        public CoverageComponent setClaimResponse(Reference value) { 
1161          this.claimResponse = value;
1162          return this;
1163        }
1164
1165        /**
1166         * @return {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Coverages adjudication details.)
1167         */
1168        public ClaimResponse getClaimResponseTarget() { 
1169          if (this.claimResponseTarget == null)
1170            if (Configuration.errorOnAutoCreate())
1171              throw new Error("Attempt to auto-create CoverageComponent.claimResponse");
1172            else if (Configuration.doAutoCreate())
1173              this.claimResponseTarget = new ClaimResponse(); // aa
1174          return this.claimResponseTarget;
1175        }
1176
1177        /**
1178         * @param value {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Coverages adjudication details.)
1179         */
1180        public CoverageComponent setClaimResponseTarget(ClaimResponse value) { 
1181          this.claimResponseTarget = value;
1182          return this;
1183        }
1184
1185        /**
1186         * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
1187         */
1188        public Coding getOriginalRuleset() { 
1189          if (this.originalRuleset == null)
1190            if (Configuration.errorOnAutoCreate())
1191              throw new Error("Attempt to auto-create CoverageComponent.originalRuleset");
1192            else if (Configuration.doAutoCreate())
1193              this.originalRuleset = new Coding(); // cc
1194          return this.originalRuleset;
1195        }
1196
1197        public boolean hasOriginalRuleset() { 
1198          return this.originalRuleset != null && !this.originalRuleset.isEmpty();
1199        }
1200
1201        /**
1202         * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
1203         */
1204        public CoverageComponent setOriginalRuleset(Coding value) { 
1205          this.originalRuleset = value;
1206          return this;
1207        }
1208
1209        protected void listChildren(List<Property> childrenList) {
1210          super.listChildren(childrenList);
1211          childrenList.add(new Property("sequence", "positiveInt", "A service line item.", 0, java.lang.Integer.MAX_VALUE, sequence));
1212          childrenList.add(new Property("focal", "boolean", "The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.", 0, java.lang.Integer.MAX_VALUE, focal));
1213          childrenList.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
1214          childrenList.add(new Property("businessArrangement", "string", "The contract number of a business agreement which describes the terms and conditions.", 0, java.lang.Integer.MAX_VALUE, businessArrangement));
1215          childrenList.add(new Property("relationship", "Coding", "The relationship of the patient to the subscriber.", 0, java.lang.Integer.MAX_VALUE, relationship));
1216          childrenList.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
1217          childrenList.add(new Property("claimResponse", "Reference(ClaimResponse)", "The Coverages adjudication details.", 0, java.lang.Integer.MAX_VALUE, claimResponse));
1218          childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
1219        }
1220
1221      @Override
1222      public void setProperty(String name, Base value) throws FHIRException {
1223        if (name.equals("sequence"))
1224          this.sequence = castToPositiveInt(value); // PositiveIntType
1225        else if (name.equals("focal"))
1226          this.focal = castToBoolean(value); // BooleanType
1227        else if (name.equals("coverage"))
1228          this.coverage = castToReference(value); // Reference
1229        else if (name.equals("businessArrangement"))
1230          this.businessArrangement = castToString(value); // StringType
1231        else if (name.equals("relationship"))
1232          this.relationship = castToCoding(value); // Coding
1233        else if (name.equals("preAuthRef"))
1234          this.getPreAuthRef().add(castToString(value));
1235        else if (name.equals("claimResponse"))
1236          this.claimResponse = castToReference(value); // Reference
1237        else if (name.equals("originalRuleset"))
1238          this.originalRuleset = castToCoding(value); // Coding
1239        else
1240          super.setProperty(name, value);
1241      }
1242
1243      @Override
1244      public Base addChild(String name) throws FHIRException {
1245        if (name.equals("sequence")) {
1246          throw new FHIRException("Cannot call addChild on a primitive type Claim.sequence");
1247        }
1248        else if (name.equals("focal")) {
1249          throw new FHIRException("Cannot call addChild on a primitive type Claim.focal");
1250        }
1251        else if (name.equals("coverage")) {
1252          this.coverage = new Reference();
1253          return this.coverage;
1254        }
1255        else if (name.equals("businessArrangement")) {
1256          throw new FHIRException("Cannot call addChild on a primitive type Claim.businessArrangement");
1257        }
1258        else if (name.equals("relationship")) {
1259          this.relationship = new Coding();
1260          return this.relationship;
1261        }
1262        else if (name.equals("preAuthRef")) {
1263          throw new FHIRException("Cannot call addChild on a primitive type Claim.preAuthRef");
1264        }
1265        else if (name.equals("claimResponse")) {
1266          this.claimResponse = new Reference();
1267          return this.claimResponse;
1268        }
1269        else if (name.equals("originalRuleset")) {
1270          this.originalRuleset = new Coding();
1271          return this.originalRuleset;
1272        }
1273        else
1274          return super.addChild(name);
1275      }
1276
1277      public CoverageComponent copy() {
1278        CoverageComponent dst = new CoverageComponent();
1279        copyValues(dst);
1280        dst.sequence = sequence == null ? null : sequence.copy();
1281        dst.focal = focal == null ? null : focal.copy();
1282        dst.coverage = coverage == null ? null : coverage.copy();
1283        dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
1284        dst.relationship = relationship == null ? null : relationship.copy();
1285        if (preAuthRef != null) {
1286          dst.preAuthRef = new ArrayList<StringType>();
1287          for (StringType i : preAuthRef)
1288            dst.preAuthRef.add(i.copy());
1289        };
1290        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
1291        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
1292        return dst;
1293      }
1294
1295      @Override
1296      public boolean equalsDeep(Base other) {
1297        if (!super.equalsDeep(other))
1298          return false;
1299        if (!(other instanceof CoverageComponent))
1300          return false;
1301        CoverageComponent o = (CoverageComponent) other;
1302        return compareDeep(sequence, o.sequence, true) && compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true)
1303           && compareDeep(businessArrangement, o.businessArrangement, true) && compareDeep(relationship, o.relationship, true)
1304           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(claimResponse, o.claimResponse, true)
1305           && compareDeep(originalRuleset, o.originalRuleset, true);
1306      }
1307
1308      @Override
1309      public boolean equalsShallow(Base other) {
1310        if (!super.equalsShallow(other))
1311          return false;
1312        if (!(other instanceof CoverageComponent))
1313          return false;
1314        CoverageComponent o = (CoverageComponent) other;
1315        return compareValues(sequence, o.sequence, true) && compareValues(focal, o.focal, true) && compareValues(businessArrangement, o.businessArrangement, true)
1316           && compareValues(preAuthRef, o.preAuthRef, true);
1317      }
1318
1319      public boolean isEmpty() {
1320        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (focal == null || focal.isEmpty())
1321           && (coverage == null || coverage.isEmpty()) && (businessArrangement == null || businessArrangement.isEmpty())
1322           && (relationship == null || relationship.isEmpty()) && (preAuthRef == null || preAuthRef.isEmpty())
1323           && (claimResponse == null || claimResponse.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
1324          ;
1325      }
1326
1327  public String fhirType() {
1328    return "Claim.coverage";
1329
1330  }
1331
1332  }
1333
1334    @Block()
1335    public static class ItemsComponent extends BackboneElement implements IBaseBackboneElement {
1336        /**
1337         * A service line number.
1338         */
1339        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1340        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
1341        protected PositiveIntType sequence;
1342
1343        /**
1344         * The type of product or service.
1345         */
1346        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
1347        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
1348        protected Coding type;
1349
1350        /**
1351         * The practitioner who is responsible for the services rendered to the patient.
1352         */
1353        @Child(name = "provider", type = {Practitioner.class}, order=3, min=0, max=1, modifier=false, summary=true)
1354        @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
1355        protected Reference provider;
1356
1357        /**
1358         * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
1359         */
1360        protected Practitioner providerTarget;
1361
1362        /**
1363         * Diagnosis applicable for this service or product line.
1364         */
1365        @Child(name = "diagnosisLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1366        @Description(shortDefinition="Diagnosis Link", formalDefinition="Diagnosis applicable for this service or product line." )
1367        protected List<PositiveIntType> diagnosisLinkId;
1368
1369        /**
1370         * If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.
1371         */
1372        @Child(name = "service", type = {Coding.class}, order=5, min=1, max=1, modifier=false, summary=true)
1373        @Description(shortDefinition="Item Code", formalDefinition="If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied." )
1374        protected Coding service;
1375
1376        /**
1377         * The date when the enclosed suite of services were performed or completed.
1378         */
1379        @Child(name = "serviceDate", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1380        @Description(shortDefinition="Date of Service", formalDefinition="The date when the enclosed suite of services were performed or completed." )
1381        protected DateType serviceDate;
1382
1383        /**
1384         * The number of repetitions of a service or product.
1385         */
1386        @Child(name = "quantity", type = {SimpleQuantity.class}, order=7, min=0, max=1, modifier=false, summary=true)
1387        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
1388        protected SimpleQuantity quantity;
1389
1390        /**
1391         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
1392         */
1393        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=true)
1394        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
1395        protected Money unitPrice;
1396
1397        /**
1398         * 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.
1399         */
1400        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1401        @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." )
1402        protected DecimalType factor;
1403
1404        /**
1405         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
1406         */
1407        @Child(name = "points", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1408        @Description(shortDefinition="Difficulty scaling factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point." )
1409        protected DecimalType points;
1410
1411        /**
1412         * The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
1413         */
1414        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=true)
1415        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
1416        protected Money net;
1417
1418        /**
1419         * List of Unique Device Identifiers associated with this line item.
1420         */
1421        @Child(name = "udi", type = {Coding.class}, order=12, min=0, max=1, modifier=false, summary=true)
1422        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
1423        protected Coding udi;
1424
1425        /**
1426         * Physical service site on the patient (limb, tooth, etc.).
1427         */
1428        @Child(name = "bodySite", type = {Coding.class}, order=13, min=0, max=1, modifier=false, summary=true)
1429        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
1430        protected Coding bodySite;
1431
1432        /**
1433         * A region or surface of the site, e.g. limb region or tooth surface(s).
1434         */
1435        @Child(name = "subSite", type = {Coding.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1436        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, e.g. limb region or tooth surface(s)." )
1437        protected List<Coding> subSite;
1438
1439        /**
1440         * Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.
1441         */
1442        @Child(name = "modifier", type = {Coding.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1443        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen." )
1444        protected List<Coding> modifier;
1445
1446        /**
1447         * Second tier of goods and services.
1448         */
1449        @Child(name = "detail", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1450        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
1451        protected List<DetailComponent> detail;
1452
1453        /**
1454         * The materials and placement date of prior fixed prosthesis.
1455         */
1456        @Child(name = "prosthesis", type = {}, order=17, min=0, max=1, modifier=false, summary=true)
1457        @Description(shortDefinition="Prosthetic details", formalDefinition="The materials and placement date of prior fixed prosthesis." )
1458        protected ProsthesisComponent prosthesis;
1459
1460        private static final long serialVersionUID = 1295830456L;
1461
1462    /*
1463     * Constructor
1464     */
1465      public ItemsComponent() {
1466        super();
1467      }
1468
1469    /*
1470     * Constructor
1471     */
1472      public ItemsComponent(PositiveIntType sequence, Coding type, Coding service) {
1473        super();
1474        this.sequence = sequence;
1475        this.type = type;
1476        this.service = service;
1477      }
1478
1479        /**
1480         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1481         */
1482        public PositiveIntType getSequenceElement() { 
1483          if (this.sequence == null)
1484            if (Configuration.errorOnAutoCreate())
1485              throw new Error("Attempt to auto-create ItemsComponent.sequence");
1486            else if (Configuration.doAutoCreate())
1487              this.sequence = new PositiveIntType(); // bb
1488          return this.sequence;
1489        }
1490
1491        public boolean hasSequenceElement() { 
1492          return this.sequence != null && !this.sequence.isEmpty();
1493        }
1494
1495        public boolean hasSequence() { 
1496          return this.sequence != null && !this.sequence.isEmpty();
1497        }
1498
1499        /**
1500         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1501         */
1502        public ItemsComponent setSequenceElement(PositiveIntType value) { 
1503          this.sequence = value;
1504          return this;
1505        }
1506
1507        /**
1508         * @return A service line number.
1509         */
1510        public int getSequence() { 
1511          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1512        }
1513
1514        /**
1515         * @param value A service line number.
1516         */
1517        public ItemsComponent setSequence(int value) { 
1518            if (this.sequence == null)
1519              this.sequence = new PositiveIntType();
1520            this.sequence.setValue(value);
1521          return this;
1522        }
1523
1524        /**
1525         * @return {@link #type} (The type of product or service.)
1526         */
1527        public Coding getType() { 
1528          if (this.type == null)
1529            if (Configuration.errorOnAutoCreate())
1530              throw new Error("Attempt to auto-create ItemsComponent.type");
1531            else if (Configuration.doAutoCreate())
1532              this.type = new Coding(); // cc
1533          return this.type;
1534        }
1535
1536        public boolean hasType() { 
1537          return this.type != null && !this.type.isEmpty();
1538        }
1539
1540        /**
1541         * @param value {@link #type} (The type of product or service.)
1542         */
1543        public ItemsComponent setType(Coding value) { 
1544          this.type = value;
1545          return this;
1546        }
1547
1548        /**
1549         * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1550         */
1551        public Reference getProvider() { 
1552          if (this.provider == null)
1553            if (Configuration.errorOnAutoCreate())
1554              throw new Error("Attempt to auto-create ItemsComponent.provider");
1555            else if (Configuration.doAutoCreate())
1556              this.provider = new Reference(); // cc
1557          return this.provider;
1558        }
1559
1560        public boolean hasProvider() { 
1561          return this.provider != null && !this.provider.isEmpty();
1562        }
1563
1564        /**
1565         * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1566         */
1567        public ItemsComponent setProvider(Reference value) { 
1568          this.provider = value;
1569          return this;
1570        }
1571
1572        /**
1573         * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
1574         */
1575        public Practitioner getProviderTarget() { 
1576          if (this.providerTarget == null)
1577            if (Configuration.errorOnAutoCreate())
1578              throw new Error("Attempt to auto-create ItemsComponent.provider");
1579            else if (Configuration.doAutoCreate())
1580              this.providerTarget = new Practitioner(); // aa
1581          return this.providerTarget;
1582        }
1583
1584        /**
1585         * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
1586         */
1587        public ItemsComponent setProviderTarget(Practitioner value) { 
1588          this.providerTarget = value;
1589          return this;
1590        }
1591
1592        /**
1593         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1594         */
1595        public List<PositiveIntType> getDiagnosisLinkId() { 
1596          if (this.diagnosisLinkId == null)
1597            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1598          return this.diagnosisLinkId;
1599        }
1600
1601        public boolean hasDiagnosisLinkId() { 
1602          if (this.diagnosisLinkId == null)
1603            return false;
1604          for (PositiveIntType item : this.diagnosisLinkId)
1605            if (!item.isEmpty())
1606              return true;
1607          return false;
1608        }
1609
1610        /**
1611         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1612         */
1613    // syntactic sugar
1614        public PositiveIntType addDiagnosisLinkIdElement() {//2 
1615          PositiveIntType t = new PositiveIntType();
1616          if (this.diagnosisLinkId == null)
1617            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1618          this.diagnosisLinkId.add(t);
1619          return t;
1620        }
1621
1622        /**
1623         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1624         */
1625        public ItemsComponent addDiagnosisLinkId(int value) { //1
1626          PositiveIntType t = new PositiveIntType();
1627          t.setValue(value);
1628          if (this.diagnosisLinkId == null)
1629            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1630          this.diagnosisLinkId.add(t);
1631          return this;
1632        }
1633
1634        /**
1635         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1636         */
1637        public boolean hasDiagnosisLinkId(int value) { 
1638          if (this.diagnosisLinkId == null)
1639            return false;
1640          for (PositiveIntType v : this.diagnosisLinkId)
1641            if (v.equals(value)) // positiveInt
1642              return true;
1643          return false;
1644        }
1645
1646        /**
1647         * @return {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
1648         */
1649        public Coding getService() { 
1650          if (this.service == null)
1651            if (Configuration.errorOnAutoCreate())
1652              throw new Error("Attempt to auto-create ItemsComponent.service");
1653            else if (Configuration.doAutoCreate())
1654              this.service = new Coding(); // cc
1655          return this.service;
1656        }
1657
1658        public boolean hasService() { 
1659          return this.service != null && !this.service.isEmpty();
1660        }
1661
1662        /**
1663         * @param value {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
1664         */
1665        public ItemsComponent setService(Coding value) { 
1666          this.service = value;
1667          return this;
1668        }
1669
1670        /**
1671         * @return {@link #serviceDate} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getServiceDate" gives direct access to the value
1672         */
1673        public DateType getServiceDateElement() { 
1674          if (this.serviceDate == null)
1675            if (Configuration.errorOnAutoCreate())
1676              throw new Error("Attempt to auto-create ItemsComponent.serviceDate");
1677            else if (Configuration.doAutoCreate())
1678              this.serviceDate = new DateType(); // bb
1679          return this.serviceDate;
1680        }
1681
1682        public boolean hasServiceDateElement() { 
1683          return this.serviceDate != null && !this.serviceDate.isEmpty();
1684        }
1685
1686        public boolean hasServiceDate() { 
1687          return this.serviceDate != null && !this.serviceDate.isEmpty();
1688        }
1689
1690        /**
1691         * @param value {@link #serviceDate} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getServiceDate" gives direct access to the value
1692         */
1693        public ItemsComponent setServiceDateElement(DateType value) { 
1694          this.serviceDate = value;
1695          return this;
1696        }
1697
1698        /**
1699         * @return The date when the enclosed suite of services were performed or completed.
1700         */
1701        public Date getServiceDate() { 
1702          return this.serviceDate == null ? null : this.serviceDate.getValue();
1703        }
1704
1705        /**
1706         * @param value The date when the enclosed suite of services were performed or completed.
1707         */
1708        public ItemsComponent setServiceDate(Date value) { 
1709          if (value == null)
1710            this.serviceDate = null;
1711          else {
1712            if (this.serviceDate == null)
1713              this.serviceDate = new DateType();
1714            this.serviceDate.setValue(value);
1715          }
1716          return this;
1717        }
1718
1719        /**
1720         * @return {@link #quantity} (The number of repetitions of a service or product.)
1721         */
1722        public SimpleQuantity getQuantity() { 
1723          if (this.quantity == null)
1724            if (Configuration.errorOnAutoCreate())
1725              throw new Error("Attempt to auto-create ItemsComponent.quantity");
1726            else if (Configuration.doAutoCreate())
1727              this.quantity = new SimpleQuantity(); // cc
1728          return this.quantity;
1729        }
1730
1731        public boolean hasQuantity() { 
1732          return this.quantity != null && !this.quantity.isEmpty();
1733        }
1734
1735        /**
1736         * @param value {@link #quantity} (The number of repetitions of a service or product.)
1737         */
1738        public ItemsComponent setQuantity(SimpleQuantity value) { 
1739          this.quantity = value;
1740          return this;
1741        }
1742
1743        /**
1744         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
1745         */
1746        public Money getUnitPrice() { 
1747          if (this.unitPrice == null)
1748            if (Configuration.errorOnAutoCreate())
1749              throw new Error("Attempt to auto-create ItemsComponent.unitPrice");
1750            else if (Configuration.doAutoCreate())
1751              this.unitPrice = new Money(); // cc
1752          return this.unitPrice;
1753        }
1754
1755        public boolean hasUnitPrice() { 
1756          return this.unitPrice != null && !this.unitPrice.isEmpty();
1757        }
1758
1759        /**
1760         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
1761         */
1762        public ItemsComponent setUnitPrice(Money value) { 
1763          this.unitPrice = value;
1764          return this;
1765        }
1766
1767        /**
1768         * @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
1769         */
1770        public DecimalType getFactorElement() { 
1771          if (this.factor == null)
1772            if (Configuration.errorOnAutoCreate())
1773              throw new Error("Attempt to auto-create ItemsComponent.factor");
1774            else if (Configuration.doAutoCreate())
1775              this.factor = new DecimalType(); // bb
1776          return this.factor;
1777        }
1778
1779        public boolean hasFactorElement() { 
1780          return this.factor != null && !this.factor.isEmpty();
1781        }
1782
1783        public boolean hasFactor() { 
1784          return this.factor != null && !this.factor.isEmpty();
1785        }
1786
1787        /**
1788         * @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
1789         */
1790        public ItemsComponent setFactorElement(DecimalType value) { 
1791          this.factor = value;
1792          return this;
1793        }
1794
1795        /**
1796         * @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.
1797         */
1798        public BigDecimal getFactor() { 
1799          return this.factor == null ? null : this.factor.getValue();
1800        }
1801
1802        /**
1803         * @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.
1804         */
1805        public ItemsComponent setFactor(BigDecimal value) { 
1806          if (value == null)
1807            this.factor = null;
1808          else {
1809            if (this.factor == null)
1810              this.factor = new DecimalType();
1811            this.factor.setValue(value);
1812          }
1813          return this;
1814        }
1815
1816        /**
1817         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
1818         */
1819        public DecimalType getPointsElement() { 
1820          if (this.points == null)
1821            if (Configuration.errorOnAutoCreate())
1822              throw new Error("Attempt to auto-create ItemsComponent.points");
1823            else if (Configuration.doAutoCreate())
1824              this.points = new DecimalType(); // bb
1825          return this.points;
1826        }
1827
1828        public boolean hasPointsElement() { 
1829          return this.points != null && !this.points.isEmpty();
1830        }
1831
1832        public boolean hasPoints() { 
1833          return this.points != null && !this.points.isEmpty();
1834        }
1835
1836        /**
1837         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
1838         */
1839        public ItemsComponent setPointsElement(DecimalType value) { 
1840          this.points = value;
1841          return this;
1842        }
1843
1844        /**
1845         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
1846         */
1847        public BigDecimal getPoints() { 
1848          return this.points == null ? null : this.points.getValue();
1849        }
1850
1851        /**
1852         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
1853         */
1854        public ItemsComponent setPoints(BigDecimal value) { 
1855          if (value == null)
1856            this.points = null;
1857          else {
1858            if (this.points == null)
1859              this.points = new DecimalType();
1860            this.points.setValue(value);
1861          }
1862          return this;
1863        }
1864
1865        /**
1866         * @return {@link #net} (The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
1867         */
1868        public Money getNet() { 
1869          if (this.net == null)
1870            if (Configuration.errorOnAutoCreate())
1871              throw new Error("Attempt to auto-create ItemsComponent.net");
1872            else if (Configuration.doAutoCreate())
1873              this.net = new Money(); // cc
1874          return this.net;
1875        }
1876
1877        public boolean hasNet() { 
1878          return this.net != null && !this.net.isEmpty();
1879        }
1880
1881        /**
1882         * @param value {@link #net} (The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
1883         */
1884        public ItemsComponent setNet(Money value) { 
1885          this.net = value;
1886          return this;
1887        }
1888
1889        /**
1890         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
1891         */
1892        public Coding getUdi() { 
1893          if (this.udi == null)
1894            if (Configuration.errorOnAutoCreate())
1895              throw new Error("Attempt to auto-create ItemsComponent.udi");
1896            else if (Configuration.doAutoCreate())
1897              this.udi = new Coding(); // cc
1898          return this.udi;
1899        }
1900
1901        public boolean hasUdi() { 
1902          return this.udi != null && !this.udi.isEmpty();
1903        }
1904
1905        /**
1906         * @param value {@link #udi} (List of Unique Device Identifiers associated with this line item.)
1907         */
1908        public ItemsComponent setUdi(Coding value) { 
1909          this.udi = value;
1910          return this;
1911        }
1912
1913        /**
1914         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
1915         */
1916        public Coding getBodySite() { 
1917          if (this.bodySite == null)
1918            if (Configuration.errorOnAutoCreate())
1919              throw new Error("Attempt to auto-create ItemsComponent.bodySite");
1920            else if (Configuration.doAutoCreate())
1921              this.bodySite = new Coding(); // cc
1922          return this.bodySite;
1923        }
1924
1925        public boolean hasBodySite() { 
1926          return this.bodySite != null && !this.bodySite.isEmpty();
1927        }
1928
1929        /**
1930         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
1931         */
1932        public ItemsComponent setBodySite(Coding value) { 
1933          this.bodySite = value;
1934          return this;
1935        }
1936
1937        /**
1938         * @return {@link #subSite} (A region or surface of the site, e.g. limb region or tooth surface(s).)
1939         */
1940        public List<Coding> getSubSite() { 
1941          if (this.subSite == null)
1942            this.subSite = new ArrayList<Coding>();
1943          return this.subSite;
1944        }
1945
1946        public boolean hasSubSite() { 
1947          if (this.subSite == null)
1948            return false;
1949          for (Coding item : this.subSite)
1950            if (!item.isEmpty())
1951              return true;
1952          return false;
1953        }
1954
1955        /**
1956         * @return {@link #subSite} (A region or surface of the site, e.g. limb region or tooth surface(s).)
1957         */
1958    // syntactic sugar
1959        public Coding addSubSite() { //3
1960          Coding t = new Coding();
1961          if (this.subSite == null)
1962            this.subSite = new ArrayList<Coding>();
1963          this.subSite.add(t);
1964          return t;
1965        }
1966
1967    // syntactic sugar
1968        public ItemsComponent addSubSite(Coding t) { //3
1969          if (t == null)
1970            return this;
1971          if (this.subSite == null)
1972            this.subSite = new ArrayList<Coding>();
1973          this.subSite.add(t);
1974          return this;
1975        }
1976
1977        /**
1978         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.)
1979         */
1980        public List<Coding> getModifier() { 
1981          if (this.modifier == null)
1982            this.modifier = new ArrayList<Coding>();
1983          return this.modifier;
1984        }
1985
1986        public boolean hasModifier() { 
1987          if (this.modifier == null)
1988            return false;
1989          for (Coding item : this.modifier)
1990            if (!item.isEmpty())
1991              return true;
1992          return false;
1993        }
1994
1995        /**
1996         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.)
1997         */
1998    // syntactic sugar
1999        public Coding addModifier() { //3
2000          Coding t = new Coding();
2001          if (this.modifier == null)
2002            this.modifier = new ArrayList<Coding>();
2003          this.modifier.add(t);
2004          return t;
2005        }
2006
2007    // syntactic sugar
2008        public ItemsComponent addModifier(Coding t) { //3
2009          if (t == null)
2010            return this;
2011          if (this.modifier == null)
2012            this.modifier = new ArrayList<Coding>();
2013          this.modifier.add(t);
2014          return this;
2015        }
2016
2017        /**
2018         * @return {@link #detail} (Second tier of goods and services.)
2019         */
2020        public List<DetailComponent> getDetail() { 
2021          if (this.detail == null)
2022            this.detail = new ArrayList<DetailComponent>();
2023          return this.detail;
2024        }
2025
2026        public boolean hasDetail() { 
2027          if (this.detail == null)
2028            return false;
2029          for (DetailComponent item : this.detail)
2030            if (!item.isEmpty())
2031              return true;
2032          return false;
2033        }
2034
2035        /**
2036         * @return {@link #detail} (Second tier of goods and services.)
2037         */
2038    // syntactic sugar
2039        public DetailComponent addDetail() { //3
2040          DetailComponent t = new DetailComponent();
2041          if (this.detail == null)
2042            this.detail = new ArrayList<DetailComponent>();
2043          this.detail.add(t);
2044          return t;
2045        }
2046
2047    // syntactic sugar
2048        public ItemsComponent addDetail(DetailComponent t) { //3
2049          if (t == null)
2050            return this;
2051          if (this.detail == null)
2052            this.detail = new ArrayList<DetailComponent>();
2053          this.detail.add(t);
2054          return this;
2055        }
2056
2057        /**
2058         * @return {@link #prosthesis} (The materials and placement date of prior fixed prosthesis.)
2059         */
2060        public ProsthesisComponent getProsthesis() { 
2061          if (this.prosthesis == null)
2062            if (Configuration.errorOnAutoCreate())
2063              throw new Error("Attempt to auto-create ItemsComponent.prosthesis");
2064            else if (Configuration.doAutoCreate())
2065              this.prosthesis = new ProsthesisComponent(); // cc
2066          return this.prosthesis;
2067        }
2068
2069        public boolean hasProsthesis() { 
2070          return this.prosthesis != null && !this.prosthesis.isEmpty();
2071        }
2072
2073        /**
2074         * @param value {@link #prosthesis} (The materials and placement date of prior fixed prosthesis.)
2075         */
2076        public ItemsComponent setProsthesis(ProsthesisComponent value) { 
2077          this.prosthesis = value;
2078          return this;
2079        }
2080
2081        protected void listChildren(List<Property> childrenList) {
2082          super.listChildren(childrenList);
2083          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
2084          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
2085          childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
2086          childrenList.add(new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId));
2087          childrenList.add(new Property("service", "Coding", "If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
2088          childrenList.add(new Property("serviceDate", "date", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, serviceDate));
2089          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
2090          childrenList.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
2091          childrenList.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, java.lang.Integer.MAX_VALUE, factor));
2092          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
2093          childrenList.add(new Property("net", "Money", "The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
2094          childrenList.add(new Property("udi", "Coding", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2095          childrenList.add(new Property("bodySite", "Coding", "Physical service site on the patient (limb, tooth, etc.).", 0, java.lang.Integer.MAX_VALUE, bodySite));
2096          childrenList.add(new Property("subSite", "Coding", "A region or surface of the site, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
2097          childrenList.add(new Property("modifier", "Coding", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.", 0, java.lang.Integer.MAX_VALUE, modifier));
2098          childrenList.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
2099          childrenList.add(new Property("prosthesis", "", "The materials and placement date of prior fixed prosthesis.", 0, java.lang.Integer.MAX_VALUE, prosthesis));
2100        }
2101
2102      @Override
2103      public void setProperty(String name, Base value) throws FHIRException {
2104        if (name.equals("sequence"))
2105          this.sequence = castToPositiveInt(value); // PositiveIntType
2106        else if (name.equals("type"))
2107          this.type = castToCoding(value); // Coding
2108        else if (name.equals("provider"))
2109          this.provider = castToReference(value); // Reference
2110        else if (name.equals("diagnosisLinkId"))
2111          this.getDiagnosisLinkId().add(castToPositiveInt(value));
2112        else if (name.equals("service"))
2113          this.service = castToCoding(value); // Coding
2114        else if (name.equals("serviceDate"))
2115          this.serviceDate = castToDate(value); // DateType
2116        else if (name.equals("quantity"))
2117          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2118        else if (name.equals("unitPrice"))
2119          this.unitPrice = castToMoney(value); // Money
2120        else if (name.equals("factor"))
2121          this.factor = castToDecimal(value); // DecimalType
2122        else if (name.equals("points"))
2123          this.points = castToDecimal(value); // DecimalType
2124        else if (name.equals("net"))
2125          this.net = castToMoney(value); // Money
2126        else if (name.equals("udi"))
2127          this.udi = castToCoding(value); // Coding
2128        else if (name.equals("bodySite"))
2129          this.bodySite = castToCoding(value); // Coding
2130        else if (name.equals("subSite"))
2131          this.getSubSite().add(castToCoding(value));
2132        else if (name.equals("modifier"))
2133          this.getModifier().add(castToCoding(value));
2134        else if (name.equals("detail"))
2135          this.getDetail().add((DetailComponent) value);
2136        else if (name.equals("prosthesis"))
2137          this.prosthesis = (ProsthesisComponent) value; // ProsthesisComponent
2138        else
2139          super.setProperty(name, value);
2140      }
2141
2142      @Override
2143      public Base addChild(String name) throws FHIRException {
2144        if (name.equals("sequence")) {
2145          throw new FHIRException("Cannot call addChild on a primitive type Claim.sequence");
2146        }
2147        else if (name.equals("type")) {
2148          this.type = new Coding();
2149          return this.type;
2150        }
2151        else if (name.equals("provider")) {
2152          this.provider = new Reference();
2153          return this.provider;
2154        }
2155        else if (name.equals("diagnosisLinkId")) {
2156          throw new FHIRException("Cannot call addChild on a primitive type Claim.diagnosisLinkId");
2157        }
2158        else if (name.equals("service")) {
2159          this.service = new Coding();
2160          return this.service;
2161        }
2162        else if (name.equals("serviceDate")) {
2163          throw new FHIRException("Cannot call addChild on a primitive type Claim.serviceDate");
2164        }
2165        else if (name.equals("quantity")) {
2166          this.quantity = new SimpleQuantity();
2167          return this.quantity;
2168        }
2169        else if (name.equals("unitPrice")) {
2170          this.unitPrice = new Money();
2171          return this.unitPrice;
2172        }
2173        else if (name.equals("factor")) {
2174          throw new FHIRException("Cannot call addChild on a primitive type Claim.factor");
2175        }
2176        else if (name.equals("points")) {
2177          throw new FHIRException("Cannot call addChild on a primitive type Claim.points");
2178        }
2179        else if (name.equals("net")) {
2180          this.net = new Money();
2181          return this.net;
2182        }
2183        else if (name.equals("udi")) {
2184          this.udi = new Coding();
2185          return this.udi;
2186        }
2187        else if (name.equals("bodySite")) {
2188          this.bodySite = new Coding();
2189          return this.bodySite;
2190        }
2191        else if (name.equals("subSite")) {
2192          return addSubSite();
2193        }
2194        else if (name.equals("modifier")) {
2195          return addModifier();
2196        }
2197        else if (name.equals("detail")) {
2198          return addDetail();
2199        }
2200        else if (name.equals("prosthesis")) {
2201          this.prosthesis = new ProsthesisComponent();
2202          return this.prosthesis;
2203        }
2204        else
2205          return super.addChild(name);
2206      }
2207
2208      public ItemsComponent copy() {
2209        ItemsComponent dst = new ItemsComponent();
2210        copyValues(dst);
2211        dst.sequence = sequence == null ? null : sequence.copy();
2212        dst.type = type == null ? null : type.copy();
2213        dst.provider = provider == null ? null : provider.copy();
2214        if (diagnosisLinkId != null) {
2215          dst.diagnosisLinkId = new ArrayList<PositiveIntType>();
2216          for (PositiveIntType i : diagnosisLinkId)
2217            dst.diagnosisLinkId.add(i.copy());
2218        };
2219        dst.service = service == null ? null : service.copy();
2220        dst.serviceDate = serviceDate == null ? null : serviceDate.copy();
2221        dst.quantity = quantity == null ? null : quantity.copy();
2222        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
2223        dst.factor = factor == null ? null : factor.copy();
2224        dst.points = points == null ? null : points.copy();
2225        dst.net = net == null ? null : net.copy();
2226        dst.udi = udi == null ? null : udi.copy();
2227        dst.bodySite = bodySite == null ? null : bodySite.copy();
2228        if (subSite != null) {
2229          dst.subSite = new ArrayList<Coding>();
2230          for (Coding i : subSite)
2231            dst.subSite.add(i.copy());
2232        };
2233        if (modifier != null) {
2234          dst.modifier = new ArrayList<Coding>();
2235          for (Coding i : modifier)
2236            dst.modifier.add(i.copy());
2237        };
2238        if (detail != null) {
2239          dst.detail = new ArrayList<DetailComponent>();
2240          for (DetailComponent i : detail)
2241            dst.detail.add(i.copy());
2242        };
2243        dst.prosthesis = prosthesis == null ? null : prosthesis.copy();
2244        return dst;
2245      }
2246
2247      @Override
2248      public boolean equalsDeep(Base other) {
2249        if (!super.equalsDeep(other))
2250          return false;
2251        if (!(other instanceof ItemsComponent))
2252          return false;
2253        ItemsComponent o = (ItemsComponent) other;
2254        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(provider, o.provider, true)
2255           && compareDeep(diagnosisLinkId, o.diagnosisLinkId, true) && compareDeep(service, o.service, true)
2256           && compareDeep(serviceDate, o.serviceDate, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
2257           && compareDeep(factor, o.factor, true) && compareDeep(points, o.points, true) && compareDeep(net, o.net, true)
2258           && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
2259           && compareDeep(modifier, o.modifier, true) && compareDeep(detail, o.detail, true) && compareDeep(prosthesis, o.prosthesis, true)
2260          ;
2261      }
2262
2263      @Override
2264      public boolean equalsShallow(Base other) {
2265        if (!super.equalsShallow(other))
2266          return false;
2267        if (!(other instanceof ItemsComponent))
2268          return false;
2269        ItemsComponent o = (ItemsComponent) other;
2270        return compareValues(sequence, o.sequence, true) && compareValues(diagnosisLinkId, o.diagnosisLinkId, true)
2271           && compareValues(serviceDate, o.serviceDate, true) && compareValues(factor, o.factor, true) && compareValues(points, o.points, true)
2272          ;
2273      }
2274
2275      public boolean isEmpty() {
2276        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
2277           && (provider == null || provider.isEmpty()) && (diagnosisLinkId == null || diagnosisLinkId.isEmpty())
2278           && (service == null || service.isEmpty()) && (serviceDate == null || serviceDate.isEmpty())
2279           && (quantity == null || quantity.isEmpty()) && (unitPrice == null || unitPrice.isEmpty())
2280           && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty()) && (net == null || net.isEmpty())
2281           && (udi == null || udi.isEmpty()) && (bodySite == null || bodySite.isEmpty()) && (subSite == null || subSite.isEmpty())
2282           && (modifier == null || modifier.isEmpty()) && (detail == null || detail.isEmpty()) && (prosthesis == null || prosthesis.isEmpty())
2283          ;
2284      }
2285
2286  public String fhirType() {
2287    return "Claim.item";
2288
2289  }
2290
2291  }
2292
2293    @Block()
2294    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
2295        /**
2296         * A service line number.
2297         */
2298        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2299        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
2300        protected PositiveIntType sequence;
2301
2302        /**
2303         * The type of product or service.
2304         */
2305        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
2306        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
2307        protected Coding type;
2308
2309        /**
2310         * If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.
2311         */
2312        @Child(name = "service", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
2313        @Description(shortDefinition="Additional item codes", formalDefinition="If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied." )
2314        protected Coding service;
2315
2316        /**
2317         * The number of repetitions of a service or product.
2318         */
2319        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=true)
2320        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
2321        protected SimpleQuantity quantity;
2322
2323        /**
2324         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
2325         */
2326        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=true)
2327        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
2328        protected Money unitPrice;
2329
2330        /**
2331         * 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.
2332         */
2333        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2334        @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." )
2335        protected DecimalType factor;
2336
2337        /**
2338         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2339         */
2340        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2341        @Description(shortDefinition="Difficulty scaling factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point." )
2342        protected DecimalType points;
2343
2344        /**
2345         * The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
2346         */
2347        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=true)
2348        @Description(shortDefinition="Total additional item cost", formalDefinition="The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
2349        protected Money net;
2350
2351        /**
2352         * List of Unique Device Identifiers associated with this line item.
2353         */
2354        @Child(name = "udi", type = {Coding.class}, order=9, min=0, max=1, modifier=false, summary=true)
2355        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
2356        protected Coding udi;
2357
2358        /**
2359         * Third tier of goods and services.
2360         */
2361        @Child(name = "subDetail", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2362        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
2363        protected List<SubDetailComponent> subDetail;
2364
2365        private static final long serialVersionUID = 5768017L;
2366
2367    /*
2368     * Constructor
2369     */
2370      public DetailComponent() {
2371        super();
2372      }
2373
2374    /*
2375     * Constructor
2376     */
2377      public DetailComponent(PositiveIntType sequence, Coding type, Coding service) {
2378        super();
2379        this.sequence = sequence;
2380        this.type = type;
2381        this.service = service;
2382      }
2383
2384        /**
2385         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2386         */
2387        public PositiveIntType getSequenceElement() { 
2388          if (this.sequence == null)
2389            if (Configuration.errorOnAutoCreate())
2390              throw new Error("Attempt to auto-create DetailComponent.sequence");
2391            else if (Configuration.doAutoCreate())
2392              this.sequence = new PositiveIntType(); // bb
2393          return this.sequence;
2394        }
2395
2396        public boolean hasSequenceElement() { 
2397          return this.sequence != null && !this.sequence.isEmpty();
2398        }
2399
2400        public boolean hasSequence() { 
2401          return this.sequence != null && !this.sequence.isEmpty();
2402        }
2403
2404        /**
2405         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2406         */
2407        public DetailComponent setSequenceElement(PositiveIntType value) { 
2408          this.sequence = value;
2409          return this;
2410        }
2411
2412        /**
2413         * @return A service line number.
2414         */
2415        public int getSequence() { 
2416          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2417        }
2418
2419        /**
2420         * @param value A service line number.
2421         */
2422        public DetailComponent setSequence(int value) { 
2423            if (this.sequence == null)
2424              this.sequence = new PositiveIntType();
2425            this.sequence.setValue(value);
2426          return this;
2427        }
2428
2429        /**
2430         * @return {@link #type} (The type of product or service.)
2431         */
2432        public Coding getType() { 
2433          if (this.type == null)
2434            if (Configuration.errorOnAutoCreate())
2435              throw new Error("Attempt to auto-create DetailComponent.type");
2436            else if (Configuration.doAutoCreate())
2437              this.type = new Coding(); // cc
2438          return this.type;
2439        }
2440
2441        public boolean hasType() { 
2442          return this.type != null && !this.type.isEmpty();
2443        }
2444
2445        /**
2446         * @param value {@link #type} (The type of product or service.)
2447         */
2448        public DetailComponent setType(Coding value) { 
2449          this.type = value;
2450          return this;
2451        }
2452
2453        /**
2454         * @return {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
2455         */
2456        public Coding getService() { 
2457          if (this.service == null)
2458            if (Configuration.errorOnAutoCreate())
2459              throw new Error("Attempt to auto-create DetailComponent.service");
2460            else if (Configuration.doAutoCreate())
2461              this.service = new Coding(); // cc
2462          return this.service;
2463        }
2464
2465        public boolean hasService() { 
2466          return this.service != null && !this.service.isEmpty();
2467        }
2468
2469        /**
2470         * @param value {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
2471         */
2472        public DetailComponent setService(Coding value) { 
2473          this.service = value;
2474          return this;
2475        }
2476
2477        /**
2478         * @return {@link #quantity} (The number of repetitions of a service or product.)
2479         */
2480        public SimpleQuantity getQuantity() { 
2481          if (this.quantity == null)
2482            if (Configuration.errorOnAutoCreate())
2483              throw new Error("Attempt to auto-create DetailComponent.quantity");
2484            else if (Configuration.doAutoCreate())
2485              this.quantity = new SimpleQuantity(); // cc
2486          return this.quantity;
2487        }
2488
2489        public boolean hasQuantity() { 
2490          return this.quantity != null && !this.quantity.isEmpty();
2491        }
2492
2493        /**
2494         * @param value {@link #quantity} (The number of repetitions of a service or product.)
2495         */
2496        public DetailComponent setQuantity(SimpleQuantity value) { 
2497          this.quantity = value;
2498          return this;
2499        }
2500
2501        /**
2502         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
2503         */
2504        public Money getUnitPrice() { 
2505          if (this.unitPrice == null)
2506            if (Configuration.errorOnAutoCreate())
2507              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
2508            else if (Configuration.doAutoCreate())
2509              this.unitPrice = new Money(); // cc
2510          return this.unitPrice;
2511        }
2512
2513        public boolean hasUnitPrice() { 
2514          return this.unitPrice != null && !this.unitPrice.isEmpty();
2515        }
2516
2517        /**
2518         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
2519         */
2520        public DetailComponent setUnitPrice(Money value) { 
2521          this.unitPrice = value;
2522          return this;
2523        }
2524
2525        /**
2526         * @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
2527         */
2528        public DecimalType getFactorElement() { 
2529          if (this.factor == null)
2530            if (Configuration.errorOnAutoCreate())
2531              throw new Error("Attempt to auto-create DetailComponent.factor");
2532            else if (Configuration.doAutoCreate())
2533              this.factor = new DecimalType(); // bb
2534          return this.factor;
2535        }
2536
2537        public boolean hasFactorElement() { 
2538          return this.factor != null && !this.factor.isEmpty();
2539        }
2540
2541        public boolean hasFactor() { 
2542          return this.factor != null && !this.factor.isEmpty();
2543        }
2544
2545        /**
2546         * @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
2547         */
2548        public DetailComponent setFactorElement(DecimalType value) { 
2549          this.factor = value;
2550          return this;
2551        }
2552
2553        /**
2554         * @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.
2555         */
2556        public BigDecimal getFactor() { 
2557          return this.factor == null ? null : this.factor.getValue();
2558        }
2559
2560        /**
2561         * @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.
2562         */
2563        public DetailComponent setFactor(BigDecimal value) { 
2564          if (value == null)
2565            this.factor = null;
2566          else {
2567            if (this.factor == null)
2568              this.factor = new DecimalType();
2569            this.factor.setValue(value);
2570          }
2571          return this;
2572        }
2573
2574        /**
2575         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
2576         */
2577        public DecimalType getPointsElement() { 
2578          if (this.points == null)
2579            if (Configuration.errorOnAutoCreate())
2580              throw new Error("Attempt to auto-create DetailComponent.points");
2581            else if (Configuration.doAutoCreate())
2582              this.points = new DecimalType(); // bb
2583          return this.points;
2584        }
2585
2586        public boolean hasPointsElement() { 
2587          return this.points != null && !this.points.isEmpty();
2588        }
2589
2590        public boolean hasPoints() { 
2591          return this.points != null && !this.points.isEmpty();
2592        }
2593
2594        /**
2595         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
2596         */
2597        public DetailComponent setPointsElement(DecimalType value) { 
2598          this.points = value;
2599          return this;
2600        }
2601
2602        /**
2603         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2604         */
2605        public BigDecimal getPoints() { 
2606          return this.points == null ? null : this.points.getValue();
2607        }
2608
2609        /**
2610         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2611         */
2612        public DetailComponent setPoints(BigDecimal value) { 
2613          if (value == null)
2614            this.points = null;
2615          else {
2616            if (this.points == null)
2617              this.points = new DecimalType();
2618            this.points.setValue(value);
2619          }
2620          return this;
2621        }
2622
2623        /**
2624         * @return {@link #net} (The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
2625         */
2626        public Money getNet() { 
2627          if (this.net == null)
2628            if (Configuration.errorOnAutoCreate())
2629              throw new Error("Attempt to auto-create DetailComponent.net");
2630            else if (Configuration.doAutoCreate())
2631              this.net = new Money(); // cc
2632          return this.net;
2633        }
2634
2635        public boolean hasNet() { 
2636          return this.net != null && !this.net.isEmpty();
2637        }
2638
2639        /**
2640         * @param value {@link #net} (The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
2641         */
2642        public DetailComponent setNet(Money value) { 
2643          this.net = value;
2644          return this;
2645        }
2646
2647        /**
2648         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
2649         */
2650        public Coding getUdi() { 
2651          if (this.udi == null)
2652            if (Configuration.errorOnAutoCreate())
2653              throw new Error("Attempt to auto-create DetailComponent.udi");
2654            else if (Configuration.doAutoCreate())
2655              this.udi = new Coding(); // cc
2656          return this.udi;
2657        }
2658
2659        public boolean hasUdi() { 
2660          return this.udi != null && !this.udi.isEmpty();
2661        }
2662
2663        /**
2664         * @param value {@link #udi} (List of Unique Device Identifiers associated with this line item.)
2665         */
2666        public DetailComponent setUdi(Coding value) { 
2667          this.udi = value;
2668          return this;
2669        }
2670
2671        /**
2672         * @return {@link #subDetail} (Third tier of goods and services.)
2673         */
2674        public List<SubDetailComponent> getSubDetail() { 
2675          if (this.subDetail == null)
2676            this.subDetail = new ArrayList<SubDetailComponent>();
2677          return this.subDetail;
2678        }
2679
2680        public boolean hasSubDetail() { 
2681          if (this.subDetail == null)
2682            return false;
2683          for (SubDetailComponent item : this.subDetail)
2684            if (!item.isEmpty())
2685              return true;
2686          return false;
2687        }
2688
2689        /**
2690         * @return {@link #subDetail} (Third tier of goods and services.)
2691         */
2692    // syntactic sugar
2693        public SubDetailComponent addSubDetail() { //3
2694          SubDetailComponent t = new SubDetailComponent();
2695          if (this.subDetail == null)
2696            this.subDetail = new ArrayList<SubDetailComponent>();
2697          this.subDetail.add(t);
2698          return t;
2699        }
2700
2701    // syntactic sugar
2702        public DetailComponent addSubDetail(SubDetailComponent t) { //3
2703          if (t == null)
2704            return this;
2705          if (this.subDetail == null)
2706            this.subDetail = new ArrayList<SubDetailComponent>();
2707          this.subDetail.add(t);
2708          return this;
2709        }
2710
2711        protected void listChildren(List<Property> childrenList) {
2712          super.listChildren(childrenList);
2713          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
2714          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
2715          childrenList.add(new Property("service", "Coding", "If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
2716          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
2717          childrenList.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
2718          childrenList.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, java.lang.Integer.MAX_VALUE, factor));
2719          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
2720          childrenList.add(new Property("net", "Money", "The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
2721          childrenList.add(new Property("udi", "Coding", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2722          childrenList.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
2723        }
2724
2725      @Override
2726      public void setProperty(String name, Base value) throws FHIRException {
2727        if (name.equals("sequence"))
2728          this.sequence = castToPositiveInt(value); // PositiveIntType
2729        else if (name.equals("type"))
2730          this.type = castToCoding(value); // Coding
2731        else if (name.equals("service"))
2732          this.service = castToCoding(value); // Coding
2733        else if (name.equals("quantity"))
2734          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2735        else if (name.equals("unitPrice"))
2736          this.unitPrice = castToMoney(value); // Money
2737        else if (name.equals("factor"))
2738          this.factor = castToDecimal(value); // DecimalType
2739        else if (name.equals("points"))
2740          this.points = castToDecimal(value); // DecimalType
2741        else if (name.equals("net"))
2742          this.net = castToMoney(value); // Money
2743        else if (name.equals("udi"))
2744          this.udi = castToCoding(value); // Coding
2745        else if (name.equals("subDetail"))
2746          this.getSubDetail().add((SubDetailComponent) value);
2747        else
2748          super.setProperty(name, value);
2749      }
2750
2751      @Override
2752      public Base addChild(String name) throws FHIRException {
2753        if (name.equals("sequence")) {
2754          throw new FHIRException("Cannot call addChild on a primitive type Claim.sequence");
2755        }
2756        else if (name.equals("type")) {
2757          this.type = new Coding();
2758          return this.type;
2759        }
2760        else if (name.equals("service")) {
2761          this.service = new Coding();
2762          return this.service;
2763        }
2764        else if (name.equals("quantity")) {
2765          this.quantity = new SimpleQuantity();
2766          return this.quantity;
2767        }
2768        else if (name.equals("unitPrice")) {
2769          this.unitPrice = new Money();
2770          return this.unitPrice;
2771        }
2772        else if (name.equals("factor")) {
2773          throw new FHIRException("Cannot call addChild on a primitive type Claim.factor");
2774        }
2775        else if (name.equals("points")) {
2776          throw new FHIRException("Cannot call addChild on a primitive type Claim.points");
2777        }
2778        else if (name.equals("net")) {
2779          this.net = new Money();
2780          return this.net;
2781        }
2782        else if (name.equals("udi")) {
2783          this.udi = new Coding();
2784          return this.udi;
2785        }
2786        else if (name.equals("subDetail")) {
2787          return addSubDetail();
2788        }
2789        else
2790          return super.addChild(name);
2791      }
2792
2793      public DetailComponent copy() {
2794        DetailComponent dst = new DetailComponent();
2795        copyValues(dst);
2796        dst.sequence = sequence == null ? null : sequence.copy();
2797        dst.type = type == null ? null : type.copy();
2798        dst.service = service == null ? null : service.copy();
2799        dst.quantity = quantity == null ? null : quantity.copy();
2800        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
2801        dst.factor = factor == null ? null : factor.copy();
2802        dst.points = points == null ? null : points.copy();
2803        dst.net = net == null ? null : net.copy();
2804        dst.udi = udi == null ? null : udi.copy();
2805        if (subDetail != null) {
2806          dst.subDetail = new ArrayList<SubDetailComponent>();
2807          for (SubDetailComponent i : subDetail)
2808            dst.subDetail.add(i.copy());
2809        };
2810        return dst;
2811      }
2812
2813      @Override
2814      public boolean equalsDeep(Base other) {
2815        if (!super.equalsDeep(other))
2816          return false;
2817        if (!(other instanceof DetailComponent))
2818          return false;
2819        DetailComponent o = (DetailComponent) other;
2820        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(service, o.service, true)
2821           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
2822           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
2823           && compareDeep(subDetail, o.subDetail, true);
2824      }
2825
2826      @Override
2827      public boolean equalsShallow(Base other) {
2828        if (!super.equalsShallow(other))
2829          return false;
2830        if (!(other instanceof DetailComponent))
2831          return false;
2832        DetailComponent o = (DetailComponent) other;
2833        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(points, o.points, true)
2834          ;
2835      }
2836
2837      public boolean isEmpty() {
2838        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
2839           && (service == null || service.isEmpty()) && (quantity == null || quantity.isEmpty()) && (unitPrice == null || unitPrice.isEmpty())
2840           && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty()) && (net == null || net.isEmpty())
2841           && (udi == null || udi.isEmpty()) && (subDetail == null || subDetail.isEmpty());
2842      }
2843
2844  public String fhirType() {
2845    return "Claim.item.detail";
2846
2847  }
2848
2849  }
2850
2851    @Block()
2852    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
2853        /**
2854         * A service line number.
2855         */
2856        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2857        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
2858        protected PositiveIntType sequence;
2859
2860        /**
2861         * The type of product or service.
2862         */
2863        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
2864        @Description(shortDefinition="Type of product or service", formalDefinition="The type of product or service." )
2865        protected Coding type;
2866
2867        /**
2868         * The fee for an additional  service or product or charge.
2869         */
2870        @Child(name = "service", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
2871        @Description(shortDefinition="Additional item codes", formalDefinition="The fee for an additional  service or product or charge." )
2872        protected Coding service;
2873
2874        /**
2875         * The number of repetitions of a service or product.
2876         */
2877        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=true)
2878        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
2879        protected SimpleQuantity quantity;
2880
2881        /**
2882         * The fee for an additional  service or product or charge.
2883         */
2884        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=true)
2885        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an additional  service or product or charge." )
2886        protected Money unitPrice;
2887
2888        /**
2889         * 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.
2890         */
2891        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2892        @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." )
2893        protected DecimalType factor;
2894
2895        /**
2896         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2897         */
2898        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2899        @Description(shortDefinition="Difficulty scaling factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point." )
2900        protected DecimalType points;
2901
2902        /**
2903         * The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
2904         */
2905        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=true)
2906        @Description(shortDefinition="Net additional item cost", formalDefinition="The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
2907        protected Money net;
2908
2909        /**
2910         * List of Unique Device Identifiers associated with this line item.
2911         */
2912        @Child(name = "udi", type = {Coding.class}, order=9, min=0, max=1, modifier=false, summary=true)
2913        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
2914        protected Coding udi;
2915
2916        private static final long serialVersionUID = 623567568L;
2917
2918    /*
2919     * Constructor
2920     */
2921      public SubDetailComponent() {
2922        super();
2923      }
2924
2925    /*
2926     * Constructor
2927     */
2928      public SubDetailComponent(PositiveIntType sequence, Coding type, Coding service) {
2929        super();
2930        this.sequence = sequence;
2931        this.type = type;
2932        this.service = service;
2933      }
2934
2935        /**
2936         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2937         */
2938        public PositiveIntType getSequenceElement() { 
2939          if (this.sequence == null)
2940            if (Configuration.errorOnAutoCreate())
2941              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
2942            else if (Configuration.doAutoCreate())
2943              this.sequence = new PositiveIntType(); // bb
2944          return this.sequence;
2945        }
2946
2947        public boolean hasSequenceElement() { 
2948          return this.sequence != null && !this.sequence.isEmpty();
2949        }
2950
2951        public boolean hasSequence() { 
2952          return this.sequence != null && !this.sequence.isEmpty();
2953        }
2954
2955        /**
2956         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2957         */
2958        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
2959          this.sequence = value;
2960          return this;
2961        }
2962
2963        /**
2964         * @return A service line number.
2965         */
2966        public int getSequence() { 
2967          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2968        }
2969
2970        /**
2971         * @param value A service line number.
2972         */
2973        public SubDetailComponent setSequence(int value) { 
2974            if (this.sequence == null)
2975              this.sequence = new PositiveIntType();
2976            this.sequence.setValue(value);
2977          return this;
2978        }
2979
2980        /**
2981         * @return {@link #type} (The type of product or service.)
2982         */
2983        public Coding getType() { 
2984          if (this.type == null)
2985            if (Configuration.errorOnAutoCreate())
2986              throw new Error("Attempt to auto-create SubDetailComponent.type");
2987            else if (Configuration.doAutoCreate())
2988              this.type = new Coding(); // cc
2989          return this.type;
2990        }
2991
2992        public boolean hasType() { 
2993          return this.type != null && !this.type.isEmpty();
2994        }
2995
2996        /**
2997         * @param value {@link #type} (The type of product or service.)
2998         */
2999        public SubDetailComponent setType(Coding value) { 
3000          this.type = value;
3001          return this;
3002        }
3003
3004        /**
3005         * @return {@link #service} (The fee for an additional  service or product or charge.)
3006         */
3007        public Coding getService() { 
3008          if (this.service == null)
3009            if (Configuration.errorOnAutoCreate())
3010              throw new Error("Attempt to auto-create SubDetailComponent.service");
3011            else if (Configuration.doAutoCreate())
3012              this.service = new Coding(); // cc
3013          return this.service;
3014        }
3015
3016        public boolean hasService() { 
3017          return this.service != null && !this.service.isEmpty();
3018        }
3019
3020        /**
3021         * @param value {@link #service} (The fee for an additional  service or product or charge.)
3022         */
3023        public SubDetailComponent setService(Coding value) { 
3024          this.service = value;
3025          return this;
3026        }
3027
3028        /**
3029         * @return {@link #quantity} (The number of repetitions of a service or product.)
3030         */
3031        public SimpleQuantity getQuantity() { 
3032          if (this.quantity == null)
3033            if (Configuration.errorOnAutoCreate())
3034              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
3035            else if (Configuration.doAutoCreate())
3036              this.quantity = new SimpleQuantity(); // cc
3037          return this.quantity;
3038        }
3039
3040        public boolean hasQuantity() { 
3041          return this.quantity != null && !this.quantity.isEmpty();
3042        }
3043
3044        /**
3045         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3046         */
3047        public SubDetailComponent setQuantity(SimpleQuantity value) { 
3048          this.quantity = value;
3049          return this;
3050        }
3051
3052        /**
3053         * @return {@link #unitPrice} (The fee for an additional  service or product or charge.)
3054         */
3055        public Money getUnitPrice() { 
3056          if (this.unitPrice == null)
3057            if (Configuration.errorOnAutoCreate())
3058              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
3059            else if (Configuration.doAutoCreate())
3060              this.unitPrice = new Money(); // cc
3061          return this.unitPrice;
3062        }
3063
3064        public boolean hasUnitPrice() { 
3065          return this.unitPrice != null && !this.unitPrice.isEmpty();
3066        }
3067
3068        /**
3069         * @param value {@link #unitPrice} (The fee for an additional  service or product or charge.)
3070         */
3071        public SubDetailComponent setUnitPrice(Money value) { 
3072          this.unitPrice = value;
3073          return this;
3074        }
3075
3076        /**
3077         * @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
3078         */
3079        public DecimalType getFactorElement() { 
3080          if (this.factor == null)
3081            if (Configuration.errorOnAutoCreate())
3082              throw new Error("Attempt to auto-create SubDetailComponent.factor");
3083            else if (Configuration.doAutoCreate())
3084              this.factor = new DecimalType(); // bb
3085          return this.factor;
3086        }
3087
3088        public boolean hasFactorElement() { 
3089          return this.factor != null && !this.factor.isEmpty();
3090        }
3091
3092        public boolean hasFactor() { 
3093          return this.factor != null && !this.factor.isEmpty();
3094        }
3095
3096        /**
3097         * @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
3098         */
3099        public SubDetailComponent setFactorElement(DecimalType value) { 
3100          this.factor = value;
3101          return this;
3102        }
3103
3104        /**
3105         * @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.
3106         */
3107        public BigDecimal getFactor() { 
3108          return this.factor == null ? null : this.factor.getValue();
3109        }
3110
3111        /**
3112         * @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.
3113         */
3114        public SubDetailComponent setFactor(BigDecimal value) { 
3115          if (value == null)
3116            this.factor = null;
3117          else {
3118            if (this.factor == null)
3119              this.factor = new DecimalType();
3120            this.factor.setValue(value);
3121          }
3122          return this;
3123        }
3124
3125        /**
3126         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3127         */
3128        public DecimalType getPointsElement() { 
3129          if (this.points == null)
3130            if (Configuration.errorOnAutoCreate())
3131              throw new Error("Attempt to auto-create SubDetailComponent.points");
3132            else if (Configuration.doAutoCreate())
3133              this.points = new DecimalType(); // bb
3134          return this.points;
3135        }
3136
3137        public boolean hasPointsElement() { 
3138          return this.points != null && !this.points.isEmpty();
3139        }
3140
3141        public boolean hasPoints() { 
3142          return this.points != null && !this.points.isEmpty();
3143        }
3144
3145        /**
3146         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3147         */
3148        public SubDetailComponent setPointsElement(DecimalType value) { 
3149          this.points = value;
3150          return this;
3151        }
3152
3153        /**
3154         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
3155         */
3156        public BigDecimal getPoints() { 
3157          return this.points == null ? null : this.points.getValue();
3158        }
3159
3160        /**
3161         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
3162         */
3163        public SubDetailComponent setPoints(BigDecimal value) { 
3164          if (value == null)
3165            this.points = null;
3166          else {
3167            if (this.points == null)
3168              this.points = new DecimalType();
3169            this.points.setValue(value);
3170          }
3171          return this;
3172        }
3173
3174        /**
3175         * @return {@link #net} (The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3176         */
3177        public Money getNet() { 
3178          if (this.net == null)
3179            if (Configuration.errorOnAutoCreate())
3180              throw new Error("Attempt to auto-create SubDetailComponent.net");
3181            else if (Configuration.doAutoCreate())
3182              this.net = new Money(); // cc
3183          return this.net;
3184        }
3185
3186        public boolean hasNet() { 
3187          return this.net != null && !this.net.isEmpty();
3188        }
3189
3190        /**
3191         * @param value {@link #net} (The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3192         */
3193        public SubDetailComponent setNet(Money value) { 
3194          this.net = value;
3195          return this;
3196        }
3197
3198        /**
3199         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3200         */
3201        public Coding getUdi() { 
3202          if (this.udi == null)
3203            if (Configuration.errorOnAutoCreate())
3204              throw new Error("Attempt to auto-create SubDetailComponent.udi");
3205            else if (Configuration.doAutoCreate())
3206              this.udi = new Coding(); // cc
3207          return this.udi;
3208        }
3209
3210        public boolean hasUdi() { 
3211          return this.udi != null && !this.udi.isEmpty();
3212        }
3213
3214        /**
3215         * @param value {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3216         */
3217        public SubDetailComponent setUdi(Coding value) { 
3218          this.udi = value;
3219          return this;
3220        }
3221
3222        protected void listChildren(List<Property> childrenList) {
3223          super.listChildren(childrenList);
3224          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
3225          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
3226          childrenList.add(new Property("service", "Coding", "The fee for an additional  service or product or charge.", 0, java.lang.Integer.MAX_VALUE, service));
3227          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
3228          childrenList.add(new Property("unitPrice", "Money", "The fee for an additional  service or product or charge.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
3229          childrenList.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, java.lang.Integer.MAX_VALUE, factor));
3230          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
3231          childrenList.add(new Property("net", "Money", "The quantity times the unit price for an additional  service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
3232          childrenList.add(new Property("udi", "Coding", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
3233        }
3234
3235      @Override
3236      public void setProperty(String name, Base value) throws FHIRException {
3237        if (name.equals("sequence"))
3238          this.sequence = castToPositiveInt(value); // PositiveIntType
3239        else if (name.equals("type"))
3240          this.type = castToCoding(value); // Coding
3241        else if (name.equals("service"))
3242          this.service = castToCoding(value); // Coding
3243        else if (name.equals("quantity"))
3244          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
3245        else if (name.equals("unitPrice"))
3246          this.unitPrice = castToMoney(value); // Money
3247        else if (name.equals("factor"))
3248          this.factor = castToDecimal(value); // DecimalType
3249        else if (name.equals("points"))
3250          this.points = castToDecimal(value); // DecimalType
3251        else if (name.equals("net"))
3252          this.net = castToMoney(value); // Money
3253        else if (name.equals("udi"))
3254          this.udi = castToCoding(value); // Coding
3255        else
3256          super.setProperty(name, value);
3257      }
3258
3259      @Override
3260      public Base addChild(String name) throws FHIRException {
3261        if (name.equals("sequence")) {
3262          throw new FHIRException("Cannot call addChild on a primitive type Claim.sequence");
3263        }
3264        else if (name.equals("type")) {
3265          this.type = new Coding();
3266          return this.type;
3267        }
3268        else if (name.equals("service")) {
3269          this.service = new Coding();
3270          return this.service;
3271        }
3272        else if (name.equals("quantity")) {
3273          this.quantity = new SimpleQuantity();
3274          return this.quantity;
3275        }
3276        else if (name.equals("unitPrice")) {
3277          this.unitPrice = new Money();
3278          return this.unitPrice;
3279        }
3280        else if (name.equals("factor")) {
3281          throw new FHIRException("Cannot call addChild on a primitive type Claim.factor");
3282        }
3283        else if (name.equals("points")) {
3284          throw new FHIRException("Cannot call addChild on a primitive type Claim.points");
3285        }
3286        else if (name.equals("net")) {
3287          this.net = new Money();
3288          return this.net;
3289        }
3290        else if (name.equals("udi")) {
3291          this.udi = new Coding();
3292          return this.udi;
3293        }
3294        else
3295          return super.addChild(name);
3296      }
3297
3298      public SubDetailComponent copy() {
3299        SubDetailComponent dst = new SubDetailComponent();
3300        copyValues(dst);
3301        dst.sequence = sequence == null ? null : sequence.copy();
3302        dst.type = type == null ? null : type.copy();
3303        dst.service = service == null ? null : service.copy();
3304        dst.quantity = quantity == null ? null : quantity.copy();
3305        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
3306        dst.factor = factor == null ? null : factor.copy();
3307        dst.points = points == null ? null : points.copy();
3308        dst.net = net == null ? null : net.copy();
3309        dst.udi = udi == null ? null : udi.copy();
3310        return dst;
3311      }
3312
3313      @Override
3314      public boolean equalsDeep(Base other) {
3315        if (!super.equalsDeep(other))
3316          return false;
3317        if (!(other instanceof SubDetailComponent))
3318          return false;
3319        SubDetailComponent o = (SubDetailComponent) other;
3320        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(service, o.service, true)
3321           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
3322           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
3323          ;
3324      }
3325
3326      @Override
3327      public boolean equalsShallow(Base other) {
3328        if (!super.equalsShallow(other))
3329          return false;
3330        if (!(other instanceof SubDetailComponent))
3331          return false;
3332        SubDetailComponent o = (SubDetailComponent) other;
3333        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(points, o.points, true)
3334          ;
3335      }
3336
3337      public boolean isEmpty() {
3338        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
3339           && (service == null || service.isEmpty()) && (quantity == null || quantity.isEmpty()) && (unitPrice == null || unitPrice.isEmpty())
3340           && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty()) && (net == null || net.isEmpty())
3341           && (udi == null || udi.isEmpty());
3342      }
3343
3344  public String fhirType() {
3345    return "Claim.item.detail.subDetail";
3346
3347  }
3348
3349  }
3350
3351    @Block()
3352    public static class ProsthesisComponent extends BackboneElement implements IBaseBackboneElement {
3353        /**
3354         * Indicates whether this is the initial placement of a fixed prosthesis.
3355         */
3356        @Child(name = "initial", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=true)
3357        @Description(shortDefinition="Is this the initial service", formalDefinition="Indicates whether this is the initial placement of a fixed prosthesis." )
3358        protected BooleanType initial;
3359
3360        /**
3361         * Date of the initial placement.
3362         */
3363        @Child(name = "priorDate", type = {DateType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3364        @Description(shortDefinition="Initial service Date", formalDefinition="Date of the initial placement." )
3365        protected DateType priorDate;
3366
3367        /**
3368         * Material of the prior denture or bridge prosthesis. (Oral).
3369         */
3370        @Child(name = "priorMaterial", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
3371        @Description(shortDefinition="Prosthetic Material", formalDefinition="Material of the prior denture or bridge prosthesis. (Oral)." )
3372        protected Coding priorMaterial;
3373
3374        private static final long serialVersionUID = 1739349641L;
3375
3376    /*
3377     * Constructor
3378     */
3379      public ProsthesisComponent() {
3380        super();
3381      }
3382
3383        /**
3384         * @return {@link #initial} (Indicates whether this is the initial placement of a fixed prosthesis.). This is the underlying object with id, value and extensions. The accessor "getInitial" gives direct access to the value
3385         */
3386        public BooleanType getInitialElement() { 
3387          if (this.initial == null)
3388            if (Configuration.errorOnAutoCreate())
3389              throw new Error("Attempt to auto-create ProsthesisComponent.initial");
3390            else if (Configuration.doAutoCreate())
3391              this.initial = new BooleanType(); // bb
3392          return this.initial;
3393        }
3394
3395        public boolean hasInitialElement() { 
3396          return this.initial != null && !this.initial.isEmpty();
3397        }
3398
3399        public boolean hasInitial() { 
3400          return this.initial != null && !this.initial.isEmpty();
3401        }
3402
3403        /**
3404         * @param value {@link #initial} (Indicates whether this is the initial placement of a fixed prosthesis.). This is the underlying object with id, value and extensions. The accessor "getInitial" gives direct access to the value
3405         */
3406        public ProsthesisComponent setInitialElement(BooleanType value) { 
3407          this.initial = value;
3408          return this;
3409        }
3410
3411        /**
3412         * @return Indicates whether this is the initial placement of a fixed prosthesis.
3413         */
3414        public boolean getInitial() { 
3415          return this.initial == null || this.initial.isEmpty() ? false : this.initial.getValue();
3416        }
3417
3418        /**
3419         * @param value Indicates whether this is the initial placement of a fixed prosthesis.
3420         */
3421        public ProsthesisComponent setInitial(boolean value) { 
3422            if (this.initial == null)
3423              this.initial = new BooleanType();
3424            this.initial.setValue(value);
3425          return this;
3426        }
3427
3428        /**
3429         * @return {@link #priorDate} (Date of the initial placement.). This is the underlying object with id, value and extensions. The accessor "getPriorDate" gives direct access to the value
3430         */
3431        public DateType getPriorDateElement() { 
3432          if (this.priorDate == null)
3433            if (Configuration.errorOnAutoCreate())
3434              throw new Error("Attempt to auto-create ProsthesisComponent.priorDate");
3435            else if (Configuration.doAutoCreate())
3436              this.priorDate = new DateType(); // bb
3437          return this.priorDate;
3438        }
3439
3440        public boolean hasPriorDateElement() { 
3441          return this.priorDate != null && !this.priorDate.isEmpty();
3442        }
3443
3444        public boolean hasPriorDate() { 
3445          return this.priorDate != null && !this.priorDate.isEmpty();
3446        }
3447
3448        /**
3449         * @param value {@link #priorDate} (Date of the initial placement.). This is the underlying object with id, value and extensions. The accessor "getPriorDate" gives direct access to the value
3450         */
3451        public ProsthesisComponent setPriorDateElement(DateType value) { 
3452          this.priorDate = value;
3453          return this;
3454        }
3455
3456        /**
3457         * @return Date of the initial placement.
3458         */
3459        public Date getPriorDate() { 
3460          return this.priorDate == null ? null : this.priorDate.getValue();
3461        }
3462
3463        /**
3464         * @param value Date of the initial placement.
3465         */
3466        public ProsthesisComponent setPriorDate(Date value) { 
3467          if (value == null)
3468            this.priorDate = null;
3469          else {
3470            if (this.priorDate == null)
3471              this.priorDate = new DateType();
3472            this.priorDate.setValue(value);
3473          }
3474          return this;
3475        }
3476
3477        /**
3478         * @return {@link #priorMaterial} (Material of the prior denture or bridge prosthesis. (Oral).)
3479         */
3480        public Coding getPriorMaterial() { 
3481          if (this.priorMaterial == null)
3482            if (Configuration.errorOnAutoCreate())
3483              throw new Error("Attempt to auto-create ProsthesisComponent.priorMaterial");
3484            else if (Configuration.doAutoCreate())
3485              this.priorMaterial = new Coding(); // cc
3486          return this.priorMaterial;
3487        }
3488
3489        public boolean hasPriorMaterial() { 
3490          return this.priorMaterial != null && !this.priorMaterial.isEmpty();
3491        }
3492
3493        /**
3494         * @param value {@link #priorMaterial} (Material of the prior denture or bridge prosthesis. (Oral).)
3495         */
3496        public ProsthesisComponent setPriorMaterial(Coding value) { 
3497          this.priorMaterial = value;
3498          return this;
3499        }
3500
3501        protected void listChildren(List<Property> childrenList) {
3502          super.listChildren(childrenList);
3503          childrenList.add(new Property("initial", "boolean", "Indicates whether this is the initial placement of a fixed prosthesis.", 0, java.lang.Integer.MAX_VALUE, initial));
3504          childrenList.add(new Property("priorDate", "date", "Date of the initial placement.", 0, java.lang.Integer.MAX_VALUE, priorDate));
3505          childrenList.add(new Property("priorMaterial", "Coding", "Material of the prior denture or bridge prosthesis. (Oral).", 0, java.lang.Integer.MAX_VALUE, priorMaterial));
3506        }
3507
3508      @Override
3509      public void setProperty(String name, Base value) throws FHIRException {
3510        if (name.equals("initial"))
3511          this.initial = castToBoolean(value); // BooleanType
3512        else if (name.equals("priorDate"))
3513          this.priorDate = castToDate(value); // DateType
3514        else if (name.equals("priorMaterial"))
3515          this.priorMaterial = castToCoding(value); // Coding
3516        else
3517          super.setProperty(name, value);
3518      }
3519
3520      @Override
3521      public Base addChild(String name) throws FHIRException {
3522        if (name.equals("initial")) {
3523          throw new FHIRException("Cannot call addChild on a primitive type Claim.initial");
3524        }
3525        else if (name.equals("priorDate")) {
3526          throw new FHIRException("Cannot call addChild on a primitive type Claim.priorDate");
3527        }
3528        else if (name.equals("priorMaterial")) {
3529          this.priorMaterial = new Coding();
3530          return this.priorMaterial;
3531        }
3532        else
3533          return super.addChild(name);
3534      }
3535
3536      public ProsthesisComponent copy() {
3537        ProsthesisComponent dst = new ProsthesisComponent();
3538        copyValues(dst);
3539        dst.initial = initial == null ? null : initial.copy();
3540        dst.priorDate = priorDate == null ? null : priorDate.copy();
3541        dst.priorMaterial = priorMaterial == null ? null : priorMaterial.copy();
3542        return dst;
3543      }
3544
3545      @Override
3546      public boolean equalsDeep(Base other) {
3547        if (!super.equalsDeep(other))
3548          return false;
3549        if (!(other instanceof ProsthesisComponent))
3550          return false;
3551        ProsthesisComponent o = (ProsthesisComponent) other;
3552        return compareDeep(initial, o.initial, true) && compareDeep(priorDate, o.priorDate, true) && compareDeep(priorMaterial, o.priorMaterial, true)
3553          ;
3554      }
3555
3556      @Override
3557      public boolean equalsShallow(Base other) {
3558        if (!super.equalsShallow(other))
3559          return false;
3560        if (!(other instanceof ProsthesisComponent))
3561          return false;
3562        ProsthesisComponent o = (ProsthesisComponent) other;
3563        return compareValues(initial, o.initial, true) && compareValues(priorDate, o.priorDate, true);
3564      }
3565
3566      public boolean isEmpty() {
3567        return super.isEmpty() && (initial == null || initial.isEmpty()) && (priorDate == null || priorDate.isEmpty())
3568           && (priorMaterial == null || priorMaterial.isEmpty());
3569      }
3570
3571  public String fhirType() {
3572    return "Claim.item.prosthesis";
3573
3574  }
3575
3576  }
3577
3578    @Block()
3579    public static class MissingTeethComponent extends BackboneElement implements IBaseBackboneElement {
3580        /**
3581         * The code identifying which tooth is missing.
3582         */
3583        @Child(name = "tooth", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
3584        @Description(shortDefinition="Tooth Code", formalDefinition="The code identifying which tooth is missing." )
3585        protected Coding tooth;
3586
3587        /**
3588         * Missing reason may be: E-extraction, O-other.
3589         */
3590        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
3591        @Description(shortDefinition="Reason for missing", formalDefinition="Missing reason may be: E-extraction, O-other." )
3592        protected Coding reason;
3593
3594        /**
3595         * The date of the extraction either known from records or patient reported estimate.
3596         */
3597        @Child(name = "extractionDate", type = {DateType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3598        @Description(shortDefinition="Date of Extraction", formalDefinition="The date of the extraction either known from records or patient reported estimate." )
3599        protected DateType extractionDate;
3600
3601        private static final long serialVersionUID = 352913313L;
3602
3603    /*
3604     * Constructor
3605     */
3606      public MissingTeethComponent() {
3607        super();
3608      }
3609
3610    /*
3611     * Constructor
3612     */
3613      public MissingTeethComponent(Coding tooth) {
3614        super();
3615        this.tooth = tooth;
3616      }
3617
3618        /**
3619         * @return {@link #tooth} (The code identifying which tooth is missing.)
3620         */
3621        public Coding getTooth() { 
3622          if (this.tooth == null)
3623            if (Configuration.errorOnAutoCreate())
3624              throw new Error("Attempt to auto-create MissingTeethComponent.tooth");
3625            else if (Configuration.doAutoCreate())
3626              this.tooth = new Coding(); // cc
3627          return this.tooth;
3628        }
3629
3630        public boolean hasTooth() { 
3631          return this.tooth != null && !this.tooth.isEmpty();
3632        }
3633
3634        /**
3635         * @param value {@link #tooth} (The code identifying which tooth is missing.)
3636         */
3637        public MissingTeethComponent setTooth(Coding value) { 
3638          this.tooth = value;
3639          return this;
3640        }
3641
3642        /**
3643         * @return {@link #reason} (Missing reason may be: E-extraction, O-other.)
3644         */
3645        public Coding getReason() { 
3646          if (this.reason == null)
3647            if (Configuration.errorOnAutoCreate())
3648              throw new Error("Attempt to auto-create MissingTeethComponent.reason");
3649            else if (Configuration.doAutoCreate())
3650              this.reason = new Coding(); // cc
3651          return this.reason;
3652        }
3653
3654        public boolean hasReason() { 
3655          return this.reason != null && !this.reason.isEmpty();
3656        }
3657
3658        /**
3659         * @param value {@link #reason} (Missing reason may be: E-extraction, O-other.)
3660         */
3661        public MissingTeethComponent setReason(Coding value) { 
3662          this.reason = value;
3663          return this;
3664        }
3665
3666        /**
3667         * @return {@link #extractionDate} (The date of the extraction either known from records or patient reported estimate.). This is the underlying object with id, value and extensions. The accessor "getExtractionDate" gives direct access to the value
3668         */
3669        public DateType getExtractionDateElement() { 
3670          if (this.extractionDate == null)
3671            if (Configuration.errorOnAutoCreate())
3672              throw new Error("Attempt to auto-create MissingTeethComponent.extractionDate");
3673            else if (Configuration.doAutoCreate())
3674              this.extractionDate = new DateType(); // bb
3675          return this.extractionDate;
3676        }
3677
3678        public boolean hasExtractionDateElement() { 
3679          return this.extractionDate != null && !this.extractionDate.isEmpty();
3680        }
3681
3682        public boolean hasExtractionDate() { 
3683          return this.extractionDate != null && !this.extractionDate.isEmpty();
3684        }
3685
3686        /**
3687         * @param value {@link #extractionDate} (The date of the extraction either known from records or patient reported estimate.). This is the underlying object with id, value and extensions. The accessor "getExtractionDate" gives direct access to the value
3688         */
3689        public MissingTeethComponent setExtractionDateElement(DateType value) { 
3690          this.extractionDate = value;
3691          return this;
3692        }
3693
3694        /**
3695         * @return The date of the extraction either known from records or patient reported estimate.
3696         */
3697        public Date getExtractionDate() { 
3698          return this.extractionDate == null ? null : this.extractionDate.getValue();
3699        }
3700
3701        /**
3702         * @param value The date of the extraction either known from records or patient reported estimate.
3703         */
3704        public MissingTeethComponent setExtractionDate(Date value) { 
3705          if (value == null)
3706            this.extractionDate = null;
3707          else {
3708            if (this.extractionDate == null)
3709              this.extractionDate = new DateType();
3710            this.extractionDate.setValue(value);
3711          }
3712          return this;
3713        }
3714
3715        protected void listChildren(List<Property> childrenList) {
3716          super.listChildren(childrenList);
3717          childrenList.add(new Property("tooth", "Coding", "The code identifying which tooth is missing.", 0, java.lang.Integer.MAX_VALUE, tooth));
3718          childrenList.add(new Property("reason", "Coding", "Missing reason may be: E-extraction, O-other.", 0, java.lang.Integer.MAX_VALUE, reason));
3719          childrenList.add(new Property("extractionDate", "date", "The date of the extraction either known from records or patient reported estimate.", 0, java.lang.Integer.MAX_VALUE, extractionDate));
3720        }
3721
3722      @Override
3723      public void setProperty(String name, Base value) throws FHIRException {
3724        if (name.equals("tooth"))
3725          this.tooth = castToCoding(value); // Coding
3726        else if (name.equals("reason"))
3727          this.reason = castToCoding(value); // Coding
3728        else if (name.equals("extractionDate"))
3729          this.extractionDate = castToDate(value); // DateType
3730        else
3731          super.setProperty(name, value);
3732      }
3733
3734      @Override
3735      public Base addChild(String name) throws FHIRException {
3736        if (name.equals("tooth")) {
3737          this.tooth = new Coding();
3738          return this.tooth;
3739        }
3740        else if (name.equals("reason")) {
3741          this.reason = new Coding();
3742          return this.reason;
3743        }
3744        else if (name.equals("extractionDate")) {
3745          throw new FHIRException("Cannot call addChild on a primitive type Claim.extractionDate");
3746        }
3747        else
3748          return super.addChild(name);
3749      }
3750
3751      public MissingTeethComponent copy() {
3752        MissingTeethComponent dst = new MissingTeethComponent();
3753        copyValues(dst);
3754        dst.tooth = tooth == null ? null : tooth.copy();
3755        dst.reason = reason == null ? null : reason.copy();
3756        dst.extractionDate = extractionDate == null ? null : extractionDate.copy();
3757        return dst;
3758      }
3759
3760      @Override
3761      public boolean equalsDeep(Base other) {
3762        if (!super.equalsDeep(other))
3763          return false;
3764        if (!(other instanceof MissingTeethComponent))
3765          return false;
3766        MissingTeethComponent o = (MissingTeethComponent) other;
3767        return compareDeep(tooth, o.tooth, true) && compareDeep(reason, o.reason, true) && compareDeep(extractionDate, o.extractionDate, true)
3768          ;
3769      }
3770
3771      @Override
3772      public boolean equalsShallow(Base other) {
3773        if (!super.equalsShallow(other))
3774          return false;
3775        if (!(other instanceof MissingTeethComponent))
3776          return false;
3777        MissingTeethComponent o = (MissingTeethComponent) other;
3778        return compareValues(extractionDate, o.extractionDate, true);
3779      }
3780
3781      public boolean isEmpty() {
3782        return super.isEmpty() && (tooth == null || tooth.isEmpty()) && (reason == null || reason.isEmpty())
3783           && (extractionDate == null || extractionDate.isEmpty());
3784      }
3785
3786  public String fhirType() {
3787    return "Claim.missingTeeth";
3788
3789  }
3790
3791  }
3792
3793    /**
3794     * The category of claim this is.
3795     */
3796    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
3797    @Description(shortDefinition="institutional | oral | pharmacy | professional | vision", formalDefinition="The category of claim this is." )
3798    protected Enumeration<ClaimType> type;
3799
3800    /**
3801     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
3802     */
3803    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3804    @Description(shortDefinition="Claim number", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
3805    protected List<Identifier> identifier;
3806
3807    /**
3808     * The version of the specification on which this instance relies.
3809     */
3810    @Child(name = "ruleset", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
3811    @Description(shortDefinition="Current specification followed", formalDefinition="The version of the specification on which this instance relies." )
3812    protected Coding ruleset;
3813
3814    /**
3815     * The version of the specification from which the original instance was created.
3816     */
3817    @Child(name = "originalRuleset", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
3818    @Description(shortDefinition="Original specification followed", formalDefinition="The version of the specification from which the original instance was created." )
3819    protected Coding originalRuleset;
3820
3821    /**
3822     * The date when the enclosed suite of services were performed or completed.
3823     */
3824    @Child(name = "created", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3825    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
3826    protected DateTimeType created;
3827
3828    /**
3829     * Insurer Identifier, typical BIN number (6 digit).
3830     */
3831    @Child(name = "target", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
3832    @Description(shortDefinition="Insurer", formalDefinition="Insurer Identifier, typical BIN number (6 digit)." )
3833    protected Reference target;
3834
3835    /**
3836     * The actual object that is the target of the reference (Insurer Identifier, typical BIN number (6 digit).)
3837     */
3838    protected Organization targetTarget;
3839
3840    /**
3841     * The provider which is responsible for the bill, claim pre-determination, pre-authorization.
3842     */
3843    @Child(name = "provider", type = {Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true)
3844    @Description(shortDefinition="Responsible provider", formalDefinition="The provider which is responsible for the bill, claim pre-determination, pre-authorization." )
3845    protected Reference provider;
3846
3847    /**
3848     * The actual object that is the target of the reference (The provider which is responsible for the bill, claim pre-determination, pre-authorization.)
3849     */
3850    protected Practitioner providerTarget;
3851
3852    /**
3853     * The organization which is responsible for the bill, claim pre-determination, pre-authorization.
3854     */
3855    @Child(name = "organization", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
3856    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the bill, claim pre-determination, pre-authorization." )
3857    protected Reference organization;
3858
3859    /**
3860     * The actual object that is the target of the reference (The organization which is responsible for the bill, claim pre-determination, pre-authorization.)
3861     */
3862    protected Organization organizationTarget;
3863
3864    /**
3865     * Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).
3866     */
3867    @Child(name = "use", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3868    @Description(shortDefinition="complete | proposed | exploratory | other", formalDefinition="Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination)." )
3869    protected Enumeration<Use> use;
3870
3871    /**
3872     * Immediate (stat), best effort (normal), deferred (deferred).
3873     */
3874    @Child(name = "priority", type = {Coding.class}, order=9, min=0, max=1, modifier=false, summary=true)
3875    @Description(shortDefinition="Desired processing priority", formalDefinition="Immediate (stat), best effort (normal), deferred (deferred)." )
3876    protected Coding priority;
3877
3878    /**
3879     * In the case of a Pre-Determination/Pre-Authorization the provider may request that funds in the amount of the expected Benefit be reserved ('Patient' or 'Provider') to pay for the Benefits determined on the subsequent claim(s). 'None' explicitly indicates no funds reserving is requested.
3880     */
3881    @Child(name = "fundsReserve", type = {Coding.class}, order=10, min=0, max=1, modifier=false, summary=true)
3882    @Description(shortDefinition="Funds requested to be reserved", formalDefinition="In the case of a Pre-Determination/Pre-Authorization the provider may request that funds in the amount of the expected Benefit be reserved ('Patient' or 'Provider') to pay for the Benefits determined on the subsequent claim(s). 'None' explicitly indicates no funds reserving is requested." )
3883    protected Coding fundsReserve;
3884
3885    /**
3886     * Person who created the invoice/claim/pre-determination or pre-authorization.
3887     */
3888    @Child(name = "enterer", type = {Practitioner.class}, order=11, min=0, max=1, modifier=false, summary=true)
3889    @Description(shortDefinition="Author", formalDefinition="Person who created the invoice/claim/pre-determination or pre-authorization." )
3890    protected Reference enterer;
3891
3892    /**
3893     * The actual object that is the target of the reference (Person who created the invoice/claim/pre-determination or pre-authorization.)
3894     */
3895    protected Practitioner entererTarget;
3896
3897    /**
3898     * Facility where the services were provided.
3899     */
3900    @Child(name = "facility", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=true)
3901    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
3902    protected Reference facility;
3903
3904    /**
3905     * The actual object that is the target of the reference (Facility where the services were provided.)
3906     */
3907    protected Location facilityTarget;
3908
3909    /**
3910     * Prescription to support the dispensing of Pharmacy or Vision products.
3911     */
3912    @Child(name = "prescription", type = {MedicationOrder.class, VisionPrescription.class}, order=13, min=0, max=1, modifier=false, summary=true)
3913    @Description(shortDefinition="Prescription", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
3914    protected Reference prescription;
3915
3916    /**
3917     * The actual object that is the target of the reference (Prescription to support the dispensing of Pharmacy or Vision products.)
3918     */
3919    protected Resource prescriptionTarget;
3920
3921    /**
3922     * Original prescription to support the dispensing of pharmacy services, medications or products.
3923     */
3924    @Child(name = "originalPrescription", type = {MedicationOrder.class}, order=14, min=0, max=1, modifier=false, summary=true)
3925    @Description(shortDefinition="Original Prescription", formalDefinition="Original prescription to support the dispensing of pharmacy services, medications or products." )
3926    protected Reference originalPrescription;
3927
3928    /**
3929     * The actual object that is the target of the reference (Original prescription to support the dispensing of pharmacy services, medications or products.)
3930     */
3931    protected MedicationOrder originalPrescriptionTarget;
3932
3933    /**
3934     * The party to be reimbursed for the services.
3935     */
3936    @Child(name = "payee", type = {}, order=15, min=0, max=1, modifier=false, summary=true)
3937    @Description(shortDefinition="Payee", formalDefinition="The party to be reimbursed for the services." )
3938    protected PayeeComponent payee;
3939
3940    /**
3941     * The referral resource which lists the date, practitioner, reason and other supporting information.
3942     */
3943    @Child(name = "referral", type = {ReferralRequest.class}, order=16, min=0, max=1, modifier=false, summary=true)
3944    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
3945    protected Reference referral;
3946
3947    /**
3948     * The actual object that is the target of the reference (The referral resource which lists the date, practitioner, reason and other supporting information.)
3949     */
3950    protected ReferralRequest referralTarget;
3951
3952    /**
3953     * Ordered list of patient diagnosis for which care is sought.
3954     */
3955    @Child(name = "diagnosis", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3956    @Description(shortDefinition="Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
3957    protected List<DiagnosisComponent> diagnosis;
3958
3959    /**
3960     * List of patient conditions for which care is sought.
3961     */
3962    @Child(name = "condition", type = {Coding.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3963    @Description(shortDefinition="List of presenting Conditions", formalDefinition="List of patient conditions for which care is sought." )
3964    protected List<Coding> condition;
3965
3966    /**
3967     * Patient Resource.
3968     */
3969    @Child(name = "patient", type = {Patient.class}, order=19, min=1, max=1, modifier=false, summary=true)
3970    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
3971    protected Reference patient;
3972
3973    /**
3974     * The actual object that is the target of the reference (Patient Resource.)
3975     */
3976    protected Patient patientTarget;
3977
3978    /**
3979     * Financial instrument by which payment information for health care.
3980     */
3981    @Child(name = "coverage", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3982    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
3983    protected List<CoverageComponent> coverage;
3984
3985    /**
3986     * Factors which may influence the applicability of coverage.
3987     */
3988    @Child(name = "exception", type = {Coding.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3989    @Description(shortDefinition="Eligibility exceptions", formalDefinition="Factors which may influence the applicability of coverage." )
3990    protected List<Coding> exception;
3991
3992    /**
3993     * Name of school for over-aged dependents.
3994     */
3995    @Child(name = "school", type = {StringType.class}, order=22, min=0, max=1, modifier=false, summary=true)
3996    @Description(shortDefinition="Name of School", formalDefinition="Name of school for over-aged dependents." )
3997    protected StringType school;
3998
3999    /**
4000     * Date of an accident which these services are addressing.
4001     */
4002    @Child(name = "accident", type = {DateType.class}, order=23, min=0, max=1, modifier=false, summary=true)
4003    @Description(shortDefinition="Accident Date", formalDefinition="Date of an accident which these services are addressing." )
4004    protected DateType accident;
4005
4006    /**
4007     * Type of accident: work, auto, etc.
4008     */
4009    @Child(name = "accidentType", type = {Coding.class}, order=24, min=0, max=1, modifier=false, summary=true)
4010    @Description(shortDefinition="Accident Type", formalDefinition="Type of accident: work, auto, etc." )
4011    protected Coding accidentType;
4012
4013    /**
4014     * A list of intervention and exception codes which may influence the adjudication of the claim.
4015     */
4016    @Child(name = "interventionException", type = {Coding.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4017    @Description(shortDefinition="Intervention and exception code (Pharma)", formalDefinition="A list of intervention and exception codes which may influence the adjudication of the claim." )
4018    protected List<Coding> interventionException;
4019
4020    /**
4021     * First tier of goods and services.
4022     */
4023    @Child(name = "item", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4024    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
4025    protected List<ItemsComponent> item;
4026
4027    /**
4028     * Code to indicate that Xrays, images, emails, documents, models or attachments are being sent in support of this submission.
4029     */
4030    @Child(name = "additionalMaterials", type = {Coding.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4031    @Description(shortDefinition="Additional materials, documents, etc.", formalDefinition="Code to indicate that Xrays, images, emails, documents, models or attachments are being sent in support of this submission." )
4032    protected List<Coding> additionalMaterials;
4033
4034    /**
4035     * A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.
4036     */
4037    @Child(name = "missingTeeth", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4038    @Description(shortDefinition="Only if type = oral", formalDefinition="A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons." )
4039    protected List<MissingTeethComponent> missingTeeth;
4040
4041    private static final long serialVersionUID = 4272227L;
4042
4043  /*
4044   * Constructor
4045   */
4046    public Claim() {
4047      super();
4048    }
4049
4050  /*
4051   * Constructor
4052   */
4053    public Claim(Enumeration<ClaimType> type, Reference patient) {
4054      super();
4055      this.type = type;
4056      this.patient = patient;
4057    }
4058
4059    /**
4060     * @return {@link #type} (The category of claim this is.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
4061     */
4062    public Enumeration<ClaimType> getTypeElement() { 
4063      if (this.type == null)
4064        if (Configuration.errorOnAutoCreate())
4065          throw new Error("Attempt to auto-create Claim.type");
4066        else if (Configuration.doAutoCreate())
4067          this.type = new Enumeration<ClaimType>(new ClaimTypeEnumFactory()); // bb
4068      return this.type;
4069    }
4070
4071    public boolean hasTypeElement() { 
4072      return this.type != null && !this.type.isEmpty();
4073    }
4074
4075    public boolean hasType() { 
4076      return this.type != null && !this.type.isEmpty();
4077    }
4078
4079    /**
4080     * @param value {@link #type} (The category of claim this is.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
4081     */
4082    public Claim setTypeElement(Enumeration<ClaimType> value) { 
4083      this.type = value;
4084      return this;
4085    }
4086
4087    /**
4088     * @return The category of claim this is.
4089     */
4090    public ClaimType getType() { 
4091      return this.type == null ? null : this.type.getValue();
4092    }
4093
4094    /**
4095     * @param value The category of claim this is.
4096     */
4097    public Claim setType(ClaimType value) { 
4098        if (this.type == null)
4099          this.type = new Enumeration<ClaimType>(new ClaimTypeEnumFactory());
4100        this.type.setValue(value);
4101      return this;
4102    }
4103
4104    /**
4105     * @return {@link #identifier} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
4106     */
4107    public List<Identifier> getIdentifier() { 
4108      if (this.identifier == null)
4109        this.identifier = new ArrayList<Identifier>();
4110      return this.identifier;
4111    }
4112
4113    public boolean hasIdentifier() { 
4114      if (this.identifier == null)
4115        return false;
4116      for (Identifier item : this.identifier)
4117        if (!item.isEmpty())
4118          return true;
4119      return false;
4120    }
4121
4122    /**
4123     * @return {@link #identifier} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
4124     */
4125    // syntactic sugar
4126    public Identifier addIdentifier() { //3
4127      Identifier t = new Identifier();
4128      if (this.identifier == null)
4129        this.identifier = new ArrayList<Identifier>();
4130      this.identifier.add(t);
4131      return t;
4132    }
4133
4134    // syntactic sugar
4135    public Claim addIdentifier(Identifier t) { //3
4136      if (t == null)
4137        return this;
4138      if (this.identifier == null)
4139        this.identifier = new ArrayList<Identifier>();
4140      this.identifier.add(t);
4141      return this;
4142    }
4143
4144    /**
4145     * @return {@link #ruleset} (The version of the specification on which this instance relies.)
4146     */
4147    public Coding getRuleset() { 
4148      if (this.ruleset == null)
4149        if (Configuration.errorOnAutoCreate())
4150          throw new Error("Attempt to auto-create Claim.ruleset");
4151        else if (Configuration.doAutoCreate())
4152          this.ruleset = new Coding(); // cc
4153      return this.ruleset;
4154    }
4155
4156    public boolean hasRuleset() { 
4157      return this.ruleset != null && !this.ruleset.isEmpty();
4158    }
4159
4160    /**
4161     * @param value {@link #ruleset} (The version of the specification on which this instance relies.)
4162     */
4163    public Claim setRuleset(Coding value) { 
4164      this.ruleset = value;
4165      return this;
4166    }
4167
4168    /**
4169     * @return {@link #originalRuleset} (The version of the specification from which the original instance was created.)
4170     */
4171    public Coding getOriginalRuleset() { 
4172      if (this.originalRuleset == null)
4173        if (Configuration.errorOnAutoCreate())
4174          throw new Error("Attempt to auto-create Claim.originalRuleset");
4175        else if (Configuration.doAutoCreate())
4176          this.originalRuleset = new Coding(); // cc
4177      return this.originalRuleset;
4178    }
4179
4180    public boolean hasOriginalRuleset() { 
4181      return this.originalRuleset != null && !this.originalRuleset.isEmpty();
4182    }
4183
4184    /**
4185     * @param value {@link #originalRuleset} (The version of the specification from which the original instance was created.)
4186     */
4187    public Claim setOriginalRuleset(Coding value) { 
4188      this.originalRuleset = value;
4189      return this;
4190    }
4191
4192    /**
4193     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
4194     */
4195    public DateTimeType getCreatedElement() { 
4196      if (this.created == null)
4197        if (Configuration.errorOnAutoCreate())
4198          throw new Error("Attempt to auto-create Claim.created");
4199        else if (Configuration.doAutoCreate())
4200          this.created = new DateTimeType(); // bb
4201      return this.created;
4202    }
4203
4204    public boolean hasCreatedElement() { 
4205      return this.created != null && !this.created.isEmpty();
4206    }
4207
4208    public boolean hasCreated() { 
4209      return this.created != null && !this.created.isEmpty();
4210    }
4211
4212    /**
4213     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
4214     */
4215    public Claim setCreatedElement(DateTimeType value) { 
4216      this.created = value;
4217      return this;
4218    }
4219
4220    /**
4221     * @return The date when the enclosed suite of services were performed or completed.
4222     */
4223    public Date getCreated() { 
4224      return this.created == null ? null : this.created.getValue();
4225    }
4226
4227    /**
4228     * @param value The date when the enclosed suite of services were performed or completed.
4229     */
4230    public Claim setCreated(Date value) { 
4231      if (value == null)
4232        this.created = null;
4233      else {
4234        if (this.created == null)
4235          this.created = new DateTimeType();
4236        this.created.setValue(value);
4237      }
4238      return this;
4239    }
4240
4241    /**
4242     * @return {@link #target} (Insurer Identifier, typical BIN number (6 digit).)
4243     */
4244    public Reference getTarget() { 
4245      if (this.target == null)
4246        if (Configuration.errorOnAutoCreate())
4247          throw new Error("Attempt to auto-create Claim.target");
4248        else if (Configuration.doAutoCreate())
4249          this.target = new Reference(); // cc
4250      return this.target;
4251    }
4252
4253    public boolean hasTarget() { 
4254      return this.target != null && !this.target.isEmpty();
4255    }
4256
4257    /**
4258     * @param value {@link #target} (Insurer Identifier, typical BIN number (6 digit).)
4259     */
4260    public Claim setTarget(Reference value) { 
4261      this.target = value;
4262      return this;
4263    }
4264
4265    /**
4266     * @return {@link #target} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Insurer Identifier, typical BIN number (6 digit).)
4267     */
4268    public Organization getTargetTarget() { 
4269      if (this.targetTarget == null)
4270        if (Configuration.errorOnAutoCreate())
4271          throw new Error("Attempt to auto-create Claim.target");
4272        else if (Configuration.doAutoCreate())
4273          this.targetTarget = new Organization(); // aa
4274      return this.targetTarget;
4275    }
4276
4277    /**
4278     * @param value {@link #target} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Insurer Identifier, typical BIN number (6 digit).)
4279     */
4280    public Claim setTargetTarget(Organization value) { 
4281      this.targetTarget = value;
4282      return this;
4283    }
4284
4285    /**
4286     * @return {@link #provider} (The provider which is responsible for the bill, claim pre-determination, pre-authorization.)
4287     */
4288    public Reference getProvider() { 
4289      if (this.provider == null)
4290        if (Configuration.errorOnAutoCreate())
4291          throw new Error("Attempt to auto-create Claim.provider");
4292        else if (Configuration.doAutoCreate())
4293          this.provider = new Reference(); // cc
4294      return this.provider;
4295    }
4296
4297    public boolean hasProvider() { 
4298      return this.provider != null && !this.provider.isEmpty();
4299    }
4300
4301    /**
4302     * @param value {@link #provider} (The provider which is responsible for the bill, claim pre-determination, pre-authorization.)
4303     */
4304    public Claim setProvider(Reference value) { 
4305      this.provider = value;
4306      return this;
4307    }
4308
4309    /**
4310     * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The provider which is responsible for the bill, claim pre-determination, pre-authorization.)
4311     */
4312    public Practitioner getProviderTarget() { 
4313      if (this.providerTarget == null)
4314        if (Configuration.errorOnAutoCreate())
4315          throw new Error("Attempt to auto-create Claim.provider");
4316        else if (Configuration.doAutoCreate())
4317          this.providerTarget = new Practitioner(); // aa
4318      return this.providerTarget;
4319    }
4320
4321    /**
4322     * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The provider which is responsible for the bill, claim pre-determination, pre-authorization.)
4323     */
4324    public Claim setProviderTarget(Practitioner value) { 
4325      this.providerTarget = value;
4326      return this;
4327    }
4328
4329    /**
4330     * @return {@link #organization} (The organization which is responsible for the bill, claim pre-determination, pre-authorization.)
4331     */
4332    public Reference getOrganization() { 
4333      if (this.organization == null)
4334        if (Configuration.errorOnAutoCreate())
4335          throw new Error("Attempt to auto-create Claim.organization");
4336        else if (Configuration.doAutoCreate())
4337          this.organization = new Reference(); // cc
4338      return this.organization;
4339    }
4340
4341    public boolean hasOrganization() { 
4342      return this.organization != null && !this.organization.isEmpty();
4343    }
4344
4345    /**
4346     * @param value {@link #organization} (The organization which is responsible for the bill, claim pre-determination, pre-authorization.)
4347     */
4348    public Claim setOrganization(Reference value) { 
4349      this.organization = value;
4350      return this;
4351    }
4352
4353    /**
4354     * @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the bill, claim pre-determination, pre-authorization.)
4355     */
4356    public Organization getOrganizationTarget() { 
4357      if (this.organizationTarget == null)
4358        if (Configuration.errorOnAutoCreate())
4359          throw new Error("Attempt to auto-create Claim.organization");
4360        else if (Configuration.doAutoCreate())
4361          this.organizationTarget = new Organization(); // aa
4362      return this.organizationTarget;
4363    }
4364
4365    /**
4366     * @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the bill, claim pre-determination, pre-authorization.)
4367     */
4368    public Claim setOrganizationTarget(Organization value) { 
4369      this.organizationTarget = value;
4370      return this;
4371    }
4372
4373    /**
4374     * @return {@link #use} (Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
4375     */
4376    public Enumeration<Use> getUseElement() { 
4377      if (this.use == null)
4378        if (Configuration.errorOnAutoCreate())
4379          throw new Error("Attempt to auto-create Claim.use");
4380        else if (Configuration.doAutoCreate())
4381          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
4382      return this.use;
4383    }
4384
4385    public boolean hasUseElement() { 
4386      return this.use != null && !this.use.isEmpty();
4387    }
4388
4389    public boolean hasUse() { 
4390      return this.use != null && !this.use.isEmpty();
4391    }
4392
4393    /**
4394     * @param value {@link #use} (Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
4395     */
4396    public Claim setUseElement(Enumeration<Use> value) { 
4397      this.use = value;
4398      return this;
4399    }
4400
4401    /**
4402     * @return Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).
4403     */
4404    public Use getUse() { 
4405      return this.use == null ? null : this.use.getValue();
4406    }
4407
4408    /**
4409     * @param value Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).
4410     */
4411    public Claim setUse(Use value) { 
4412      if (value == null)
4413        this.use = null;
4414      else {
4415        if (this.use == null)
4416          this.use = new Enumeration<Use>(new UseEnumFactory());
4417        this.use.setValue(value);
4418      }
4419      return this;
4420    }
4421
4422    /**
4423     * @return {@link #priority} (Immediate (stat), best effort (normal), deferred (deferred).)
4424     */
4425    public Coding getPriority() { 
4426      if (this.priority == null)
4427        if (Configuration.errorOnAutoCreate())
4428          throw new Error("Attempt to auto-create Claim.priority");
4429        else if (Configuration.doAutoCreate())
4430          this.priority = new Coding(); // cc
4431      return this.priority;
4432    }
4433
4434    public boolean hasPriority() { 
4435      return this.priority != null && !this.priority.isEmpty();
4436    }
4437
4438    /**
4439     * @param value {@link #priority} (Immediate (stat), best effort (normal), deferred (deferred).)
4440     */
4441    public Claim setPriority(Coding value) { 
4442      this.priority = value;
4443      return this;
4444    }
4445
4446    /**
4447     * @return {@link #fundsReserve} (In the case of a Pre-Determination/Pre-Authorization the provider may request that funds in the amount of the expected Benefit be reserved ('Patient' or 'Provider') to pay for the Benefits determined on the subsequent claim(s). 'None' explicitly indicates no funds reserving is requested.)
4448     */
4449    public Coding getFundsReserve() { 
4450      if (this.fundsReserve == null)
4451        if (Configuration.errorOnAutoCreate())
4452          throw new Error("Attempt to auto-create Claim.fundsReserve");
4453        else if (Configuration.doAutoCreate())
4454          this.fundsReserve = new Coding(); // cc
4455      return this.fundsReserve;
4456    }
4457
4458    public boolean hasFundsReserve() { 
4459      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
4460    }
4461
4462    /**
4463     * @param value {@link #fundsReserve} (In the case of a Pre-Determination/Pre-Authorization the provider may request that funds in the amount of the expected Benefit be reserved ('Patient' or 'Provider') to pay for the Benefits determined on the subsequent claim(s). 'None' explicitly indicates no funds reserving is requested.)
4464     */
4465    public Claim setFundsReserve(Coding value) { 
4466      this.fundsReserve = value;
4467      return this;
4468    }
4469
4470    /**
4471     * @return {@link #enterer} (Person who created the invoice/claim/pre-determination or pre-authorization.)
4472     */
4473    public Reference getEnterer() { 
4474      if (this.enterer == null)
4475        if (Configuration.errorOnAutoCreate())
4476          throw new Error("Attempt to auto-create Claim.enterer");
4477        else if (Configuration.doAutoCreate())
4478          this.enterer = new Reference(); // cc
4479      return this.enterer;
4480    }
4481
4482    public boolean hasEnterer() { 
4483      return this.enterer != null && !this.enterer.isEmpty();
4484    }
4485
4486    /**
4487     * @param value {@link #enterer} (Person who created the invoice/claim/pre-determination or pre-authorization.)
4488     */
4489    public Claim setEnterer(Reference value) { 
4490      this.enterer = value;
4491      return this;
4492    }
4493
4494    /**
4495     * @return {@link #enterer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Person who created the invoice/claim/pre-determination or pre-authorization.)
4496     */
4497    public Practitioner getEntererTarget() { 
4498      if (this.entererTarget == null)
4499        if (Configuration.errorOnAutoCreate())
4500          throw new Error("Attempt to auto-create Claim.enterer");
4501        else if (Configuration.doAutoCreate())
4502          this.entererTarget = new Practitioner(); // aa
4503      return this.entererTarget;
4504    }
4505
4506    /**
4507     * @param value {@link #enterer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Person who created the invoice/claim/pre-determination or pre-authorization.)
4508     */
4509    public Claim setEntererTarget(Practitioner value) { 
4510      this.entererTarget = value;
4511      return this;
4512    }
4513
4514    /**
4515     * @return {@link #facility} (Facility where the services were provided.)
4516     */
4517    public Reference getFacility() { 
4518      if (this.facility == null)
4519        if (Configuration.errorOnAutoCreate())
4520          throw new Error("Attempt to auto-create Claim.facility");
4521        else if (Configuration.doAutoCreate())
4522          this.facility = new Reference(); // cc
4523      return this.facility;
4524    }
4525
4526    public boolean hasFacility() { 
4527      return this.facility != null && !this.facility.isEmpty();
4528    }
4529
4530    /**
4531     * @param value {@link #facility} (Facility where the services were provided.)
4532     */
4533    public Claim setFacility(Reference value) { 
4534      this.facility = value;
4535      return this;
4536    }
4537
4538    /**
4539     * @return {@link #facility} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Facility where the services were provided.)
4540     */
4541    public Location getFacilityTarget() { 
4542      if (this.facilityTarget == null)
4543        if (Configuration.errorOnAutoCreate())
4544          throw new Error("Attempt to auto-create Claim.facility");
4545        else if (Configuration.doAutoCreate())
4546          this.facilityTarget = new Location(); // aa
4547      return this.facilityTarget;
4548    }
4549
4550    /**
4551     * @param value {@link #facility} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Facility where the services were provided.)
4552     */
4553    public Claim setFacilityTarget(Location value) { 
4554      this.facilityTarget = value;
4555      return this;
4556    }
4557
4558    /**
4559     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
4560     */
4561    public Reference getPrescription() { 
4562      if (this.prescription == null)
4563        if (Configuration.errorOnAutoCreate())
4564          throw new Error("Attempt to auto-create Claim.prescription");
4565        else if (Configuration.doAutoCreate())
4566          this.prescription = new Reference(); // cc
4567      return this.prescription;
4568    }
4569
4570    public boolean hasPrescription() { 
4571      return this.prescription != null && !this.prescription.isEmpty();
4572    }
4573
4574    /**
4575     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
4576     */
4577    public Claim setPrescription(Reference value) { 
4578      this.prescription = value;
4579      return this;
4580    }
4581
4582    /**
4583     * @return {@link #prescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Prescription to support the dispensing of Pharmacy or Vision products.)
4584     */
4585    public Resource getPrescriptionTarget() { 
4586      return this.prescriptionTarget;
4587    }
4588
4589    /**
4590     * @param value {@link #prescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Prescription to support the dispensing of Pharmacy or Vision products.)
4591     */
4592    public Claim setPrescriptionTarget(Resource value) { 
4593      this.prescriptionTarget = value;
4594      return this;
4595    }
4596
4597    /**
4598     * @return {@link #originalPrescription} (Original prescription to support the dispensing of pharmacy services, medications or products.)
4599     */
4600    public Reference getOriginalPrescription() { 
4601      if (this.originalPrescription == null)
4602        if (Configuration.errorOnAutoCreate())
4603          throw new Error("Attempt to auto-create Claim.originalPrescription");
4604        else if (Configuration.doAutoCreate())
4605          this.originalPrescription = new Reference(); // cc
4606      return this.originalPrescription;
4607    }
4608
4609    public boolean hasOriginalPrescription() { 
4610      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
4611    }
4612
4613    /**
4614     * @param value {@link #originalPrescription} (Original prescription to support the dispensing of pharmacy services, medications or products.)
4615     */
4616    public Claim setOriginalPrescription(Reference value) { 
4617      this.originalPrescription = value;
4618      return this;
4619    }
4620
4621    /**
4622     * @return {@link #originalPrescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original prescription to support the dispensing of pharmacy services, medications or products.)
4623     */
4624    public MedicationOrder getOriginalPrescriptionTarget() { 
4625      if (this.originalPrescriptionTarget == null)
4626        if (Configuration.errorOnAutoCreate())
4627          throw new Error("Attempt to auto-create Claim.originalPrescription");
4628        else if (Configuration.doAutoCreate())
4629          this.originalPrescriptionTarget = new MedicationOrder(); // aa
4630      return this.originalPrescriptionTarget;
4631    }
4632
4633    /**
4634     * @param value {@link #originalPrescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original prescription to support the dispensing of pharmacy services, medications or products.)
4635     */
4636    public Claim setOriginalPrescriptionTarget(MedicationOrder value) { 
4637      this.originalPrescriptionTarget = value;
4638      return this;
4639    }
4640
4641    /**
4642     * @return {@link #payee} (The party to be reimbursed for the services.)
4643     */
4644    public PayeeComponent getPayee() { 
4645      if (this.payee == null)
4646        if (Configuration.errorOnAutoCreate())
4647          throw new Error("Attempt to auto-create Claim.payee");
4648        else if (Configuration.doAutoCreate())
4649          this.payee = new PayeeComponent(); // cc
4650      return this.payee;
4651    }
4652
4653    public boolean hasPayee() { 
4654      return this.payee != null && !this.payee.isEmpty();
4655    }
4656
4657    /**
4658     * @param value {@link #payee} (The party to be reimbursed for the services.)
4659     */
4660    public Claim setPayee(PayeeComponent value) { 
4661      this.payee = value;
4662      return this;
4663    }
4664
4665    /**
4666     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
4667     */
4668    public Reference getReferral() { 
4669      if (this.referral == null)
4670        if (Configuration.errorOnAutoCreate())
4671          throw new Error("Attempt to auto-create Claim.referral");
4672        else if (Configuration.doAutoCreate())
4673          this.referral = new Reference(); // cc
4674      return this.referral;
4675    }
4676
4677    public boolean hasReferral() { 
4678      return this.referral != null && !this.referral.isEmpty();
4679    }
4680
4681    /**
4682     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
4683     */
4684    public Claim setReferral(Reference value) { 
4685      this.referral = value;
4686      return this;
4687    }
4688
4689    /**
4690     * @return {@link #referral} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The referral resource which lists the date, practitioner, reason and other supporting information.)
4691     */
4692    public ReferralRequest getReferralTarget() { 
4693      if (this.referralTarget == null)
4694        if (Configuration.errorOnAutoCreate())
4695          throw new Error("Attempt to auto-create Claim.referral");
4696        else if (Configuration.doAutoCreate())
4697          this.referralTarget = new ReferralRequest(); // aa
4698      return this.referralTarget;
4699    }
4700
4701    /**
4702     * @param value {@link #referral} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The referral resource which lists the date, practitioner, reason and other supporting information.)
4703     */
4704    public Claim setReferralTarget(ReferralRequest value) { 
4705      this.referralTarget = value;
4706      return this;
4707    }
4708
4709    /**
4710     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
4711     */
4712    public List<DiagnosisComponent> getDiagnosis() { 
4713      if (this.diagnosis == null)
4714        this.diagnosis = new ArrayList<DiagnosisComponent>();
4715      return this.diagnosis;
4716    }
4717
4718    public boolean hasDiagnosis() { 
4719      if (this.diagnosis == null)
4720        return false;
4721      for (DiagnosisComponent item : this.diagnosis)
4722        if (!item.isEmpty())
4723          return true;
4724      return false;
4725    }
4726
4727    /**
4728     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
4729     */
4730    // syntactic sugar
4731    public DiagnosisComponent addDiagnosis() { //3
4732      DiagnosisComponent t = new DiagnosisComponent();
4733      if (this.diagnosis == null)
4734        this.diagnosis = new ArrayList<DiagnosisComponent>();
4735      this.diagnosis.add(t);
4736      return t;
4737    }
4738
4739    // syntactic sugar
4740    public Claim addDiagnosis(DiagnosisComponent t) { //3
4741      if (t == null)
4742        return this;
4743      if (this.diagnosis == null)
4744        this.diagnosis = new ArrayList<DiagnosisComponent>();
4745      this.diagnosis.add(t);
4746      return this;
4747    }
4748
4749    /**
4750     * @return {@link #condition} (List of patient conditions for which care is sought.)
4751     */
4752    public List<Coding> getCondition() { 
4753      if (this.condition == null)
4754        this.condition = new ArrayList<Coding>();
4755      return this.condition;
4756    }
4757
4758    public boolean hasCondition() { 
4759      if (this.condition == null)
4760        return false;
4761      for (Coding item : this.condition)
4762        if (!item.isEmpty())
4763          return true;
4764      return false;
4765    }
4766
4767    /**
4768     * @return {@link #condition} (List of patient conditions for which care is sought.)
4769     */
4770    // syntactic sugar
4771    public Coding addCondition() { //3
4772      Coding t = new Coding();
4773      if (this.condition == null)
4774        this.condition = new ArrayList<Coding>();
4775      this.condition.add(t);
4776      return t;
4777    }
4778
4779    // syntactic sugar
4780    public Claim addCondition(Coding t) { //3
4781      if (t == null)
4782        return this;
4783      if (this.condition == null)
4784        this.condition = new ArrayList<Coding>();
4785      this.condition.add(t);
4786      return this;
4787    }
4788
4789    /**
4790     * @return {@link #patient} (Patient Resource.)
4791     */
4792    public Reference getPatient() { 
4793      if (this.patient == null)
4794        if (Configuration.errorOnAutoCreate())
4795          throw new Error("Attempt to auto-create Claim.patient");
4796        else if (Configuration.doAutoCreate())
4797          this.patient = new Reference(); // cc
4798      return this.patient;
4799    }
4800
4801    public boolean hasPatient() { 
4802      return this.patient != null && !this.patient.isEmpty();
4803    }
4804
4805    /**
4806     * @param value {@link #patient} (Patient Resource.)
4807     */
4808    public Claim setPatient(Reference value) { 
4809      this.patient = value;
4810      return this;
4811    }
4812
4813    /**
4814     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Patient Resource.)
4815     */
4816    public Patient getPatientTarget() { 
4817      if (this.patientTarget == null)
4818        if (Configuration.errorOnAutoCreate())
4819          throw new Error("Attempt to auto-create Claim.patient");
4820        else if (Configuration.doAutoCreate())
4821          this.patientTarget = new Patient(); // aa
4822      return this.patientTarget;
4823    }
4824
4825    /**
4826     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Patient Resource.)
4827     */
4828    public Claim setPatientTarget(Patient value) { 
4829      this.patientTarget = value;
4830      return this;
4831    }
4832
4833    /**
4834     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
4835     */
4836    public List<CoverageComponent> getCoverage() { 
4837      if (this.coverage == null)
4838        this.coverage = new ArrayList<CoverageComponent>();
4839      return this.coverage;
4840    }
4841
4842    public boolean hasCoverage() { 
4843      if (this.coverage == null)
4844        return false;
4845      for (CoverageComponent item : this.coverage)
4846        if (!item.isEmpty())
4847          return true;
4848      return false;
4849    }
4850
4851    /**
4852     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
4853     */
4854    // syntactic sugar
4855    public CoverageComponent addCoverage() { //3
4856      CoverageComponent t = new CoverageComponent();
4857      if (this.coverage == null)
4858        this.coverage = new ArrayList<CoverageComponent>();
4859      this.coverage.add(t);
4860      return t;
4861    }
4862
4863    // syntactic sugar
4864    public Claim addCoverage(CoverageComponent t) { //3
4865      if (t == null)
4866        return this;
4867      if (this.coverage == null)
4868        this.coverage = new ArrayList<CoverageComponent>();
4869      this.coverage.add(t);
4870      return this;
4871    }
4872
4873    /**
4874     * @return {@link #exception} (Factors which may influence the applicability of coverage.)
4875     */
4876    public List<Coding> getException() { 
4877      if (this.exception == null)
4878        this.exception = new ArrayList<Coding>();
4879      return this.exception;
4880    }
4881
4882    public boolean hasException() { 
4883      if (this.exception == null)
4884        return false;
4885      for (Coding item : this.exception)
4886        if (!item.isEmpty())
4887          return true;
4888      return false;
4889    }
4890
4891    /**
4892     * @return {@link #exception} (Factors which may influence the applicability of coverage.)
4893     */
4894    // syntactic sugar
4895    public Coding addException() { //3
4896      Coding t = new Coding();
4897      if (this.exception == null)
4898        this.exception = new ArrayList<Coding>();
4899      this.exception.add(t);
4900      return t;
4901    }
4902
4903    // syntactic sugar
4904    public Claim addException(Coding t) { //3
4905      if (t == null)
4906        return this;
4907      if (this.exception == null)
4908        this.exception = new ArrayList<Coding>();
4909      this.exception.add(t);
4910      return this;
4911    }
4912
4913    /**
4914     * @return {@link #school} (Name of school for over-aged dependents.). This is the underlying object with id, value and extensions. The accessor "getSchool" gives direct access to the value
4915     */
4916    public StringType getSchoolElement() { 
4917      if (this.school == null)
4918        if (Configuration.errorOnAutoCreate())
4919          throw new Error("Attempt to auto-create Claim.school");
4920        else if (Configuration.doAutoCreate())
4921          this.school = new StringType(); // bb
4922      return this.school;
4923    }
4924
4925    public boolean hasSchoolElement() { 
4926      return this.school != null && !this.school.isEmpty();
4927    }
4928
4929    public boolean hasSchool() { 
4930      return this.school != null && !this.school.isEmpty();
4931    }
4932
4933    /**
4934     * @param value {@link #school} (Name of school for over-aged dependents.). This is the underlying object with id, value and extensions. The accessor "getSchool" gives direct access to the value
4935     */
4936    public Claim setSchoolElement(StringType value) { 
4937      this.school = value;
4938      return this;
4939    }
4940
4941    /**
4942     * @return Name of school for over-aged dependents.
4943     */
4944    public String getSchool() { 
4945      return this.school == null ? null : this.school.getValue();
4946    }
4947
4948    /**
4949     * @param value Name of school for over-aged dependents.
4950     */
4951    public Claim setSchool(String value) { 
4952      if (Utilities.noString(value))
4953        this.school = null;
4954      else {
4955        if (this.school == null)
4956          this.school = new StringType();
4957        this.school.setValue(value);
4958      }
4959      return this;
4960    }
4961
4962    /**
4963     * @return {@link #accident} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getAccident" gives direct access to the value
4964     */
4965    public DateType getAccidentElement() { 
4966      if (this.accident == null)
4967        if (Configuration.errorOnAutoCreate())
4968          throw new Error("Attempt to auto-create Claim.accident");
4969        else if (Configuration.doAutoCreate())
4970          this.accident = new DateType(); // bb
4971      return this.accident;
4972    }
4973
4974    public boolean hasAccidentElement() { 
4975      return this.accident != null && !this.accident.isEmpty();
4976    }
4977
4978    public boolean hasAccident() { 
4979      return this.accident != null && !this.accident.isEmpty();
4980    }
4981
4982    /**
4983     * @param value {@link #accident} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getAccident" gives direct access to the value
4984     */
4985    public Claim setAccidentElement(DateType value) { 
4986      this.accident = value;
4987      return this;
4988    }
4989
4990    /**
4991     * @return Date of an accident which these services are addressing.
4992     */
4993    public Date getAccident() { 
4994      return this.accident == null ? null : this.accident.getValue();
4995    }
4996
4997    /**
4998     * @param value Date of an accident which these services are addressing.
4999     */
5000    public Claim setAccident(Date value) { 
5001      if (value == null)
5002        this.accident = null;
5003      else {
5004        if (this.accident == null)
5005          this.accident = new DateType();
5006        this.accident.setValue(value);
5007      }
5008      return this;
5009    }
5010
5011    /**
5012     * @return {@link #accidentType} (Type of accident: work, auto, etc.)
5013     */
5014    public Coding getAccidentType() { 
5015      if (this.accidentType == null)
5016        if (Configuration.errorOnAutoCreate())
5017          throw new Error("Attempt to auto-create Claim.accidentType");
5018        else if (Configuration.doAutoCreate())
5019          this.accidentType = new Coding(); // cc
5020      return this.accidentType;
5021    }
5022
5023    public boolean hasAccidentType() { 
5024      return this.accidentType != null && !this.accidentType.isEmpty();
5025    }
5026
5027    /**
5028     * @param value {@link #accidentType} (Type of accident: work, auto, etc.)
5029     */
5030    public Claim setAccidentType(Coding value) { 
5031      this.accidentType = value;
5032      return this;
5033    }
5034
5035    /**
5036     * @return {@link #interventionException} (A list of intervention and exception codes which may influence the adjudication of the claim.)
5037     */
5038    public List<Coding> getInterventionException() { 
5039      if (this.interventionException == null)
5040        this.interventionException = new ArrayList<Coding>();
5041      return this.interventionException;
5042    }
5043
5044    public boolean hasInterventionException() { 
5045      if (this.interventionException == null)
5046        return false;
5047      for (Coding item : this.interventionException)
5048        if (!item.isEmpty())
5049          return true;
5050      return false;
5051    }
5052
5053    /**
5054     * @return {@link #interventionException} (A list of intervention and exception codes which may influence the adjudication of the claim.)
5055     */
5056    // syntactic sugar
5057    public Coding addInterventionException() { //3
5058      Coding t = new Coding();
5059      if (this.interventionException == null)
5060        this.interventionException = new ArrayList<Coding>();
5061      this.interventionException.add(t);
5062      return t;
5063    }
5064
5065    // syntactic sugar
5066    public Claim addInterventionException(Coding t) { //3
5067      if (t == null)
5068        return this;
5069      if (this.interventionException == null)
5070        this.interventionException = new ArrayList<Coding>();
5071      this.interventionException.add(t);
5072      return this;
5073    }
5074
5075    /**
5076     * @return {@link #item} (First tier of goods and services.)
5077     */
5078    public List<ItemsComponent> getItem() { 
5079      if (this.item == null)
5080        this.item = new ArrayList<ItemsComponent>();
5081      return this.item;
5082    }
5083
5084    public boolean hasItem() { 
5085      if (this.item == null)
5086        return false;
5087      for (ItemsComponent item : this.item)
5088        if (!item.isEmpty())
5089          return true;
5090      return false;
5091    }
5092
5093    /**
5094     * @return {@link #item} (First tier of goods and services.)
5095     */
5096    // syntactic sugar
5097    public ItemsComponent addItem() { //3
5098      ItemsComponent t = new ItemsComponent();
5099      if (this.item == null)
5100        this.item = new ArrayList<ItemsComponent>();
5101      this.item.add(t);
5102      return t;
5103    }
5104
5105    // syntactic sugar
5106    public Claim addItem(ItemsComponent t) { //3
5107      if (t == null)
5108        return this;
5109      if (this.item == null)
5110        this.item = new ArrayList<ItemsComponent>();
5111      this.item.add(t);
5112      return this;
5113    }
5114
5115    /**
5116     * @return {@link #additionalMaterials} (Code to indicate that Xrays, images, emails, documents, models or attachments are being sent in support of this submission.)
5117     */
5118    public List<Coding> getAdditionalMaterials() { 
5119      if (this.additionalMaterials == null)
5120        this.additionalMaterials = new ArrayList<Coding>();
5121      return this.additionalMaterials;
5122    }
5123
5124    public boolean hasAdditionalMaterials() { 
5125      if (this.additionalMaterials == null)
5126        return false;
5127      for (Coding item : this.additionalMaterials)
5128        if (!item.isEmpty())
5129          return true;
5130      return false;
5131    }
5132
5133    /**
5134     * @return {@link #additionalMaterials} (Code to indicate that Xrays, images, emails, documents, models or attachments are being sent in support of this submission.)
5135     */
5136    // syntactic sugar
5137    public Coding addAdditionalMaterials() { //3
5138      Coding t = new Coding();
5139      if (this.additionalMaterials == null)
5140        this.additionalMaterials = new ArrayList<Coding>();
5141      this.additionalMaterials.add(t);
5142      return t;
5143    }
5144
5145    // syntactic sugar
5146    public Claim addAdditionalMaterials(Coding t) { //3
5147      if (t == null)
5148        return this;
5149      if (this.additionalMaterials == null)
5150        this.additionalMaterials = new ArrayList<Coding>();
5151      this.additionalMaterials.add(t);
5152      return this;
5153    }
5154
5155    /**
5156     * @return {@link #missingTeeth} (A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.)
5157     */
5158    public List<MissingTeethComponent> getMissingTeeth() { 
5159      if (this.missingTeeth == null)
5160        this.missingTeeth = new ArrayList<MissingTeethComponent>();
5161      return this.missingTeeth;
5162    }
5163
5164    public boolean hasMissingTeeth() { 
5165      if (this.missingTeeth == null)
5166        return false;
5167      for (MissingTeethComponent item : this.missingTeeth)
5168        if (!item.isEmpty())
5169          return true;
5170      return false;
5171    }
5172
5173    /**
5174     * @return {@link #missingTeeth} (A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.)
5175     */
5176    // syntactic sugar
5177    public MissingTeethComponent addMissingTeeth() { //3
5178      MissingTeethComponent t = new MissingTeethComponent();
5179      if (this.missingTeeth == null)
5180        this.missingTeeth = new ArrayList<MissingTeethComponent>();
5181      this.missingTeeth.add(t);
5182      return t;
5183    }
5184
5185    // syntactic sugar
5186    public Claim addMissingTeeth(MissingTeethComponent t) { //3
5187      if (t == null)
5188        return this;
5189      if (this.missingTeeth == null)
5190        this.missingTeeth = new ArrayList<MissingTeethComponent>();
5191      this.missingTeeth.add(t);
5192      return this;
5193    }
5194
5195      protected void listChildren(List<Property> childrenList) {
5196        super.listChildren(childrenList);
5197        childrenList.add(new Property("type", "code", "The category of claim this is.", 0, java.lang.Integer.MAX_VALUE, type));
5198        childrenList.add(new Property("identifier", "Identifier", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, java.lang.Integer.MAX_VALUE, identifier));
5199        childrenList.add(new Property("ruleset", "Coding", "The version of the specification on which this instance relies.", 0, java.lang.Integer.MAX_VALUE, ruleset));
5200        childrenList.add(new Property("originalRuleset", "Coding", "The version of the specification from which the original instance was created.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
5201        childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
5202        childrenList.add(new Property("target", "Reference(Organization)", "Insurer Identifier, typical BIN number (6 digit).", 0, java.lang.Integer.MAX_VALUE, target));
5203        childrenList.add(new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the bill, claim pre-determination, pre-authorization.", 0, java.lang.Integer.MAX_VALUE, provider));
5204        childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the bill, claim pre-determination, pre-authorization.", 0, java.lang.Integer.MAX_VALUE, organization));
5205        childrenList.add(new Property("use", "code", "Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).", 0, java.lang.Integer.MAX_VALUE, use));
5206        childrenList.add(new Property("priority", "Coding", "Immediate (stat), best effort (normal), deferred (deferred).", 0, java.lang.Integer.MAX_VALUE, priority));
5207        childrenList.add(new Property("fundsReserve", "Coding", "In the case of a Pre-Determination/Pre-Authorization the provider may request that funds in the amount of the expected Benefit be reserved ('Patient' or 'Provider') to pay for the Benefits determined on the subsequent claim(s). 'None' explicitly indicates no funds reserving is requested.", 0, java.lang.Integer.MAX_VALUE, fundsReserve));
5208        childrenList.add(new Property("enterer", "Reference(Practitioner)", "Person who created the invoice/claim/pre-determination or pre-authorization.", 0, java.lang.Integer.MAX_VALUE, enterer));
5209        childrenList.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, java.lang.Integer.MAX_VALUE, facility));
5210        childrenList.add(new Property("prescription", "Reference(MedicationOrder|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, java.lang.Integer.MAX_VALUE, prescription));
5211        childrenList.add(new Property("originalPrescription", "Reference(MedicationOrder)", "Original prescription to support the dispensing of pharmacy services, medications or products.", 0, java.lang.Integer.MAX_VALUE, originalPrescription));
5212        childrenList.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, java.lang.Integer.MAX_VALUE, payee));
5213        childrenList.add(new Property("referral", "Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, java.lang.Integer.MAX_VALUE, referral));
5214        childrenList.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
5215        childrenList.add(new Property("condition", "Coding", "List of patient conditions for which care is sought.", 0, java.lang.Integer.MAX_VALUE, condition));
5216        childrenList.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, patient));
5217        childrenList.add(new Property("coverage", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, coverage));
5218        childrenList.add(new Property("exception", "Coding", "Factors which may influence the applicability of coverage.", 0, java.lang.Integer.MAX_VALUE, exception));
5219        childrenList.add(new Property("school", "string", "Name of school for over-aged dependents.", 0, java.lang.Integer.MAX_VALUE, school));
5220        childrenList.add(new Property("accident", "date", "Date of an accident which these services are addressing.", 0, java.lang.Integer.MAX_VALUE, accident));
5221        childrenList.add(new Property("accidentType", "Coding", "Type of accident: work, auto, etc.", 0, java.lang.Integer.MAX_VALUE, accidentType));
5222        childrenList.add(new Property("interventionException", "Coding", "A list of intervention and exception codes which may influence the adjudication of the claim.", 0, java.lang.Integer.MAX_VALUE, interventionException));
5223        childrenList.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
5224        childrenList.add(new Property("additionalMaterials", "Coding", "Code to indicate that Xrays, images, emails, documents, models or attachments are being sent in support of this submission.", 0, java.lang.Integer.MAX_VALUE, additionalMaterials));
5225        childrenList.add(new Property("missingTeeth", "", "A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.", 0, java.lang.Integer.MAX_VALUE, missingTeeth));
5226      }
5227
5228      @Override
5229      public void setProperty(String name, Base value) throws FHIRException {
5230        if (name.equals("type"))
5231          this.type = new ClaimTypeEnumFactory().fromType(value); // Enumeration<ClaimType>
5232        else if (name.equals("identifier"))
5233          this.getIdentifier().add(castToIdentifier(value));
5234        else if (name.equals("ruleset"))
5235          this.ruleset = castToCoding(value); // Coding
5236        else if (name.equals("originalRuleset"))
5237          this.originalRuleset = castToCoding(value); // Coding
5238        else if (name.equals("created"))
5239          this.created = castToDateTime(value); // DateTimeType
5240        else if (name.equals("target"))
5241          this.target = castToReference(value); // Reference
5242        else if (name.equals("provider"))
5243          this.provider = castToReference(value); // Reference
5244        else if (name.equals("organization"))
5245          this.organization = castToReference(value); // Reference
5246        else if (name.equals("use"))
5247          this.use = new UseEnumFactory().fromType(value); // Enumeration<Use>
5248        else if (name.equals("priority"))
5249          this.priority = castToCoding(value); // Coding
5250        else if (name.equals("fundsReserve"))
5251          this.fundsReserve = castToCoding(value); // Coding
5252        else if (name.equals("enterer"))
5253          this.enterer = castToReference(value); // Reference
5254        else if (name.equals("facility"))
5255          this.facility = castToReference(value); // Reference
5256        else if (name.equals("prescription"))
5257          this.prescription = castToReference(value); // Reference
5258        else if (name.equals("originalPrescription"))
5259          this.originalPrescription = castToReference(value); // Reference
5260        else if (name.equals("payee"))
5261          this.payee = (PayeeComponent) value; // PayeeComponent
5262        else if (name.equals("referral"))
5263          this.referral = castToReference(value); // Reference
5264        else if (name.equals("diagnosis"))
5265          this.getDiagnosis().add((DiagnosisComponent) value);
5266        else if (name.equals("condition"))
5267          this.getCondition().add(castToCoding(value));
5268        else if (name.equals("patient"))
5269          this.patient = castToReference(value); // Reference
5270        else if (name.equals("coverage"))
5271          this.getCoverage().add((CoverageComponent) value);
5272        else if (name.equals("exception"))
5273          this.getException().add(castToCoding(value));
5274        else if (name.equals("school"))
5275          this.school = castToString(value); // StringType
5276        else if (name.equals("accident"))
5277          this.accident = castToDate(value); // DateType
5278        else if (name.equals("accidentType"))
5279          this.accidentType = castToCoding(value); // Coding
5280        else if (name.equals("interventionException"))
5281          this.getInterventionException().add(castToCoding(value));
5282        else if (name.equals("item"))
5283          this.getItem().add((ItemsComponent) value);
5284        else if (name.equals("additionalMaterials"))
5285          this.getAdditionalMaterials().add(castToCoding(value));
5286        else if (name.equals("missingTeeth"))
5287          this.getMissingTeeth().add((MissingTeethComponent) value);
5288        else
5289          super.setProperty(name, value);
5290      }
5291
5292      @Override
5293      public Base addChild(String name) throws FHIRException {
5294        if (name.equals("type")) {
5295          throw new FHIRException("Cannot call addChild on a primitive type Claim.type");
5296        }
5297        else if (name.equals("identifier")) {
5298          return addIdentifier();
5299        }
5300        else if (name.equals("ruleset")) {
5301          this.ruleset = new Coding();
5302          return this.ruleset;
5303        }
5304        else if (name.equals("originalRuleset")) {
5305          this.originalRuleset = new Coding();
5306          return this.originalRuleset;
5307        }
5308        else if (name.equals("created")) {
5309          throw new FHIRException("Cannot call addChild on a primitive type Claim.created");
5310        }
5311        else if (name.equals("target")) {
5312          this.target = new Reference();
5313          return this.target;
5314        }
5315        else if (name.equals("provider")) {
5316          this.provider = new Reference();
5317          return this.provider;
5318        }
5319        else if (name.equals("organization")) {
5320          this.organization = new Reference();
5321          return this.organization;
5322        }
5323        else if (name.equals("use")) {
5324          throw new FHIRException("Cannot call addChild on a primitive type Claim.use");
5325        }
5326        else if (name.equals("priority")) {
5327          this.priority = new Coding();
5328          return this.priority;
5329        }
5330        else if (name.equals("fundsReserve")) {
5331          this.fundsReserve = new Coding();
5332          return this.fundsReserve;
5333        }
5334        else if (name.equals("enterer")) {
5335          this.enterer = new Reference();
5336          return this.enterer;
5337        }
5338        else if (name.equals("facility")) {
5339          this.facility = new Reference();
5340          return this.facility;
5341        }
5342        else if (name.equals("prescription")) {
5343          this.prescription = new Reference();
5344          return this.prescription;
5345        }
5346        else if (name.equals("originalPrescription")) {
5347          this.originalPrescription = new Reference();
5348          return this.originalPrescription;
5349        }
5350        else if (name.equals("payee")) {
5351          this.payee = new PayeeComponent();
5352          return this.payee;
5353        }
5354        else if (name.equals("referral")) {
5355          this.referral = new Reference();
5356          return this.referral;
5357        }
5358        else if (name.equals("diagnosis")) {
5359          return addDiagnosis();
5360        }
5361        else if (name.equals("condition")) {
5362          return addCondition();
5363        }
5364        else if (name.equals("patient")) {
5365          this.patient = new Reference();
5366          return this.patient;
5367        }
5368        else if (name.equals("coverage")) {
5369          return addCoverage();
5370        }
5371        else if (name.equals("exception")) {
5372          return addException();
5373        }
5374        else if (name.equals("school")) {
5375          throw new FHIRException("Cannot call addChild on a primitive type Claim.school");
5376        }
5377        else if (name.equals("accident")) {
5378          throw new FHIRException("Cannot call addChild on a primitive type Claim.accident");
5379        }
5380        else if (name.equals("accidentType")) {
5381          this.accidentType = new Coding();
5382          return this.accidentType;
5383        }
5384        else if (name.equals("interventionException")) {
5385          return addInterventionException();
5386        }
5387        else if (name.equals("item")) {
5388          return addItem();
5389        }
5390        else if (name.equals("additionalMaterials")) {
5391          return addAdditionalMaterials();
5392        }
5393        else if (name.equals("missingTeeth")) {
5394          return addMissingTeeth();
5395        }
5396        else
5397          return super.addChild(name);
5398      }
5399
5400  public String fhirType() {
5401    return "Claim";
5402
5403  }
5404
5405      public Claim copy() {
5406        Claim dst = new Claim();
5407        copyValues(dst);
5408        dst.type = type == null ? null : type.copy();
5409        if (identifier != null) {
5410          dst.identifier = new ArrayList<Identifier>();
5411          for (Identifier i : identifier)
5412            dst.identifier.add(i.copy());
5413        };
5414        dst.ruleset = ruleset == null ? null : ruleset.copy();
5415        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
5416        dst.created = created == null ? null : created.copy();
5417        dst.target = target == null ? null : target.copy();
5418        dst.provider = provider == null ? null : provider.copy();
5419        dst.organization = organization == null ? null : organization.copy();
5420        dst.use = use == null ? null : use.copy();
5421        dst.priority = priority == null ? null : priority.copy();
5422        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
5423        dst.enterer = enterer == null ? null : enterer.copy();
5424        dst.facility = facility == null ? null : facility.copy();
5425        dst.prescription = prescription == null ? null : prescription.copy();
5426        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
5427        dst.payee = payee == null ? null : payee.copy();
5428        dst.referral = referral == null ? null : referral.copy();
5429        if (diagnosis != null) {
5430          dst.diagnosis = new ArrayList<DiagnosisComponent>();
5431          for (DiagnosisComponent i : diagnosis)
5432            dst.diagnosis.add(i.copy());
5433        };
5434        if (condition != null) {
5435          dst.condition = new ArrayList<Coding>();
5436          for (Coding i : condition)
5437            dst.condition.add(i.copy());
5438        };
5439        dst.patient = patient == null ? null : patient.copy();
5440        if (coverage != null) {
5441          dst.coverage = new ArrayList<CoverageComponent>();
5442          for (CoverageComponent i : coverage)
5443            dst.coverage.add(i.copy());
5444        };
5445        if (exception != null) {
5446          dst.exception = new ArrayList<Coding>();
5447          for (Coding i : exception)
5448            dst.exception.add(i.copy());
5449        };
5450        dst.school = school == null ? null : school.copy();
5451        dst.accident = accident == null ? null : accident.copy();
5452        dst.accidentType = accidentType == null ? null : accidentType.copy();
5453        if (interventionException != null) {
5454          dst.interventionException = new ArrayList<Coding>();
5455          for (Coding i : interventionException)
5456            dst.interventionException.add(i.copy());
5457        };
5458        if (item != null) {
5459          dst.item = new ArrayList<ItemsComponent>();
5460          for (ItemsComponent i : item)
5461            dst.item.add(i.copy());
5462        };
5463        if (additionalMaterials != null) {
5464          dst.additionalMaterials = new ArrayList<Coding>();
5465          for (Coding i : additionalMaterials)
5466            dst.additionalMaterials.add(i.copy());
5467        };
5468        if (missingTeeth != null) {
5469          dst.missingTeeth = new ArrayList<MissingTeethComponent>();
5470          for (MissingTeethComponent i : missingTeeth)
5471            dst.missingTeeth.add(i.copy());
5472        };
5473        return dst;
5474      }
5475
5476      protected Claim typedCopy() {
5477        return copy();
5478      }
5479
5480      @Override
5481      public boolean equalsDeep(Base other) {
5482        if (!super.equalsDeep(other))
5483          return false;
5484        if (!(other instanceof Claim))
5485          return false;
5486        Claim o = (Claim) other;
5487        return compareDeep(type, o.type, true) && compareDeep(identifier, o.identifier, true) && compareDeep(ruleset, o.ruleset, true)
5488           && compareDeep(originalRuleset, o.originalRuleset, true) && compareDeep(created, o.created, true)
5489           && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true)
5490           && compareDeep(use, o.use, true) && compareDeep(priority, o.priority, true) && compareDeep(fundsReserve, o.fundsReserve, true)
5491           && compareDeep(enterer, o.enterer, true) && compareDeep(facility, o.facility, true) && compareDeep(prescription, o.prescription, true)
5492           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
5493           && compareDeep(referral, o.referral, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(condition, o.condition, true)
5494           && compareDeep(patient, o.patient, true) && compareDeep(coverage, o.coverage, true) && compareDeep(exception, o.exception, true)
5495           && compareDeep(school, o.school, true) && compareDeep(accident, o.accident, true) && compareDeep(accidentType, o.accidentType, true)
5496           && compareDeep(interventionException, o.interventionException, true) && compareDeep(item, o.item, true)
5497           && compareDeep(additionalMaterials, o.additionalMaterials, true) && compareDeep(missingTeeth, o.missingTeeth, true)
5498          ;
5499      }
5500
5501      @Override
5502      public boolean equalsShallow(Base other) {
5503        if (!super.equalsShallow(other))
5504          return false;
5505        if (!(other instanceof Claim))
5506          return false;
5507        Claim o = (Claim) other;
5508        return compareValues(type, o.type, true) && compareValues(created, o.created, true) && compareValues(use, o.use, true)
5509           && compareValues(school, o.school, true) && compareValues(accident, o.accident, true);
5510      }
5511
5512      public boolean isEmpty() {
5513        return super.isEmpty() && (type == null || type.isEmpty()) && (identifier == null || identifier.isEmpty())
5514           && (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
5515           && (created == null || created.isEmpty()) && (target == null || target.isEmpty()) && (provider == null || provider.isEmpty())
5516           && (organization == null || organization.isEmpty()) && (use == null || use.isEmpty()) && (priority == null || priority.isEmpty())
5517           && (fundsReserve == null || fundsReserve.isEmpty()) && (enterer == null || enterer.isEmpty())
5518           && (facility == null || facility.isEmpty()) && (prescription == null || prescription.isEmpty())
5519           && (originalPrescription == null || originalPrescription.isEmpty()) && (payee == null || payee.isEmpty())
5520           && (referral == null || referral.isEmpty()) && (diagnosis == null || diagnosis.isEmpty())
5521           && (condition == null || condition.isEmpty()) && (patient == null || patient.isEmpty()) && (coverage == null || coverage.isEmpty())
5522           && (exception == null || exception.isEmpty()) && (school == null || school.isEmpty()) && (accident == null || accident.isEmpty())
5523           && (accidentType == null || accidentType.isEmpty()) && (interventionException == null || interventionException.isEmpty())
5524           && (item == null || item.isEmpty()) && (additionalMaterials == null || additionalMaterials.isEmpty())
5525           && (missingTeeth == null || missingTeeth.isEmpty());
5526      }
5527
5528  @Override
5529  public ResourceType getResourceType() {
5530    return ResourceType.Claim;
5531   }
5532
5533  @SearchParamDefinition(name="identifier", path="Claim.identifier", description="The primary identifier of the financial resource", type="token" )
5534  public static final String SP_IDENTIFIER = "identifier";
5535  @SearchParamDefinition(name="provider", path="Claim.provider", description="Provider responsible for the claim", type="reference" )
5536  public static final String SP_PROVIDER = "provider";
5537  @SearchParamDefinition(name="use", path="Claim.use", description="The kind of financial resource", type="token" )
5538  public static final String SP_USE = "use";
5539  @SearchParamDefinition(name="patient", path="Claim.patient", description="Patient", type="reference" )
5540  public static final String SP_PATIENT = "patient";
5541  @SearchParamDefinition(name="priority", path="Claim.priority", description="Processing priority requested", type="token" )
5542  public static final String SP_PRIORITY = "priority";
5543
5544}
5545