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