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