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