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