001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048
049/**
050 * Invoice containing collected ChargeItems from an Account with calculated
051 * individual and total price for Billing purpose.
052 */
053@ResourceDef(name = "Invoice", profile = "http://hl7.org/fhir/StructureDefinition/Invoice")
054public class Invoice extends DomainResource {
055
056  public enum InvoiceStatus {
057    /**
058     * the invoice has been prepared but not yet finalized.
059     */
060    DRAFT,
061    /**
062     * the invoice has been finalized and sent to the recipient.
063     */
064    ISSUED,
065    /**
066     * the invoice has been balaced / completely paid.
067     */
068    BALANCED,
069    /**
070     * the invoice was cancelled.
071     */
072    CANCELLED,
073    /**
074     * the invoice was determined as entered in error before it was issued.
075     */
076    ENTEREDINERROR,
077    /**
078     * added to help the parsers with the generic types
079     */
080    NULL;
081
082    public static InvoiceStatus fromCode(String codeString) throws FHIRException {
083      if (codeString == null || "".equals(codeString))
084        return null;
085      if ("draft".equals(codeString))
086        return DRAFT;
087      if ("issued".equals(codeString))
088        return ISSUED;
089      if ("balanced".equals(codeString))
090        return BALANCED;
091      if ("cancelled".equals(codeString))
092        return CANCELLED;
093      if ("entered-in-error".equals(codeString))
094        return ENTEREDINERROR;
095      if (Configuration.isAcceptInvalidEnums())
096        return null;
097      else
098        throw new FHIRException("Unknown InvoiceStatus code '" + codeString + "'");
099    }
100
101    public String toCode() {
102      switch (this) {
103      case DRAFT:
104        return "draft";
105      case ISSUED:
106        return "issued";
107      case BALANCED:
108        return "balanced";
109      case CANCELLED:
110        return "cancelled";
111      case ENTEREDINERROR:
112        return "entered-in-error";
113      case NULL:
114        return null;
115      default:
116        return "?";
117      }
118    }
119
120    public String getSystem() {
121      switch (this) {
122      case DRAFT:
123        return "http://hl7.org/fhir/invoice-status";
124      case ISSUED:
125        return "http://hl7.org/fhir/invoice-status";
126      case BALANCED:
127        return "http://hl7.org/fhir/invoice-status";
128      case CANCELLED:
129        return "http://hl7.org/fhir/invoice-status";
130      case ENTEREDINERROR:
131        return "http://hl7.org/fhir/invoice-status";
132      case NULL:
133        return null;
134      default:
135        return "?";
136      }
137    }
138
139    public String getDefinition() {
140      switch (this) {
141      case DRAFT:
142        return "the invoice has been prepared but not yet finalized.";
143      case ISSUED:
144        return "the invoice has been finalized and sent to the recipient.";
145      case BALANCED:
146        return "the invoice has been balaced / completely paid.";
147      case CANCELLED:
148        return "the invoice was cancelled.";
149      case ENTEREDINERROR:
150        return "the invoice was determined as entered in error before it was issued.";
151      case NULL:
152        return null;
153      default:
154        return "?";
155      }
156    }
157
158    public String getDisplay() {
159      switch (this) {
160      case DRAFT:
161        return "draft";
162      case ISSUED:
163        return "issued";
164      case BALANCED:
165        return "balanced";
166      case CANCELLED:
167        return "cancelled";
168      case ENTEREDINERROR:
169        return "entered in error";
170      case NULL:
171        return null;
172      default:
173        return "?";
174      }
175    }
176  }
177
178  public static class InvoiceStatusEnumFactory implements EnumFactory<InvoiceStatus> {
179    public InvoiceStatus fromCode(String codeString) throws IllegalArgumentException {
180      if (codeString == null || "".equals(codeString))
181        if (codeString == null || "".equals(codeString))
182          return null;
183      if ("draft".equals(codeString))
184        return InvoiceStatus.DRAFT;
185      if ("issued".equals(codeString))
186        return InvoiceStatus.ISSUED;
187      if ("balanced".equals(codeString))
188        return InvoiceStatus.BALANCED;
189      if ("cancelled".equals(codeString))
190        return InvoiceStatus.CANCELLED;
191      if ("entered-in-error".equals(codeString))
192        return InvoiceStatus.ENTEREDINERROR;
193      throw new IllegalArgumentException("Unknown InvoiceStatus code '" + codeString + "'");
194    }
195
196    public Enumeration<InvoiceStatus> fromType(PrimitiveType<?> code) throws FHIRException {
197      if (code == null)
198        return null;
199      if (code.isEmpty())
200        return new Enumeration<InvoiceStatus>(this, InvoiceStatus.NULL, code);
201      String codeString = code.asStringValue();
202      if (codeString == null || "".equals(codeString))
203        return new Enumeration<InvoiceStatus>(this, InvoiceStatus.NULL, code);
204      if ("draft".equals(codeString))
205        return new Enumeration<InvoiceStatus>(this, InvoiceStatus.DRAFT, code);
206      if ("issued".equals(codeString))
207        return new Enumeration<InvoiceStatus>(this, InvoiceStatus.ISSUED, code);
208      if ("balanced".equals(codeString))
209        return new Enumeration<InvoiceStatus>(this, InvoiceStatus.BALANCED, code);
210      if ("cancelled".equals(codeString))
211        return new Enumeration<InvoiceStatus>(this, InvoiceStatus.CANCELLED, code);
212      if ("entered-in-error".equals(codeString))
213        return new Enumeration<InvoiceStatus>(this, InvoiceStatus.ENTEREDINERROR, code);
214      throw new FHIRException("Unknown InvoiceStatus code '" + codeString + "'");
215    }
216
217    public String toCode(InvoiceStatus code) {
218      if (code == InvoiceStatus.DRAFT)
219        return "draft";
220      if (code == InvoiceStatus.ISSUED)
221        return "issued";
222      if (code == InvoiceStatus.BALANCED)
223        return "balanced";
224      if (code == InvoiceStatus.CANCELLED)
225        return "cancelled";
226      if (code == InvoiceStatus.ENTEREDINERROR)
227        return "entered-in-error";
228      return "?";
229    }
230
231    public String toSystem(InvoiceStatus code) {
232      return code.getSystem();
233    }
234  }
235
236  public enum InvoicePriceComponentType {
237    /**
238     * the amount is the base price used for calculating the total price before
239     * applying surcharges, discount or taxes.
240     */
241    BASE,
242    /**
243     * the amount is a surcharge applied on the base price.
244     */
245    SURCHARGE,
246    /**
247     * the amount is a deduction applied on the base price.
248     */
249    DEDUCTION,
250    /**
251     * the amount is a discount applied on the base price.
252     */
253    DISCOUNT,
254    /**
255     * the amount is the tax component of the total price.
256     */
257    TAX,
258    /**
259     * the amount is of informational character, it has not been applied in the
260     * calculation of the total price.
261     */
262    INFORMATIONAL,
263    /**
264     * added to help the parsers with the generic types
265     */
266    NULL;
267
268    public static InvoicePriceComponentType fromCode(String codeString) throws FHIRException {
269      if (codeString == null || "".equals(codeString))
270        return null;
271      if ("base".equals(codeString))
272        return BASE;
273      if ("surcharge".equals(codeString))
274        return SURCHARGE;
275      if ("deduction".equals(codeString))
276        return DEDUCTION;
277      if ("discount".equals(codeString))
278        return DISCOUNT;
279      if ("tax".equals(codeString))
280        return TAX;
281      if ("informational".equals(codeString))
282        return INFORMATIONAL;
283      if (Configuration.isAcceptInvalidEnums())
284        return null;
285      else
286        throw new FHIRException("Unknown InvoicePriceComponentType code '" + codeString + "'");
287    }
288
289    public String toCode() {
290      switch (this) {
291      case BASE:
292        return "base";
293      case SURCHARGE:
294        return "surcharge";
295      case DEDUCTION:
296        return "deduction";
297      case DISCOUNT:
298        return "discount";
299      case TAX:
300        return "tax";
301      case INFORMATIONAL:
302        return "informational";
303      case NULL:
304        return null;
305      default:
306        return "?";
307      }
308    }
309
310    public String getSystem() {
311      switch (this) {
312      case BASE:
313        return "http://hl7.org/fhir/invoice-priceComponentType";
314      case SURCHARGE:
315        return "http://hl7.org/fhir/invoice-priceComponentType";
316      case DEDUCTION:
317        return "http://hl7.org/fhir/invoice-priceComponentType";
318      case DISCOUNT:
319        return "http://hl7.org/fhir/invoice-priceComponentType";
320      case TAX:
321        return "http://hl7.org/fhir/invoice-priceComponentType";
322      case INFORMATIONAL:
323        return "http://hl7.org/fhir/invoice-priceComponentType";
324      case NULL:
325        return null;
326      default:
327        return "?";
328      }
329    }
330
331    public String getDefinition() {
332      switch (this) {
333      case BASE:
334        return "the amount is the base price used for calculating the total price before applying surcharges, discount or taxes.";
335      case SURCHARGE:
336        return "the amount is a surcharge applied on the base price.";
337      case DEDUCTION:
338        return "the amount is a deduction applied on the base price.";
339      case DISCOUNT:
340        return "the amount is a discount applied on the base price.";
341      case TAX:
342        return "the amount is the tax component of the total price.";
343      case INFORMATIONAL:
344        return "the amount is of informational character, it has not been applied in the calculation of the total price.";
345      case NULL:
346        return null;
347      default:
348        return "?";
349      }
350    }
351
352    public String getDisplay() {
353      switch (this) {
354      case BASE:
355        return "base price";
356      case SURCHARGE:
357        return "surcharge";
358      case DEDUCTION:
359        return "deduction";
360      case DISCOUNT:
361        return "discount";
362      case TAX:
363        return "tax";
364      case INFORMATIONAL:
365        return "informational";
366      case NULL:
367        return null;
368      default:
369        return "?";
370      }
371    }
372  }
373
374  public static class InvoicePriceComponentTypeEnumFactory implements EnumFactory<InvoicePriceComponentType> {
375    public InvoicePriceComponentType fromCode(String codeString) throws IllegalArgumentException {
376      if (codeString == null || "".equals(codeString))
377        if (codeString == null || "".equals(codeString))
378          return null;
379      if ("base".equals(codeString))
380        return InvoicePriceComponentType.BASE;
381      if ("surcharge".equals(codeString))
382        return InvoicePriceComponentType.SURCHARGE;
383      if ("deduction".equals(codeString))
384        return InvoicePriceComponentType.DEDUCTION;
385      if ("discount".equals(codeString))
386        return InvoicePriceComponentType.DISCOUNT;
387      if ("tax".equals(codeString))
388        return InvoicePriceComponentType.TAX;
389      if ("informational".equals(codeString))
390        return InvoicePriceComponentType.INFORMATIONAL;
391      throw new IllegalArgumentException("Unknown InvoicePriceComponentType code '" + codeString + "'");
392    }
393
394    public Enumeration<InvoicePriceComponentType> fromType(PrimitiveType<?> code) throws FHIRException {
395      if (code == null)
396        return null;
397      if (code.isEmpty())
398        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.NULL, code);
399      String codeString = code.asStringValue();
400      if (codeString == null || "".equals(codeString))
401        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.NULL, code);
402      if ("base".equals(codeString))
403        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.BASE, code);
404      if ("surcharge".equals(codeString))
405        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.SURCHARGE, code);
406      if ("deduction".equals(codeString))
407        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.DEDUCTION, code);
408      if ("discount".equals(codeString))
409        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.DISCOUNT, code);
410      if ("tax".equals(codeString))
411        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.TAX, code);
412      if ("informational".equals(codeString))
413        return new Enumeration<InvoicePriceComponentType>(this, InvoicePriceComponentType.INFORMATIONAL, code);
414      throw new FHIRException("Unknown InvoicePriceComponentType code '" + codeString + "'");
415    }
416
417    public String toCode(InvoicePriceComponentType code) {
418      if (code == InvoicePriceComponentType.BASE)
419        return "base";
420      if (code == InvoicePriceComponentType.SURCHARGE)
421        return "surcharge";
422      if (code == InvoicePriceComponentType.DEDUCTION)
423        return "deduction";
424      if (code == InvoicePriceComponentType.DISCOUNT)
425        return "discount";
426      if (code == InvoicePriceComponentType.TAX)
427        return "tax";
428      if (code == InvoicePriceComponentType.INFORMATIONAL)
429        return "informational";
430      return "?";
431    }
432
433    public String toSystem(InvoicePriceComponentType code) {
434      return code.getSystem();
435    }
436  }
437
438  @Block()
439  public static class InvoiceParticipantComponent extends BackboneElement implements IBaseBackboneElement {
440    /**
441     * Describes the type of involvement (e.g. transcriptionist, creator etc.). If
442     * the invoice has been created automatically, the Participant may be a billing
443     * engine or another kind of device.
444     */
445    @Child(name = "role", type = {
446        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
447    @Description(shortDefinition = "Type of involvement in creation of this Invoice", formalDefinition = "Describes the type of involvement (e.g. transcriptionist, creator etc.). If the invoice has been created automatically, the Participant may be a billing engine or another kind of device.")
448    protected CodeableConcept role;
449
450    /**
451     * The device, practitioner, etc. who performed or participated in the service.
452     */
453    @Child(name = "actor", type = { Practitioner.class, Organization.class, Patient.class, PractitionerRole.class,
454        Device.class, RelatedPerson.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
455    @Description(shortDefinition = "Individual who was involved", formalDefinition = "The device, practitioner, etc. who performed or participated in the service.")
456    protected Reference actor;
457
458    /**
459     * The actual object that is the target of the reference (The device,
460     * practitioner, etc. who performed or participated in the service.)
461     */
462    protected Resource actorTarget;
463
464    private static final long serialVersionUID = 805521719L;
465
466    /**
467     * Constructor
468     */
469    public InvoiceParticipantComponent() {
470      super();
471    }
472
473    /**
474     * Constructor
475     */
476    public InvoiceParticipantComponent(Reference actor) {
477      super();
478      this.actor = actor;
479    }
480
481    /**
482     * @return {@link #role} (Describes the type of involvement (e.g.
483     *         transcriptionist, creator etc.). If the invoice has been created
484     *         automatically, the Participant may be a billing engine or another
485     *         kind of device.)
486     */
487    public CodeableConcept getRole() {
488      if (this.role == null)
489        if (Configuration.errorOnAutoCreate())
490          throw new Error("Attempt to auto-create InvoiceParticipantComponent.role");
491        else if (Configuration.doAutoCreate())
492          this.role = new CodeableConcept(); // cc
493      return this.role;
494    }
495
496    public boolean hasRole() {
497      return this.role != null && !this.role.isEmpty();
498    }
499
500    /**
501     * @param value {@link #role} (Describes the type of involvement (e.g.
502     *              transcriptionist, creator etc.). If the invoice has been created
503     *              automatically, the Participant may be a billing engine or
504     *              another kind of device.)
505     */
506    public InvoiceParticipantComponent setRole(CodeableConcept value) {
507      this.role = value;
508      return this;
509    }
510
511    /**
512     * @return {@link #actor} (The device, practitioner, etc. who performed or
513     *         participated in the service.)
514     */
515    public Reference getActor() {
516      if (this.actor == null)
517        if (Configuration.errorOnAutoCreate())
518          throw new Error("Attempt to auto-create InvoiceParticipantComponent.actor");
519        else if (Configuration.doAutoCreate())
520          this.actor = new Reference(); // cc
521      return this.actor;
522    }
523
524    public boolean hasActor() {
525      return this.actor != null && !this.actor.isEmpty();
526    }
527
528    /**
529     * @param value {@link #actor} (The device, practitioner, etc. who performed or
530     *              participated in the service.)
531     */
532    public InvoiceParticipantComponent setActor(Reference value) {
533      this.actor = value;
534      return this;
535    }
536
537    /**
538     * @return {@link #actor} The actual object that is the target of the reference.
539     *         The reference library doesn't populate this, but you can use it to
540     *         hold the resource if you resolve it. (The device, practitioner, etc.
541     *         who performed or participated in the service.)
542     */
543    public Resource getActorTarget() {
544      return this.actorTarget;
545    }
546
547    /**
548     * @param value {@link #actor} The actual object that is the target of the
549     *              reference. The reference library doesn't use these, but you can
550     *              use it to hold the resource if you resolve it. (The device,
551     *              practitioner, etc. who performed or participated in the
552     *              service.)
553     */
554    public InvoiceParticipantComponent setActorTarget(Resource value) {
555      this.actorTarget = value;
556      return this;
557    }
558
559    protected void listChildren(List<Property> children) {
560      super.listChildren(children);
561      children.add(new Property("role", "CodeableConcept",
562          "Describes the type of involvement (e.g. transcriptionist, creator etc.). If the invoice has been created automatically, the Participant may be a billing engine or another kind of device.",
563          0, 1, role));
564      children.add(
565          new Property("actor", "Reference(Practitioner|Organization|Patient|PractitionerRole|Device|RelatedPerson)",
566              "The device, practitioner, etc. who performed or participated in the service.", 0, 1, actor));
567    }
568
569    @Override
570    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
571      switch (_hash) {
572      case 3506294:
573        /* role */ return new Property("role", "CodeableConcept",
574            "Describes the type of involvement (e.g. transcriptionist, creator etc.). If the invoice has been created automatically, the Participant may be a billing engine or another kind of device.",
575            0, 1, role);
576      case 92645877:
577        /* actor */ return new Property("actor",
578            "Reference(Practitioner|Organization|Patient|PractitionerRole|Device|RelatedPerson)",
579            "The device, practitioner, etc. who performed or participated in the service.", 0, 1, actor);
580      default:
581        return super.getNamedProperty(_hash, _name, _checkValid);
582      }
583
584    }
585
586    @Override
587    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
588      switch (hash) {
589      case 3506294:
590        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
591      case 92645877:
592        /* actor */ return this.actor == null ? new Base[0] : new Base[] { this.actor }; // Reference
593      default:
594        return super.getProperty(hash, name, checkValid);
595      }
596
597    }
598
599    @Override
600    public Base setProperty(int hash, String name, Base value) throws FHIRException {
601      switch (hash) {
602      case 3506294: // role
603        this.role = castToCodeableConcept(value); // CodeableConcept
604        return value;
605      case 92645877: // actor
606        this.actor = castToReference(value); // Reference
607        return value;
608      default:
609        return super.setProperty(hash, name, value);
610      }
611
612    }
613
614    @Override
615    public Base setProperty(String name, Base value) throws FHIRException {
616      if (name.equals("role")) {
617        this.role = castToCodeableConcept(value); // CodeableConcept
618      } else if (name.equals("actor")) {
619        this.actor = castToReference(value); // Reference
620      } else
621        return super.setProperty(name, value);
622      return value;
623    }
624
625    @Override
626    public Base makeProperty(int hash, String name) throws FHIRException {
627      switch (hash) {
628      case 3506294:
629        return getRole();
630      case 92645877:
631        return getActor();
632      default:
633        return super.makeProperty(hash, name);
634      }
635
636    }
637
638    @Override
639    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
640      switch (hash) {
641      case 3506294:
642        /* role */ return new String[] { "CodeableConcept" };
643      case 92645877:
644        /* actor */ return new String[] { "Reference" };
645      default:
646        return super.getTypesForProperty(hash, name);
647      }
648
649    }
650
651    @Override
652    public Base addChild(String name) throws FHIRException {
653      if (name.equals("role")) {
654        this.role = new CodeableConcept();
655        return this.role;
656      } else if (name.equals("actor")) {
657        this.actor = new Reference();
658        return this.actor;
659      } else
660        return super.addChild(name);
661    }
662
663    public InvoiceParticipantComponent copy() {
664      InvoiceParticipantComponent dst = new InvoiceParticipantComponent();
665      copyValues(dst);
666      return dst;
667    }
668
669    public void copyValues(InvoiceParticipantComponent dst) {
670      super.copyValues(dst);
671      dst.role = role == null ? null : role.copy();
672      dst.actor = actor == null ? null : actor.copy();
673    }
674
675    @Override
676    public boolean equalsDeep(Base other_) {
677      if (!super.equalsDeep(other_))
678        return false;
679      if (!(other_ instanceof InvoiceParticipantComponent))
680        return false;
681      InvoiceParticipantComponent o = (InvoiceParticipantComponent) other_;
682      return compareDeep(role, o.role, true) && compareDeep(actor, o.actor, true);
683    }
684
685    @Override
686    public boolean equalsShallow(Base other_) {
687      if (!super.equalsShallow(other_))
688        return false;
689      if (!(other_ instanceof InvoiceParticipantComponent))
690        return false;
691      InvoiceParticipantComponent o = (InvoiceParticipantComponent) other_;
692      return true;
693    }
694
695    public boolean isEmpty() {
696      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, actor);
697    }
698
699    public String fhirType() {
700      return "Invoice.participant";
701
702    }
703
704  }
705
706  @Block()
707  public static class InvoiceLineItemComponent extends BackboneElement implements IBaseBackboneElement {
708    /**
709     * Sequence in which the items appear on the invoice.
710     */
711    @Child(name = "sequence", type = {
712        PositiveIntType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
713    @Description(shortDefinition = "Sequence number of line item", formalDefinition = "Sequence in which the items appear on the invoice.")
714    protected PositiveIntType sequence;
715
716    /**
717     * The ChargeItem contains information such as the billing code, date, amount
718     * etc. If no further details are required for the lineItem, inline billing
719     * codes can be added using the CodeableConcept data type instead of the
720     * Reference.
721     */
722    @Child(name = "chargeItem", type = { ChargeItem.class,
723        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
724    @Description(shortDefinition = "Reference to ChargeItem containing details of this line item or an inline billing code", formalDefinition = "The ChargeItem contains information such as the billing code, date, amount etc. If no further details are required for the lineItem, inline billing codes can be added using the CodeableConcept data type instead of the Reference.")
725    protected Type chargeItem;
726
727    /**
728     * The price for a ChargeItem may be calculated as a base price with
729     * surcharges/deductions that apply in certain conditions. A
730     * ChargeItemDefinition resource that defines the prices, factors and conditions
731     * that apply to a billing code is currently under development. The
732     * priceComponent element can be used to offer transparency to the recipient of
733     * the Invoice as to how the prices have been calculated.
734     */
735    @Child(name = "priceComponent", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
736    @Description(shortDefinition = "Components of total line item price", formalDefinition = "The price for a ChargeItem may be calculated as a base price with surcharges/deductions that apply in certain conditions. A ChargeItemDefinition resource that defines the prices, factors and conditions that apply to a billing code is currently under development. The priceComponent element can be used to offer transparency to the recipient of the Invoice as to how the prices have been calculated.")
737    protected List<InvoiceLineItemPriceComponentComponent> priceComponent;
738
739    private static final long serialVersionUID = -1013610189L;
740
741    /**
742     * Constructor
743     */
744    public InvoiceLineItemComponent() {
745      super();
746    }
747
748    /**
749     * Constructor
750     */
751    public InvoiceLineItemComponent(Type chargeItem) {
752      super();
753      this.chargeItem = chargeItem;
754    }
755
756    /**
757     * @return {@link #sequence} (Sequence in which the items appear on the
758     *         invoice.). This is the underlying object with id, value and
759     *         extensions. The accessor "getSequence" gives direct access to the
760     *         value
761     */
762    public PositiveIntType getSequenceElement() {
763      if (this.sequence == null)
764        if (Configuration.errorOnAutoCreate())
765          throw new Error("Attempt to auto-create InvoiceLineItemComponent.sequence");
766        else if (Configuration.doAutoCreate())
767          this.sequence = new PositiveIntType(); // bb
768      return this.sequence;
769    }
770
771    public boolean hasSequenceElement() {
772      return this.sequence != null && !this.sequence.isEmpty();
773    }
774
775    public boolean hasSequence() {
776      return this.sequence != null && !this.sequence.isEmpty();
777    }
778
779    /**
780     * @param value {@link #sequence} (Sequence in which the items appear on the
781     *              invoice.). This is the underlying object with id, value and
782     *              extensions. The accessor "getSequence" gives direct access to
783     *              the value
784     */
785    public InvoiceLineItemComponent setSequenceElement(PositiveIntType value) {
786      this.sequence = value;
787      return this;
788    }
789
790    /**
791     * @return Sequence in which the items appear on the invoice.
792     */
793    public int getSequence() {
794      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
795    }
796
797    /**
798     * @param value Sequence in which the items appear on the invoice.
799     */
800    public InvoiceLineItemComponent setSequence(int value) {
801      if (this.sequence == null)
802        this.sequence = new PositiveIntType();
803      this.sequence.setValue(value);
804      return this;
805    }
806
807    /**
808     * @return {@link #chargeItem} (The ChargeItem contains information such as the
809     *         billing code, date, amount etc. If no further details are required
810     *         for the lineItem, inline billing codes can be added using the
811     *         CodeableConcept data type instead of the Reference.)
812     */
813    public Type getChargeItem() {
814      return this.chargeItem;
815    }
816
817    /**
818     * @return {@link #chargeItem} (The ChargeItem contains information such as the
819     *         billing code, date, amount etc. If no further details are required
820     *         for the lineItem, inline billing codes can be added using the
821     *         CodeableConcept data type instead of the Reference.)
822     */
823    public Reference getChargeItemReference() throws FHIRException {
824      if (this.chargeItem == null)
825        this.chargeItem = new Reference();
826      if (!(this.chargeItem instanceof Reference))
827        throw new FHIRException("Type mismatch: the type Reference was expected, but "
828            + this.chargeItem.getClass().getName() + " was encountered");
829      return (Reference) this.chargeItem;
830    }
831
832    public boolean hasChargeItemReference() {
833      return this != null && this.chargeItem instanceof Reference;
834    }
835
836    /**
837     * @return {@link #chargeItem} (The ChargeItem contains information such as the
838     *         billing code, date, amount etc. If no further details are required
839     *         for the lineItem, inline billing codes can be added using the
840     *         CodeableConcept data type instead of the Reference.)
841     */
842    public CodeableConcept getChargeItemCodeableConcept() throws FHIRException {
843      if (this.chargeItem == null)
844        this.chargeItem = new CodeableConcept();
845      if (!(this.chargeItem instanceof CodeableConcept))
846        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
847            + this.chargeItem.getClass().getName() + " was encountered");
848      return (CodeableConcept) this.chargeItem;
849    }
850
851    public boolean hasChargeItemCodeableConcept() {
852      return this != null && this.chargeItem instanceof CodeableConcept;
853    }
854
855    public boolean hasChargeItem() {
856      return this.chargeItem != null && !this.chargeItem.isEmpty();
857    }
858
859    /**
860     * @param value {@link #chargeItem} (The ChargeItem contains information such as
861     *              the billing code, date, amount etc. If no further details are
862     *              required for the lineItem, inline billing codes can be added
863     *              using the CodeableConcept data type instead of the Reference.)
864     */
865    public InvoiceLineItemComponent setChargeItem(Type value) {
866      if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
867        throw new Error("Not the right type for Invoice.lineItem.chargeItem[x]: " + value.fhirType());
868      this.chargeItem = value;
869      return this;
870    }
871
872    /**
873     * @return {@link #priceComponent} (The price for a ChargeItem may be calculated
874     *         as a base price with surcharges/deductions that apply in certain
875     *         conditions. A ChargeItemDefinition resource that defines the prices,
876     *         factors and conditions that apply to a billing code is currently
877     *         under development. The priceComponent element can be used to offer
878     *         transparency to the recipient of the Invoice as to how the prices
879     *         have been calculated.)
880     */
881    public List<InvoiceLineItemPriceComponentComponent> getPriceComponent() {
882      if (this.priceComponent == null)
883        this.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
884      return this.priceComponent;
885    }
886
887    /**
888     * @return Returns a reference to <code>this</code> for easy method chaining
889     */
890    public InvoiceLineItemComponent setPriceComponent(List<InvoiceLineItemPriceComponentComponent> thePriceComponent) {
891      this.priceComponent = thePriceComponent;
892      return this;
893    }
894
895    public boolean hasPriceComponent() {
896      if (this.priceComponent == null)
897        return false;
898      for (InvoiceLineItemPriceComponentComponent item : this.priceComponent)
899        if (!item.isEmpty())
900          return true;
901      return false;
902    }
903
904    public InvoiceLineItemPriceComponentComponent addPriceComponent() { // 3
905      InvoiceLineItemPriceComponentComponent t = new InvoiceLineItemPriceComponentComponent();
906      if (this.priceComponent == null)
907        this.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
908      this.priceComponent.add(t);
909      return t;
910    }
911
912    public InvoiceLineItemComponent addPriceComponent(InvoiceLineItemPriceComponentComponent t) { // 3
913      if (t == null)
914        return this;
915      if (this.priceComponent == null)
916        this.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
917      this.priceComponent.add(t);
918      return this;
919    }
920
921    /**
922     * @return The first repetition of repeating field {@link #priceComponent},
923     *         creating it if it does not already exist
924     */
925    public InvoiceLineItemPriceComponentComponent getPriceComponentFirstRep() {
926      if (getPriceComponent().isEmpty()) {
927        addPriceComponent();
928      }
929      return getPriceComponent().get(0);
930    }
931
932    protected void listChildren(List<Property> children) {
933      super.listChildren(children);
934      children.add(new Property("sequence", "positiveInt", "Sequence in which the items appear on the invoice.", 0, 1,
935          sequence));
936      children.add(new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept",
937          "The ChargeItem contains information such as the billing code, date, amount etc. If no further details are required for the lineItem, inline billing codes can be added using the CodeableConcept data type instead of the Reference.",
938          0, 1, chargeItem));
939      children.add(new Property("priceComponent", "",
940          "The price for a ChargeItem may be calculated as a base price with surcharges/deductions that apply in certain conditions. A ChargeItemDefinition resource that defines the prices, factors and conditions that apply to a billing code is currently under development. The priceComponent element can be used to offer transparency to the recipient of the Invoice as to how the prices have been calculated.",
941          0, java.lang.Integer.MAX_VALUE, priceComponent));
942    }
943
944    @Override
945    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
946      switch (_hash) {
947      case 1349547969:
948        /* sequence */ return new Property("sequence", "positiveInt",
949            "Sequence in which the items appear on the invoice.", 0, 1, sequence);
950      case 351104825:
951        /* chargeItem[x] */ return new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept",
952            "The ChargeItem contains information such as the billing code, date, amount etc. If no further details are required for the lineItem, inline billing codes can be added using the CodeableConcept data type instead of the Reference.",
953            0, 1, chargeItem);
954      case 1417779175:
955        /* chargeItem */ return new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept",
956            "The ChargeItem contains information such as the billing code, date, amount etc. If no further details are required for the lineItem, inline billing codes can be added using the CodeableConcept data type instead of the Reference.",
957            0, 1, chargeItem);
958      case 753580836:
959        /* chargeItemReference */ return new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept",
960            "The ChargeItem contains information such as the billing code, date, amount etc. If no further details are required for the lineItem, inline billing codes can be added using the CodeableConcept data type instead of the Reference.",
961            0, 1, chargeItem);
962      case 1226532026:
963        /* chargeItemCodeableConcept */ return new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept",
964            "The ChargeItem contains information such as the billing code, date, amount etc. If no further details are required for the lineItem, inline billing codes can be added using the CodeableConcept data type instead of the Reference.",
965            0, 1, chargeItem);
966      case 1219095988:
967        /* priceComponent */ return new Property("priceComponent", "",
968            "The price for a ChargeItem may be calculated as a base price with surcharges/deductions that apply in certain conditions. A ChargeItemDefinition resource that defines the prices, factors and conditions that apply to a billing code is currently under development. The priceComponent element can be used to offer transparency to the recipient of the Invoice as to how the prices have been calculated.",
969            0, java.lang.Integer.MAX_VALUE, priceComponent);
970      default:
971        return super.getNamedProperty(_hash, _name, _checkValid);
972      }
973
974    }
975
976    @Override
977    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
978      switch (hash) {
979      case 1349547969:
980        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
981      case 1417779175:
982        /* chargeItem */ return this.chargeItem == null ? new Base[0] : new Base[] { this.chargeItem }; // Type
983      case 1219095988:
984        /* priceComponent */ return this.priceComponent == null ? new Base[0]
985            : this.priceComponent.toArray(new Base[this.priceComponent.size()]); // InvoiceLineItemPriceComponentComponent
986      default:
987        return super.getProperty(hash, name, checkValid);
988      }
989
990    }
991
992    @Override
993    public Base setProperty(int hash, String name, Base value) throws FHIRException {
994      switch (hash) {
995      case 1349547969: // sequence
996        this.sequence = castToPositiveInt(value); // PositiveIntType
997        return value;
998      case 1417779175: // chargeItem
999        this.chargeItem = castToType(value); // Type
1000        return value;
1001      case 1219095988: // priceComponent
1002        this.getPriceComponent().add((InvoiceLineItemPriceComponentComponent) value); // InvoiceLineItemPriceComponentComponent
1003        return value;
1004      default:
1005        return super.setProperty(hash, name, value);
1006      }
1007
1008    }
1009
1010    @Override
1011    public Base setProperty(String name, Base value) throws FHIRException {
1012      if (name.equals("sequence")) {
1013        this.sequence = castToPositiveInt(value); // PositiveIntType
1014      } else if (name.equals("chargeItem[x]")) {
1015        this.chargeItem = castToType(value); // Type
1016      } else if (name.equals("priceComponent")) {
1017        this.getPriceComponent().add((InvoiceLineItemPriceComponentComponent) value);
1018      } else
1019        return super.setProperty(name, value);
1020      return value;
1021    }
1022
1023    @Override
1024    public Base makeProperty(int hash, String name) throws FHIRException {
1025      switch (hash) {
1026      case 1349547969:
1027        return getSequenceElement();
1028      case 351104825:
1029        return getChargeItem();
1030      case 1417779175:
1031        return getChargeItem();
1032      case 1219095988:
1033        return addPriceComponent();
1034      default:
1035        return super.makeProperty(hash, name);
1036      }
1037
1038    }
1039
1040    @Override
1041    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1042      switch (hash) {
1043      case 1349547969:
1044        /* sequence */ return new String[] { "positiveInt" };
1045      case 1417779175:
1046        /* chargeItem */ return new String[] { "Reference", "CodeableConcept" };
1047      case 1219095988:
1048        /* priceComponent */ return new String[] {};
1049      default:
1050        return super.getTypesForProperty(hash, name);
1051      }
1052
1053    }
1054
1055    @Override
1056    public Base addChild(String name) throws FHIRException {
1057      if (name.equals("sequence")) {
1058        throw new FHIRException("Cannot call addChild on a singleton property Invoice.sequence");
1059      } else if (name.equals("chargeItemReference")) {
1060        this.chargeItem = new Reference();
1061        return this.chargeItem;
1062      } else if (name.equals("chargeItemCodeableConcept")) {
1063        this.chargeItem = new CodeableConcept();
1064        return this.chargeItem;
1065      } else if (name.equals("priceComponent")) {
1066        return addPriceComponent();
1067      } else
1068        return super.addChild(name);
1069    }
1070
1071    public InvoiceLineItemComponent copy() {
1072      InvoiceLineItemComponent dst = new InvoiceLineItemComponent();
1073      copyValues(dst);
1074      return dst;
1075    }
1076
1077    public void copyValues(InvoiceLineItemComponent dst) {
1078      super.copyValues(dst);
1079      dst.sequence = sequence == null ? null : sequence.copy();
1080      dst.chargeItem = chargeItem == null ? null : chargeItem.copy();
1081      if (priceComponent != null) {
1082        dst.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
1083        for (InvoiceLineItemPriceComponentComponent i : priceComponent)
1084          dst.priceComponent.add(i.copy());
1085      }
1086      ;
1087    }
1088
1089    @Override
1090    public boolean equalsDeep(Base other_) {
1091      if (!super.equalsDeep(other_))
1092        return false;
1093      if (!(other_ instanceof InvoiceLineItemComponent))
1094        return false;
1095      InvoiceLineItemComponent o = (InvoiceLineItemComponent) other_;
1096      return compareDeep(sequence, o.sequence, true) && compareDeep(chargeItem, o.chargeItem, true)
1097          && compareDeep(priceComponent, o.priceComponent, true);
1098    }
1099
1100    @Override
1101    public boolean equalsShallow(Base other_) {
1102      if (!super.equalsShallow(other_))
1103        return false;
1104      if (!(other_ instanceof InvoiceLineItemComponent))
1105        return false;
1106      InvoiceLineItemComponent o = (InvoiceLineItemComponent) other_;
1107      return compareValues(sequence, o.sequence, true);
1108    }
1109
1110    public boolean isEmpty() {
1111      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, chargeItem, priceComponent);
1112    }
1113
1114    public String fhirType() {
1115      return "Invoice.lineItem";
1116
1117    }
1118
1119  }
1120
1121  @Block()
1122  public static class InvoiceLineItemPriceComponentComponent extends BackboneElement implements IBaseBackboneElement {
1123    /**
1124     * This code identifies the type of the component.
1125     */
1126    @Child(name = "type", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1127    @Description(shortDefinition = "base | surcharge | deduction | discount | tax | informational", formalDefinition = "This code identifies the type of the component.")
1128    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/invoice-priceComponentType")
1129    protected Enumeration<InvoicePriceComponentType> type;
1130
1131    /**
1132     * A code that identifies the component. Codes may be used to differentiate
1133     * between kinds of taxes, surcharges, discounts etc.
1134     */
1135    @Child(name = "code", type = {
1136        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1137    @Description(shortDefinition = "Code identifying the specific component", formalDefinition = "A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.")
1138    protected CodeableConcept code;
1139
1140    /**
1141     * The factor that has been applied on the base price for calculating this
1142     * component.
1143     */
1144    @Child(name = "factor", type = {
1145        DecimalType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1146    @Description(shortDefinition = "Factor used for calculating this component", formalDefinition = "The factor that has been applied on the base price for calculating this component.")
1147    protected DecimalType factor;
1148
1149    /**
1150     * The amount calculated for this component.
1151     */
1152    @Child(name = "amount", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1153    @Description(shortDefinition = "Monetary amount associated with this component", formalDefinition = "The amount calculated for this component.")
1154    protected Money amount;
1155
1156    private static final long serialVersionUID = 1223988958L;
1157
1158    /**
1159     * Constructor
1160     */
1161    public InvoiceLineItemPriceComponentComponent() {
1162      super();
1163    }
1164
1165    /**
1166     * Constructor
1167     */
1168    public InvoiceLineItemPriceComponentComponent(Enumeration<InvoicePriceComponentType> type) {
1169      super();
1170      this.type = type;
1171    }
1172
1173    /**
1174     * @return {@link #type} (This code identifies the type of the component.). This
1175     *         is the underlying object with id, value and extensions. The accessor
1176     *         "getType" gives direct access to the value
1177     */
1178    public Enumeration<InvoicePriceComponentType> getTypeElement() {
1179      if (this.type == null)
1180        if (Configuration.errorOnAutoCreate())
1181          throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.type");
1182        else if (Configuration.doAutoCreate())
1183          this.type = new Enumeration<InvoicePriceComponentType>(new InvoicePriceComponentTypeEnumFactory()); // bb
1184      return this.type;
1185    }
1186
1187    public boolean hasTypeElement() {
1188      return this.type != null && !this.type.isEmpty();
1189    }
1190
1191    public boolean hasType() {
1192      return this.type != null && !this.type.isEmpty();
1193    }
1194
1195    /**
1196     * @param value {@link #type} (This code identifies the type of the component.).
1197     *              This is the underlying object with id, value and extensions. The
1198     *              accessor "getType" gives direct access to the value
1199     */
1200    public InvoiceLineItemPriceComponentComponent setTypeElement(Enumeration<InvoicePriceComponentType> value) {
1201      this.type = value;
1202      return this;
1203    }
1204
1205    /**
1206     * @return This code identifies the type of the component.
1207     */
1208    public InvoicePriceComponentType getType() {
1209      return this.type == null ? null : this.type.getValue();
1210    }
1211
1212    /**
1213     * @param value This code identifies the type of the component.
1214     */
1215    public InvoiceLineItemPriceComponentComponent setType(InvoicePriceComponentType value) {
1216      if (this.type == null)
1217        this.type = new Enumeration<InvoicePriceComponentType>(new InvoicePriceComponentTypeEnumFactory());
1218      this.type.setValue(value);
1219      return this;
1220    }
1221
1222    /**
1223     * @return {@link #code} (A code that identifies the component. Codes may be
1224     *         used to differentiate between kinds of taxes, surcharges, discounts
1225     *         etc.)
1226     */
1227    public CodeableConcept getCode() {
1228      if (this.code == null)
1229        if (Configuration.errorOnAutoCreate())
1230          throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.code");
1231        else if (Configuration.doAutoCreate())
1232          this.code = new CodeableConcept(); // cc
1233      return this.code;
1234    }
1235
1236    public boolean hasCode() {
1237      return this.code != null && !this.code.isEmpty();
1238    }
1239
1240    /**
1241     * @param value {@link #code} (A code that identifies the component. Codes may
1242     *              be used to differentiate between kinds of taxes, surcharges,
1243     *              discounts etc.)
1244     */
1245    public InvoiceLineItemPriceComponentComponent setCode(CodeableConcept value) {
1246      this.code = value;
1247      return this;
1248    }
1249
1250    /**
1251     * @return {@link #factor} (The factor that has been applied on the base price
1252     *         for calculating this component.). This is the underlying object with
1253     *         id, value and extensions. The accessor "getFactor" gives direct
1254     *         access to the value
1255     */
1256    public DecimalType getFactorElement() {
1257      if (this.factor == null)
1258        if (Configuration.errorOnAutoCreate())
1259          throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.factor");
1260        else if (Configuration.doAutoCreate())
1261          this.factor = new DecimalType(); // bb
1262      return this.factor;
1263    }
1264
1265    public boolean hasFactorElement() {
1266      return this.factor != null && !this.factor.isEmpty();
1267    }
1268
1269    public boolean hasFactor() {
1270      return this.factor != null && !this.factor.isEmpty();
1271    }
1272
1273    /**
1274     * @param value {@link #factor} (The factor that has been applied on the base
1275     *              price for calculating this component.). This is the underlying
1276     *              object with id, value and extensions. The accessor "getFactor"
1277     *              gives direct access to the value
1278     */
1279    public InvoiceLineItemPriceComponentComponent setFactorElement(DecimalType value) {
1280      this.factor = value;
1281      return this;
1282    }
1283
1284    /**
1285     * @return The factor that has been applied on the base price for calculating
1286     *         this component.
1287     */
1288    public BigDecimal getFactor() {
1289      return this.factor == null ? null : this.factor.getValue();
1290    }
1291
1292    /**
1293     * @param value The factor that has been applied on the base price for
1294     *              calculating this component.
1295     */
1296    public InvoiceLineItemPriceComponentComponent setFactor(BigDecimal value) {
1297      if (value == null)
1298        this.factor = null;
1299      else {
1300        if (this.factor == null)
1301          this.factor = new DecimalType();
1302        this.factor.setValue(value);
1303      }
1304      return this;
1305    }
1306
1307    /**
1308     * @param value The factor that has been applied on the base price for
1309     *              calculating this component.
1310     */
1311    public InvoiceLineItemPriceComponentComponent setFactor(long value) {
1312      this.factor = new DecimalType();
1313      this.factor.setValue(value);
1314      return this;
1315    }
1316
1317    /**
1318     * @param value The factor that has been applied on the base price for
1319     *              calculating this component.
1320     */
1321    public InvoiceLineItemPriceComponentComponent setFactor(double value) {
1322      this.factor = new DecimalType();
1323      this.factor.setValue(value);
1324      return this;
1325    }
1326
1327    /**
1328     * @return {@link #amount} (The amount calculated for this component.)
1329     */
1330    public Money getAmount() {
1331      if (this.amount == null)
1332        if (Configuration.errorOnAutoCreate())
1333          throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.amount");
1334        else if (Configuration.doAutoCreate())
1335          this.amount = new Money(); // cc
1336      return this.amount;
1337    }
1338
1339    public boolean hasAmount() {
1340      return this.amount != null && !this.amount.isEmpty();
1341    }
1342
1343    /**
1344     * @param value {@link #amount} (The amount calculated for this component.)
1345     */
1346    public InvoiceLineItemPriceComponentComponent setAmount(Money value) {
1347      this.amount = value;
1348      return this;
1349    }
1350
1351    protected void listChildren(List<Property> children) {
1352      super.listChildren(children);
1353      children.add(new Property("type", "code", "This code identifies the type of the component.", 0, 1, type));
1354      children.add(new Property("code", "CodeableConcept",
1355          "A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.",
1356          0, 1, code));
1357      children.add(new Property("factor", "decimal",
1358          "The factor that has been applied on the base price for calculating this component.", 0, 1, factor));
1359      children.add(new Property("amount", "Money", "The amount calculated for this component.", 0, 1, amount));
1360    }
1361
1362    @Override
1363    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1364      switch (_hash) {
1365      case 3575610:
1366        /* type */ return new Property("type", "code", "This code identifies the type of the component.", 0, 1, type);
1367      case 3059181:
1368        /* code */ return new Property("code", "CodeableConcept",
1369            "A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.",
1370            0, 1, code);
1371      case -1282148017:
1372        /* factor */ return new Property("factor", "decimal",
1373            "The factor that has been applied on the base price for calculating this component.", 0, 1, factor);
1374      case -1413853096:
1375        /* amount */ return new Property("amount", "Money", "The amount calculated for this component.", 0, 1, amount);
1376      default:
1377        return super.getNamedProperty(_hash, _name, _checkValid);
1378      }
1379
1380    }
1381
1382    @Override
1383    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1384      switch (hash) {
1385      case 3575610:
1386        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<InvoicePriceComponentType>
1387      case 3059181:
1388        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
1389      case -1282148017:
1390        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
1391      case -1413853096:
1392        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
1393      default:
1394        return super.getProperty(hash, name, checkValid);
1395      }
1396
1397    }
1398
1399    @Override
1400    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1401      switch (hash) {
1402      case 3575610: // type
1403        value = new InvoicePriceComponentTypeEnumFactory().fromType(castToCode(value));
1404        this.type = (Enumeration) value; // Enumeration<InvoicePriceComponentType>
1405        return value;
1406      case 3059181: // code
1407        this.code = castToCodeableConcept(value); // CodeableConcept
1408        return value;
1409      case -1282148017: // factor
1410        this.factor = castToDecimal(value); // DecimalType
1411        return value;
1412      case -1413853096: // amount
1413        this.amount = castToMoney(value); // Money
1414        return value;
1415      default:
1416        return super.setProperty(hash, name, value);
1417      }
1418
1419    }
1420
1421    @Override
1422    public Base setProperty(String name, Base value) throws FHIRException {
1423      if (name.equals("type")) {
1424        value = new InvoicePriceComponentTypeEnumFactory().fromType(castToCode(value));
1425        this.type = (Enumeration) value; // Enumeration<InvoicePriceComponentType>
1426      } else if (name.equals("code")) {
1427        this.code = castToCodeableConcept(value); // CodeableConcept
1428      } else if (name.equals("factor")) {
1429        this.factor = castToDecimal(value); // DecimalType
1430      } else if (name.equals("amount")) {
1431        this.amount = castToMoney(value); // Money
1432      } else
1433        return super.setProperty(name, value);
1434      return value;
1435    }
1436
1437    @Override
1438    public Base makeProperty(int hash, String name) throws FHIRException {
1439      switch (hash) {
1440      case 3575610:
1441        return getTypeElement();
1442      case 3059181:
1443        return getCode();
1444      case -1282148017:
1445        return getFactorElement();
1446      case -1413853096:
1447        return getAmount();
1448      default:
1449        return super.makeProperty(hash, name);
1450      }
1451
1452    }
1453
1454    @Override
1455    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1456      switch (hash) {
1457      case 3575610:
1458        /* type */ return new String[] { "code" };
1459      case 3059181:
1460        /* code */ return new String[] { "CodeableConcept" };
1461      case -1282148017:
1462        /* factor */ return new String[] { "decimal" };
1463      case -1413853096:
1464        /* amount */ return new String[] { "Money" };
1465      default:
1466        return super.getTypesForProperty(hash, name);
1467      }
1468
1469    }
1470
1471    @Override
1472    public Base addChild(String name) throws FHIRException {
1473      if (name.equals("type")) {
1474        throw new FHIRException("Cannot call addChild on a singleton property Invoice.type");
1475      } else if (name.equals("code")) {
1476        this.code = new CodeableConcept();
1477        return this.code;
1478      } else if (name.equals("factor")) {
1479        throw new FHIRException("Cannot call addChild on a singleton property Invoice.factor");
1480      } else if (name.equals("amount")) {
1481        this.amount = new Money();
1482        return this.amount;
1483      } else
1484        return super.addChild(name);
1485    }
1486
1487    public InvoiceLineItemPriceComponentComponent copy() {
1488      InvoiceLineItemPriceComponentComponent dst = new InvoiceLineItemPriceComponentComponent();
1489      copyValues(dst);
1490      return dst;
1491    }
1492
1493    public void copyValues(InvoiceLineItemPriceComponentComponent dst) {
1494      super.copyValues(dst);
1495      dst.type = type == null ? null : type.copy();
1496      dst.code = code == null ? null : code.copy();
1497      dst.factor = factor == null ? null : factor.copy();
1498      dst.amount = amount == null ? null : amount.copy();
1499    }
1500
1501    @Override
1502    public boolean equalsDeep(Base other_) {
1503      if (!super.equalsDeep(other_))
1504        return false;
1505      if (!(other_ instanceof InvoiceLineItemPriceComponentComponent))
1506        return false;
1507      InvoiceLineItemPriceComponentComponent o = (InvoiceLineItemPriceComponentComponent) other_;
1508      return compareDeep(type, o.type, true) && compareDeep(code, o.code, true) && compareDeep(factor, o.factor, true)
1509          && compareDeep(amount, o.amount, true);
1510    }
1511
1512    @Override
1513    public boolean equalsShallow(Base other_) {
1514      if (!super.equalsShallow(other_))
1515        return false;
1516      if (!(other_ instanceof InvoiceLineItemPriceComponentComponent))
1517        return false;
1518      InvoiceLineItemPriceComponentComponent o = (InvoiceLineItemPriceComponentComponent) other_;
1519      return compareValues(type, o.type, true) && compareValues(factor, o.factor, true);
1520    }
1521
1522    public boolean isEmpty() {
1523      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, code, factor, amount);
1524    }
1525
1526    public String fhirType() {
1527      return "Invoice.lineItem.priceComponent";
1528
1529    }
1530
1531  }
1532
1533  /**
1534   * Identifier of this Invoice, often used for reference in correspondence about
1535   * this invoice or for tracking of payments.
1536   */
1537  @Child(name = "identifier", type = {
1538      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1539  @Description(shortDefinition = "Business Identifier for item", formalDefinition = "Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.")
1540  protected List<Identifier> identifier;
1541
1542  /**
1543   * The current state of the Invoice.
1544   */
1545  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
1546  @Description(shortDefinition = "draft | issued | balanced | cancelled | entered-in-error", formalDefinition = "The current state of the Invoice.")
1547  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/invoice-status")
1548  protected Enumeration<InvoiceStatus> status;
1549
1550  /**
1551   * In case of Invoice cancellation a reason must be given (entered in error,
1552   * superseded by corrected invoice etc.).
1553   */
1554  @Child(name = "cancelledReason", type = {
1555      StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1556  @Description(shortDefinition = "Reason for cancellation of this Invoice", formalDefinition = "In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).")
1557  protected StringType cancelledReason;
1558
1559  /**
1560   * Type of Invoice depending on domain, realm an usage (e.g. internal/external,
1561   * dental, preliminary).
1562   */
1563  @Child(name = "type", type = { CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1564  @Description(shortDefinition = "Type of Invoice", formalDefinition = "Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).")
1565  protected CodeableConcept type;
1566
1567  /**
1568   * The individual or set of individuals receiving the goods and services billed
1569   * in this invoice.
1570   */
1571  @Child(name = "subject", type = { Patient.class,
1572      Group.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1573  @Description(shortDefinition = "Recipient(s) of goods and services", formalDefinition = "The individual or set of individuals receiving the goods and services billed in this invoice.")
1574  protected Reference subject;
1575
1576  /**
1577   * The actual object that is the target of the reference (The individual or set
1578   * of individuals receiving the goods and services billed in this invoice.)
1579   */
1580  protected Resource subjectTarget;
1581
1582  /**
1583   * The individual or Organization responsible for balancing of this invoice.
1584   */
1585  @Child(name = "recipient", type = { Organization.class, Patient.class,
1586      RelatedPerson.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1587  @Description(shortDefinition = "Recipient of this invoice", formalDefinition = "The individual or Organization responsible for balancing of this invoice.")
1588  protected Reference recipient;
1589
1590  /**
1591   * The actual object that is the target of the reference (The individual or
1592   * Organization responsible for balancing of this invoice.)
1593   */
1594  protected Resource recipientTarget;
1595
1596  /**
1597   * Date/time(s) of when this Invoice was posted.
1598   */
1599  @Child(name = "date", type = { DateTimeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1600  @Description(shortDefinition = "Invoice date / posting date", formalDefinition = "Date/time(s) of when this Invoice was posted.")
1601  protected DateTimeType date;
1602
1603  /**
1604   * Indicates who or what performed or participated in the charged service.
1605   */
1606  @Child(name = "participant", type = {}, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1607  @Description(shortDefinition = "Participant in creation of this Invoice", formalDefinition = "Indicates who or what performed or participated in the charged service.")
1608  protected List<InvoiceParticipantComponent> participant;
1609
1610  /**
1611   * The organizationissuing the Invoice.
1612   */
1613  @Child(name = "issuer", type = { Organization.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
1614  @Description(shortDefinition = "Issuing Organization of Invoice", formalDefinition = "The organizationissuing the Invoice.")
1615  protected Reference issuer;
1616
1617  /**
1618   * The actual object that is the target of the reference (The
1619   * organizationissuing the Invoice.)
1620   */
1621  protected Organization issuerTarget;
1622
1623  /**
1624   * Account which is supposed to be balanced with this Invoice.
1625   */
1626  @Child(name = "account", type = { Account.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
1627  @Description(shortDefinition = "Account that is being balanced", formalDefinition = "Account which is supposed to be balanced with this Invoice.")
1628  protected Reference account;
1629
1630  /**
1631   * The actual object that is the target of the reference (Account which is
1632   * supposed to be balanced with this Invoice.)
1633   */
1634  protected Account accountTarget;
1635
1636  /**
1637   * Each line item represents one charge for goods and services rendered. Details
1638   * such as date, code and amount are found in the referenced ChargeItem
1639   * resource.
1640   */
1641  @Child(name = "lineItem", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1642  @Description(shortDefinition = "Line items of this Invoice", formalDefinition = "Each line item represents one charge for goods and services rendered. Details such as date, code and amount are found in the referenced ChargeItem resource.")
1643  protected List<InvoiceLineItemComponent> lineItem;
1644
1645  /**
1646   * The total amount for the Invoice may be calculated as the sum of the line
1647   * items with surcharges/deductions that apply in certain conditions. The
1648   * priceComponent element can be used to offer transparency to the recipient of
1649   * the Invoice of how the total price was calculated.
1650   */
1651  @Child(name = "totalPriceComponent", type = {
1652      InvoiceLineItemPriceComponentComponent.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1653  @Description(shortDefinition = "Components of Invoice total", formalDefinition = "The total amount for the Invoice may be calculated as the sum of the line items with surcharges/deductions that apply in certain conditions.  The priceComponent element can be used to offer transparency to the recipient of the Invoice of how the total price was calculated.")
1654  protected List<InvoiceLineItemPriceComponentComponent> totalPriceComponent;
1655
1656  /**
1657   * Invoice total , taxes excluded.
1658   */
1659  @Child(name = "totalNet", type = { Money.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
1660  @Description(shortDefinition = "Net total of this Invoice", formalDefinition = "Invoice total , taxes excluded.")
1661  protected Money totalNet;
1662
1663  /**
1664   * Invoice total, tax included.
1665   */
1666  @Child(name = "totalGross", type = { Money.class }, order = 13, min = 0, max = 1, modifier = false, summary = true)
1667  @Description(shortDefinition = "Gross total of this Invoice", formalDefinition = "Invoice total, tax included.")
1668  protected Money totalGross;
1669
1670  /**
1671   * Payment details such as banking details, period of payment, deductibles,
1672   * methods of payment.
1673   */
1674  @Child(name = "paymentTerms", type = {
1675      MarkdownType.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
1676  @Description(shortDefinition = "Payment details", formalDefinition = "Payment details such as banking details, period of payment, deductibles, methods of payment.")
1677  protected MarkdownType paymentTerms;
1678
1679  /**
1680   * Comments made about the invoice by the issuer, subject, or other
1681   * participants.
1682   */
1683  @Child(name = "note", type = {
1684      Annotation.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1685  @Description(shortDefinition = "Comments made about the invoice", formalDefinition = "Comments made about the invoice by the issuer, subject, or other participants.")
1686  protected List<Annotation> note;
1687
1688  private static final long serialVersionUID = -62357265L;
1689
1690  /**
1691   * Constructor
1692   */
1693  public Invoice() {
1694    super();
1695  }
1696
1697  /**
1698   * Constructor
1699   */
1700  public Invoice(Enumeration<InvoiceStatus> status) {
1701    super();
1702    this.status = status;
1703  }
1704
1705  /**
1706   * @return {@link #identifier} (Identifier of this Invoice, often used for
1707   *         reference in correspondence about this invoice or for tracking of
1708   *         payments.)
1709   */
1710  public List<Identifier> getIdentifier() {
1711    if (this.identifier == null)
1712      this.identifier = new ArrayList<Identifier>();
1713    return this.identifier;
1714  }
1715
1716  /**
1717   * @return Returns a reference to <code>this</code> for easy method chaining
1718   */
1719  public Invoice setIdentifier(List<Identifier> theIdentifier) {
1720    this.identifier = theIdentifier;
1721    return this;
1722  }
1723
1724  public boolean hasIdentifier() {
1725    if (this.identifier == null)
1726      return false;
1727    for (Identifier item : this.identifier)
1728      if (!item.isEmpty())
1729        return true;
1730    return false;
1731  }
1732
1733  public Identifier addIdentifier() { // 3
1734    Identifier t = new Identifier();
1735    if (this.identifier == null)
1736      this.identifier = new ArrayList<Identifier>();
1737    this.identifier.add(t);
1738    return t;
1739  }
1740
1741  public Invoice addIdentifier(Identifier t) { // 3
1742    if (t == null)
1743      return this;
1744    if (this.identifier == null)
1745      this.identifier = new ArrayList<Identifier>();
1746    this.identifier.add(t);
1747    return this;
1748  }
1749
1750  /**
1751   * @return The first repetition of repeating field {@link #identifier}, creating
1752   *         it if it does not already exist
1753   */
1754  public Identifier getIdentifierFirstRep() {
1755    if (getIdentifier().isEmpty()) {
1756      addIdentifier();
1757    }
1758    return getIdentifier().get(0);
1759  }
1760
1761  /**
1762   * @return {@link #status} (The current state of the Invoice.). This is the
1763   *         underlying object with id, value and extensions. The accessor
1764   *         "getStatus" gives direct access to the value
1765   */
1766  public Enumeration<InvoiceStatus> getStatusElement() {
1767    if (this.status == null)
1768      if (Configuration.errorOnAutoCreate())
1769        throw new Error("Attempt to auto-create Invoice.status");
1770      else if (Configuration.doAutoCreate())
1771        this.status = new Enumeration<InvoiceStatus>(new InvoiceStatusEnumFactory()); // bb
1772    return this.status;
1773  }
1774
1775  public boolean hasStatusElement() {
1776    return this.status != null && !this.status.isEmpty();
1777  }
1778
1779  public boolean hasStatus() {
1780    return this.status != null && !this.status.isEmpty();
1781  }
1782
1783  /**
1784   * @param value {@link #status} (The current state of the Invoice.). This is the
1785   *              underlying object with id, value and extensions. The accessor
1786   *              "getStatus" gives direct access to the value
1787   */
1788  public Invoice setStatusElement(Enumeration<InvoiceStatus> value) {
1789    this.status = value;
1790    return this;
1791  }
1792
1793  /**
1794   * @return The current state of the Invoice.
1795   */
1796  public InvoiceStatus getStatus() {
1797    return this.status == null ? null : this.status.getValue();
1798  }
1799
1800  /**
1801   * @param value The current state of the Invoice.
1802   */
1803  public Invoice setStatus(InvoiceStatus value) {
1804    if (this.status == null)
1805      this.status = new Enumeration<InvoiceStatus>(new InvoiceStatusEnumFactory());
1806    this.status.setValue(value);
1807    return this;
1808  }
1809
1810  /**
1811   * @return {@link #cancelledReason} (In case of Invoice cancellation a reason
1812   *         must be given (entered in error, superseded by corrected invoice
1813   *         etc.).). This is the underlying object with id, value and extensions.
1814   *         The accessor "getCancelledReason" gives direct access to the value
1815   */
1816  public StringType getCancelledReasonElement() {
1817    if (this.cancelledReason == null)
1818      if (Configuration.errorOnAutoCreate())
1819        throw new Error("Attempt to auto-create Invoice.cancelledReason");
1820      else if (Configuration.doAutoCreate())
1821        this.cancelledReason = new StringType(); // bb
1822    return this.cancelledReason;
1823  }
1824
1825  public boolean hasCancelledReasonElement() {
1826    return this.cancelledReason != null && !this.cancelledReason.isEmpty();
1827  }
1828
1829  public boolean hasCancelledReason() {
1830    return this.cancelledReason != null && !this.cancelledReason.isEmpty();
1831  }
1832
1833  /**
1834   * @param value {@link #cancelledReason} (In case of Invoice cancellation a
1835   *              reason must be given (entered in error, superseded by corrected
1836   *              invoice etc.).). This is the underlying object with id, value
1837   *              and extensions. The accessor "getCancelledReason" gives direct
1838   *              access to the value
1839   */
1840  public Invoice setCancelledReasonElement(StringType value) {
1841    this.cancelledReason = value;
1842    return this;
1843  }
1844
1845  /**
1846   * @return In case of Invoice cancellation a reason must be given (entered in
1847   *         error, superseded by corrected invoice etc.).
1848   */
1849  public String getCancelledReason() {
1850    return this.cancelledReason == null ? null : this.cancelledReason.getValue();
1851  }
1852
1853  /**
1854   * @param value In case of Invoice cancellation a reason must be given (entered
1855   *              in error, superseded by corrected invoice etc.).
1856   */
1857  public Invoice setCancelledReason(String value) {
1858    if (Utilities.noString(value))
1859      this.cancelledReason = null;
1860    else {
1861      if (this.cancelledReason == null)
1862        this.cancelledReason = new StringType();
1863      this.cancelledReason.setValue(value);
1864    }
1865    return this;
1866  }
1867
1868  /**
1869   * @return {@link #type} (Type of Invoice depending on domain, realm an usage
1870   *         (e.g. internal/external, dental, preliminary).)
1871   */
1872  public CodeableConcept getType() {
1873    if (this.type == null)
1874      if (Configuration.errorOnAutoCreate())
1875        throw new Error("Attempt to auto-create Invoice.type");
1876      else if (Configuration.doAutoCreate())
1877        this.type = new CodeableConcept(); // cc
1878    return this.type;
1879  }
1880
1881  public boolean hasType() {
1882    return this.type != null && !this.type.isEmpty();
1883  }
1884
1885  /**
1886   * @param value {@link #type} (Type of Invoice depending on domain, realm an
1887   *              usage (e.g. internal/external, dental, preliminary).)
1888   */
1889  public Invoice setType(CodeableConcept value) {
1890    this.type = value;
1891    return this;
1892  }
1893
1894  /**
1895   * @return {@link #subject} (The individual or set of individuals receiving the
1896   *         goods and services billed in this invoice.)
1897   */
1898  public Reference getSubject() {
1899    if (this.subject == null)
1900      if (Configuration.errorOnAutoCreate())
1901        throw new Error("Attempt to auto-create Invoice.subject");
1902      else if (Configuration.doAutoCreate())
1903        this.subject = new Reference(); // cc
1904    return this.subject;
1905  }
1906
1907  public boolean hasSubject() {
1908    return this.subject != null && !this.subject.isEmpty();
1909  }
1910
1911  /**
1912   * @param value {@link #subject} (The individual or set of individuals receiving
1913   *              the goods and services billed in this invoice.)
1914   */
1915  public Invoice setSubject(Reference value) {
1916    this.subject = value;
1917    return this;
1918  }
1919
1920  /**
1921   * @return {@link #subject} The actual object that is the target of the
1922   *         reference. The reference library doesn't populate this, but you can
1923   *         use it to hold the resource if you resolve it. (The individual or set
1924   *         of individuals receiving the goods and services billed in this
1925   *         invoice.)
1926   */
1927  public Resource getSubjectTarget() {
1928    return this.subjectTarget;
1929  }
1930
1931  /**
1932   * @param value {@link #subject} The actual object that is the target of the
1933   *              reference. The reference library doesn't use these, but you can
1934   *              use it to hold the resource if you resolve it. (The individual
1935   *              or set of individuals receiving the goods and services billed in
1936   *              this invoice.)
1937   */
1938  public Invoice setSubjectTarget(Resource value) {
1939    this.subjectTarget = value;
1940    return this;
1941  }
1942
1943  /**
1944   * @return {@link #recipient} (The individual or Organization responsible for
1945   *         balancing of this invoice.)
1946   */
1947  public Reference getRecipient() {
1948    if (this.recipient == null)
1949      if (Configuration.errorOnAutoCreate())
1950        throw new Error("Attempt to auto-create Invoice.recipient");
1951      else if (Configuration.doAutoCreate())
1952        this.recipient = new Reference(); // cc
1953    return this.recipient;
1954  }
1955
1956  public boolean hasRecipient() {
1957    return this.recipient != null && !this.recipient.isEmpty();
1958  }
1959
1960  /**
1961   * @param value {@link #recipient} (The individual or Organization responsible
1962   *              for balancing of this invoice.)
1963   */
1964  public Invoice setRecipient(Reference value) {
1965    this.recipient = value;
1966    return this;
1967  }
1968
1969  /**
1970   * @return {@link #recipient} The actual object that is the target of the
1971   *         reference. The reference library doesn't populate this, but you can
1972   *         use it to hold the resource if you resolve it. (The individual or
1973   *         Organization responsible for balancing of this invoice.)
1974   */
1975  public Resource getRecipientTarget() {
1976    return this.recipientTarget;
1977  }
1978
1979  /**
1980   * @param value {@link #recipient} The actual object that is the target of the
1981   *              reference. The reference library doesn't use these, but you can
1982   *              use it to hold the resource if you resolve it. (The individual
1983   *              or Organization responsible for balancing of this invoice.)
1984   */
1985  public Invoice setRecipientTarget(Resource value) {
1986    this.recipientTarget = value;
1987    return this;
1988  }
1989
1990  /**
1991   * @return {@link #date} (Date/time(s) of when this Invoice was posted.). This
1992   *         is the underlying object with id, value and extensions. The accessor
1993   *         "getDate" gives direct access to the value
1994   */
1995  public DateTimeType getDateElement() {
1996    if (this.date == null)
1997      if (Configuration.errorOnAutoCreate())
1998        throw new Error("Attempt to auto-create Invoice.date");
1999      else if (Configuration.doAutoCreate())
2000        this.date = new DateTimeType(); // bb
2001    return this.date;
2002  }
2003
2004  public boolean hasDateElement() {
2005    return this.date != null && !this.date.isEmpty();
2006  }
2007
2008  public boolean hasDate() {
2009    return this.date != null && !this.date.isEmpty();
2010  }
2011
2012  /**
2013   * @param value {@link #date} (Date/time(s) of when this Invoice was posted.).
2014   *              This is the underlying object with id, value and extensions. The
2015   *              accessor "getDate" gives direct access to the value
2016   */
2017  public Invoice setDateElement(DateTimeType value) {
2018    this.date = value;
2019    return this;
2020  }
2021
2022  /**
2023   * @return Date/time(s) of when this Invoice was posted.
2024   */
2025  public Date getDate() {
2026    return this.date == null ? null : this.date.getValue();
2027  }
2028
2029  /**
2030   * @param value Date/time(s) of when this Invoice was posted.
2031   */
2032  public Invoice setDate(Date value) {
2033    if (value == null)
2034      this.date = null;
2035    else {
2036      if (this.date == null)
2037        this.date = new DateTimeType();
2038      this.date.setValue(value);
2039    }
2040    return this;
2041  }
2042
2043  /**
2044   * @return {@link #participant} (Indicates who or what performed or participated
2045   *         in the charged service.)
2046   */
2047  public List<InvoiceParticipantComponent> getParticipant() {
2048    if (this.participant == null)
2049      this.participant = new ArrayList<InvoiceParticipantComponent>();
2050    return this.participant;
2051  }
2052
2053  /**
2054   * @return Returns a reference to <code>this</code> for easy method chaining
2055   */
2056  public Invoice setParticipant(List<InvoiceParticipantComponent> theParticipant) {
2057    this.participant = theParticipant;
2058    return this;
2059  }
2060
2061  public boolean hasParticipant() {
2062    if (this.participant == null)
2063      return false;
2064    for (InvoiceParticipantComponent item : this.participant)
2065      if (!item.isEmpty())
2066        return true;
2067    return false;
2068  }
2069
2070  public InvoiceParticipantComponent addParticipant() { // 3
2071    InvoiceParticipantComponent t = new InvoiceParticipantComponent();
2072    if (this.participant == null)
2073      this.participant = new ArrayList<InvoiceParticipantComponent>();
2074    this.participant.add(t);
2075    return t;
2076  }
2077
2078  public Invoice addParticipant(InvoiceParticipantComponent t) { // 3
2079    if (t == null)
2080      return this;
2081    if (this.participant == null)
2082      this.participant = new ArrayList<InvoiceParticipantComponent>();
2083    this.participant.add(t);
2084    return this;
2085  }
2086
2087  /**
2088   * @return The first repetition of repeating field {@link #participant},
2089   *         creating it if it does not already exist
2090   */
2091  public InvoiceParticipantComponent getParticipantFirstRep() {
2092    if (getParticipant().isEmpty()) {
2093      addParticipant();
2094    }
2095    return getParticipant().get(0);
2096  }
2097
2098  /**
2099   * @return {@link #issuer} (The organizationissuing the Invoice.)
2100   */
2101  public Reference getIssuer() {
2102    if (this.issuer == null)
2103      if (Configuration.errorOnAutoCreate())
2104        throw new Error("Attempt to auto-create Invoice.issuer");
2105      else if (Configuration.doAutoCreate())
2106        this.issuer = new Reference(); // cc
2107    return this.issuer;
2108  }
2109
2110  public boolean hasIssuer() {
2111    return this.issuer != null && !this.issuer.isEmpty();
2112  }
2113
2114  /**
2115   * @param value {@link #issuer} (The organizationissuing the Invoice.)
2116   */
2117  public Invoice setIssuer(Reference value) {
2118    this.issuer = value;
2119    return this;
2120  }
2121
2122  /**
2123   * @return {@link #issuer} The actual object that is the target of the
2124   *         reference. The reference library doesn't populate this, but you can
2125   *         use it to hold the resource if you resolve it. (The
2126   *         organizationissuing the Invoice.)
2127   */
2128  public Organization getIssuerTarget() {
2129    if (this.issuerTarget == null)
2130      if (Configuration.errorOnAutoCreate())
2131        throw new Error("Attempt to auto-create Invoice.issuer");
2132      else if (Configuration.doAutoCreate())
2133        this.issuerTarget = new Organization(); // aa
2134    return this.issuerTarget;
2135  }
2136
2137  /**
2138   * @param value {@link #issuer} The actual object that is the target of the
2139   *              reference. The reference library doesn't use these, but you can
2140   *              use it to hold the resource if you resolve it. (The
2141   *              organizationissuing the Invoice.)
2142   */
2143  public Invoice setIssuerTarget(Organization value) {
2144    this.issuerTarget = value;
2145    return this;
2146  }
2147
2148  /**
2149   * @return {@link #account} (Account which is supposed to be balanced with this
2150   *         Invoice.)
2151   */
2152  public Reference getAccount() {
2153    if (this.account == null)
2154      if (Configuration.errorOnAutoCreate())
2155        throw new Error("Attempt to auto-create Invoice.account");
2156      else if (Configuration.doAutoCreate())
2157        this.account = new Reference(); // cc
2158    return this.account;
2159  }
2160
2161  public boolean hasAccount() {
2162    return this.account != null && !this.account.isEmpty();
2163  }
2164
2165  /**
2166   * @param value {@link #account} (Account which is supposed to be balanced with
2167   *              this Invoice.)
2168   */
2169  public Invoice setAccount(Reference value) {
2170    this.account = value;
2171    return this;
2172  }
2173
2174  /**
2175   * @return {@link #account} The actual object that is the target of the
2176   *         reference. The reference library doesn't populate this, but you can
2177   *         use it to hold the resource if you resolve it. (Account which is
2178   *         supposed to be balanced with this Invoice.)
2179   */
2180  public Account getAccountTarget() {
2181    if (this.accountTarget == null)
2182      if (Configuration.errorOnAutoCreate())
2183        throw new Error("Attempt to auto-create Invoice.account");
2184      else if (Configuration.doAutoCreate())
2185        this.accountTarget = new Account(); // aa
2186    return this.accountTarget;
2187  }
2188
2189  /**
2190   * @param value {@link #account} The actual object that is the target of the
2191   *              reference. The reference library doesn't use these, but you can
2192   *              use it to hold the resource if you resolve it. (Account which is
2193   *              supposed to be balanced with this Invoice.)
2194   */
2195  public Invoice setAccountTarget(Account value) {
2196    this.accountTarget = value;
2197    return this;
2198  }
2199
2200  /**
2201   * @return {@link #lineItem} (Each line item represents one charge for goods and
2202   *         services rendered. Details such as date, code and amount are found in
2203   *         the referenced ChargeItem resource.)
2204   */
2205  public List<InvoiceLineItemComponent> getLineItem() {
2206    if (this.lineItem == null)
2207      this.lineItem = new ArrayList<InvoiceLineItemComponent>();
2208    return this.lineItem;
2209  }
2210
2211  /**
2212   * @return Returns a reference to <code>this</code> for easy method chaining
2213   */
2214  public Invoice setLineItem(List<InvoiceLineItemComponent> theLineItem) {
2215    this.lineItem = theLineItem;
2216    return this;
2217  }
2218
2219  public boolean hasLineItem() {
2220    if (this.lineItem == null)
2221      return false;
2222    for (InvoiceLineItemComponent item : this.lineItem)
2223      if (!item.isEmpty())
2224        return true;
2225    return false;
2226  }
2227
2228  public InvoiceLineItemComponent addLineItem() { // 3
2229    InvoiceLineItemComponent t = new InvoiceLineItemComponent();
2230    if (this.lineItem == null)
2231      this.lineItem = new ArrayList<InvoiceLineItemComponent>();
2232    this.lineItem.add(t);
2233    return t;
2234  }
2235
2236  public Invoice addLineItem(InvoiceLineItemComponent t) { // 3
2237    if (t == null)
2238      return this;
2239    if (this.lineItem == null)
2240      this.lineItem = new ArrayList<InvoiceLineItemComponent>();
2241    this.lineItem.add(t);
2242    return this;
2243  }
2244
2245  /**
2246   * @return The first repetition of repeating field {@link #lineItem}, creating
2247   *         it if it does not already exist
2248   */
2249  public InvoiceLineItemComponent getLineItemFirstRep() {
2250    if (getLineItem().isEmpty()) {
2251      addLineItem();
2252    }
2253    return getLineItem().get(0);
2254  }
2255
2256  /**
2257   * @return {@link #totalPriceComponent} (The total amount for the Invoice may be
2258   *         calculated as the sum of the line items with surcharges/deductions
2259   *         that apply in certain conditions. The priceComponent element can be
2260   *         used to offer transparency to the recipient of the Invoice of how the
2261   *         total price was calculated.)
2262   */
2263  public List<InvoiceLineItemPriceComponentComponent> getTotalPriceComponent() {
2264    if (this.totalPriceComponent == null)
2265      this.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
2266    return this.totalPriceComponent;
2267  }
2268
2269  /**
2270   * @return Returns a reference to <code>this</code> for easy method chaining
2271   */
2272  public Invoice setTotalPriceComponent(List<InvoiceLineItemPriceComponentComponent> theTotalPriceComponent) {
2273    this.totalPriceComponent = theTotalPriceComponent;
2274    return this;
2275  }
2276
2277  public boolean hasTotalPriceComponent() {
2278    if (this.totalPriceComponent == null)
2279      return false;
2280    for (InvoiceLineItemPriceComponentComponent item : this.totalPriceComponent)
2281      if (!item.isEmpty())
2282        return true;
2283    return false;
2284  }
2285
2286  public InvoiceLineItemPriceComponentComponent addTotalPriceComponent() { // 3
2287    InvoiceLineItemPriceComponentComponent t = new InvoiceLineItemPriceComponentComponent();
2288    if (this.totalPriceComponent == null)
2289      this.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
2290    this.totalPriceComponent.add(t);
2291    return t;
2292  }
2293
2294  public Invoice addTotalPriceComponent(InvoiceLineItemPriceComponentComponent t) { // 3
2295    if (t == null)
2296      return this;
2297    if (this.totalPriceComponent == null)
2298      this.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
2299    this.totalPriceComponent.add(t);
2300    return this;
2301  }
2302
2303  /**
2304   * @return The first repetition of repeating field {@link #totalPriceComponent},
2305   *         creating it if it does not already exist
2306   */
2307  public InvoiceLineItemPriceComponentComponent getTotalPriceComponentFirstRep() {
2308    if (getTotalPriceComponent().isEmpty()) {
2309      addTotalPriceComponent();
2310    }
2311    return getTotalPriceComponent().get(0);
2312  }
2313
2314  /**
2315   * @return {@link #totalNet} (Invoice total , taxes excluded.)
2316   */
2317  public Money getTotalNet() {
2318    if (this.totalNet == null)
2319      if (Configuration.errorOnAutoCreate())
2320        throw new Error("Attempt to auto-create Invoice.totalNet");
2321      else if (Configuration.doAutoCreate())
2322        this.totalNet = new Money(); // cc
2323    return this.totalNet;
2324  }
2325
2326  public boolean hasTotalNet() {
2327    return this.totalNet != null && !this.totalNet.isEmpty();
2328  }
2329
2330  /**
2331   * @param value {@link #totalNet} (Invoice total , taxes excluded.)
2332   */
2333  public Invoice setTotalNet(Money value) {
2334    this.totalNet = value;
2335    return this;
2336  }
2337
2338  /**
2339   * @return {@link #totalGross} (Invoice total, tax included.)
2340   */
2341  public Money getTotalGross() {
2342    if (this.totalGross == null)
2343      if (Configuration.errorOnAutoCreate())
2344        throw new Error("Attempt to auto-create Invoice.totalGross");
2345      else if (Configuration.doAutoCreate())
2346        this.totalGross = new Money(); // cc
2347    return this.totalGross;
2348  }
2349
2350  public boolean hasTotalGross() {
2351    return this.totalGross != null && !this.totalGross.isEmpty();
2352  }
2353
2354  /**
2355   * @param value {@link #totalGross} (Invoice total, tax included.)
2356   */
2357  public Invoice setTotalGross(Money value) {
2358    this.totalGross = value;
2359    return this;
2360  }
2361
2362  /**
2363   * @return {@link #paymentTerms} (Payment details such as banking details,
2364   *         period of payment, deductibles, methods of payment.). This is the
2365   *         underlying object with id, value and extensions. The accessor
2366   *         "getPaymentTerms" gives direct access to the value
2367   */
2368  public MarkdownType getPaymentTermsElement() {
2369    if (this.paymentTerms == null)
2370      if (Configuration.errorOnAutoCreate())
2371        throw new Error("Attempt to auto-create Invoice.paymentTerms");
2372      else if (Configuration.doAutoCreate())
2373        this.paymentTerms = new MarkdownType(); // bb
2374    return this.paymentTerms;
2375  }
2376
2377  public boolean hasPaymentTermsElement() {
2378    return this.paymentTerms != null && !this.paymentTerms.isEmpty();
2379  }
2380
2381  public boolean hasPaymentTerms() {
2382    return this.paymentTerms != null && !this.paymentTerms.isEmpty();
2383  }
2384
2385  /**
2386   * @param value {@link #paymentTerms} (Payment details such as banking details,
2387   *              period of payment, deductibles, methods of payment.). This is
2388   *              the underlying object with id, value and extensions. The
2389   *              accessor "getPaymentTerms" gives direct access to the value
2390   */
2391  public Invoice setPaymentTermsElement(MarkdownType value) {
2392    this.paymentTerms = value;
2393    return this;
2394  }
2395
2396  /**
2397   * @return Payment details such as banking details, period of payment,
2398   *         deductibles, methods of payment.
2399   */
2400  public String getPaymentTerms() {
2401    return this.paymentTerms == null ? null : this.paymentTerms.getValue();
2402  }
2403
2404  /**
2405   * @param value Payment details such as banking details, period of payment,
2406   *              deductibles, methods of payment.
2407   */
2408  public Invoice setPaymentTerms(String value) {
2409    if (value == null)
2410      this.paymentTerms = null;
2411    else {
2412      if (this.paymentTerms == null)
2413        this.paymentTerms = new MarkdownType();
2414      this.paymentTerms.setValue(value);
2415    }
2416    return this;
2417  }
2418
2419  /**
2420   * @return {@link #note} (Comments made about the invoice by the issuer,
2421   *         subject, or other participants.)
2422   */
2423  public List<Annotation> getNote() {
2424    if (this.note == null)
2425      this.note = new ArrayList<Annotation>();
2426    return this.note;
2427  }
2428
2429  /**
2430   * @return Returns a reference to <code>this</code> for easy method chaining
2431   */
2432  public Invoice setNote(List<Annotation> theNote) {
2433    this.note = theNote;
2434    return this;
2435  }
2436
2437  public boolean hasNote() {
2438    if (this.note == null)
2439      return false;
2440    for (Annotation item : this.note)
2441      if (!item.isEmpty())
2442        return true;
2443    return false;
2444  }
2445
2446  public Annotation addNote() { // 3
2447    Annotation t = new Annotation();
2448    if (this.note == null)
2449      this.note = new ArrayList<Annotation>();
2450    this.note.add(t);
2451    return t;
2452  }
2453
2454  public Invoice addNote(Annotation t) { // 3
2455    if (t == null)
2456      return this;
2457    if (this.note == null)
2458      this.note = new ArrayList<Annotation>();
2459    this.note.add(t);
2460    return this;
2461  }
2462
2463  /**
2464   * @return The first repetition of repeating field {@link #note}, creating it if
2465   *         it does not already exist
2466   */
2467  public Annotation getNoteFirstRep() {
2468    if (getNote().isEmpty()) {
2469      addNote();
2470    }
2471    return getNote().get(0);
2472  }
2473
2474  protected void listChildren(List<Property> children) {
2475    super.listChildren(children);
2476    children.add(new Property("identifier", "Identifier",
2477        "Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.",
2478        0, java.lang.Integer.MAX_VALUE, identifier));
2479    children.add(new Property("status", "code", "The current state of the Invoice.", 0, 1, status));
2480    children.add(new Property("cancelledReason", "string",
2481        "In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).",
2482        0, 1, cancelledReason));
2483    children.add(new Property("type", "CodeableConcept",
2484        "Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).", 0, 1,
2485        type));
2486    children.add(new Property("subject", "Reference(Patient|Group)",
2487        "The individual or set of individuals receiving the goods and services billed in this invoice.", 0, 1,
2488        subject));
2489    children.add(new Property("recipient", "Reference(Organization|Patient|RelatedPerson)",
2490        "The individual or Organization responsible for balancing of this invoice.", 0, 1, recipient));
2491    children.add(new Property("date", "dateTime", "Date/time(s) of when this Invoice was posted.", 0, 1, date));
2492    children
2493        .add(new Property("participant", "", "Indicates who or what performed or participated in the charged service.",
2494            0, java.lang.Integer.MAX_VALUE, participant));
2495    children
2496        .add(new Property("issuer", "Reference(Organization)", "The organizationissuing the Invoice.", 0, 1, issuer));
2497    children.add(new Property("account", "Reference(Account)",
2498        "Account which is supposed to be balanced with this Invoice.", 0, 1, account));
2499    children.add(new Property("lineItem", "",
2500        "Each line item represents one charge for goods and services rendered. Details such as date, code and amount are found in the referenced ChargeItem resource.",
2501        0, java.lang.Integer.MAX_VALUE, lineItem));
2502    children.add(new Property("totalPriceComponent", "@Invoice.lineItem.priceComponent",
2503        "The total amount for the Invoice may be calculated as the sum of the line items with surcharges/deductions that apply in certain conditions.  The priceComponent element can be used to offer transparency to the recipient of the Invoice of how the total price was calculated.",
2504        0, java.lang.Integer.MAX_VALUE, totalPriceComponent));
2505    children.add(new Property("totalNet", "Money", "Invoice total , taxes excluded.", 0, 1, totalNet));
2506    children.add(new Property("totalGross", "Money", "Invoice total, tax included.", 0, 1, totalGross));
2507    children.add(new Property("paymentTerms", "markdown",
2508        "Payment details such as banking details, period of payment, deductibles, methods of payment.", 0, 1,
2509        paymentTerms));
2510    children.add(new Property("note", "Annotation",
2511        "Comments made about the invoice by the issuer, subject, or other participants.", 0,
2512        java.lang.Integer.MAX_VALUE, note));
2513  }
2514
2515  @Override
2516  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2517    switch (_hash) {
2518    case -1618432855:
2519      /* identifier */ return new Property("identifier", "Identifier",
2520          "Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.",
2521          0, java.lang.Integer.MAX_VALUE, identifier);
2522    case -892481550:
2523      /* status */ return new Property("status", "code", "The current state of the Invoice.", 0, 1, status);
2524    case 1550362357:
2525      /* cancelledReason */ return new Property("cancelledReason", "string",
2526          "In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).",
2527          0, 1, cancelledReason);
2528    case 3575610:
2529      /* type */ return new Property("type", "CodeableConcept",
2530          "Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).", 0, 1,
2531          type);
2532    case -1867885268:
2533      /* subject */ return new Property("subject", "Reference(Patient|Group)",
2534          "The individual or set of individuals receiving the goods and services billed in this invoice.", 0, 1,
2535          subject);
2536    case 820081177:
2537      /* recipient */ return new Property("recipient", "Reference(Organization|Patient|RelatedPerson)",
2538          "The individual or Organization responsible for balancing of this invoice.", 0, 1, recipient);
2539    case 3076014:
2540      /* date */ return new Property("date", "dateTime", "Date/time(s) of when this Invoice was posted.", 0, 1, date);
2541    case 767422259:
2542      /* participant */ return new Property("participant", "",
2543          "Indicates who or what performed or participated in the charged service.", 0, java.lang.Integer.MAX_VALUE,
2544          participant);
2545    case -1179159879:
2546      /* issuer */ return new Property("issuer", "Reference(Organization)", "The organizationissuing the Invoice.", 0,
2547          1, issuer);
2548    case -1177318867:
2549      /* account */ return new Property("account", "Reference(Account)",
2550          "Account which is supposed to be balanced with this Invoice.", 0, 1, account);
2551    case 1188332839:
2552      /* lineItem */ return new Property("lineItem", "",
2553          "Each line item represents one charge for goods and services rendered. Details such as date, code and amount are found in the referenced ChargeItem resource.",
2554          0, java.lang.Integer.MAX_VALUE, lineItem);
2555    case 1731497496:
2556      /* totalPriceComponent */ return new Property("totalPriceComponent", "@Invoice.lineItem.priceComponent",
2557          "The total amount for the Invoice may be calculated as the sum of the line items with surcharges/deductions that apply in certain conditions.  The priceComponent element can be used to offer transparency to the recipient of the Invoice of how the total price was calculated.",
2558          0, java.lang.Integer.MAX_VALUE, totalPriceComponent);
2559    case -849911879:
2560      /* totalNet */ return new Property("totalNet", "Money", "Invoice total , taxes excluded.", 0, 1, totalNet);
2561    case -727607968:
2562      /* totalGross */ return new Property("totalGross", "Money", "Invoice total, tax included.", 0, 1, totalGross);
2563    case -507544799:
2564      /* paymentTerms */ return new Property("paymentTerms", "markdown",
2565          "Payment details such as banking details, period of payment, deductibles, methods of payment.", 0, 1,
2566          paymentTerms);
2567    case 3387378:
2568      /* note */ return new Property("note", "Annotation",
2569          "Comments made about the invoice by the issuer, subject, or other participants.", 0,
2570          java.lang.Integer.MAX_VALUE, note);
2571    default:
2572      return super.getNamedProperty(_hash, _name, _checkValid);
2573    }
2574
2575  }
2576
2577  @Override
2578  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2579    switch (hash) {
2580    case -1618432855:
2581      /* identifier */ return this.identifier == null ? new Base[0]
2582          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2583    case -892481550:
2584      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<InvoiceStatus>
2585    case 1550362357:
2586      /* cancelledReason */ return this.cancelledReason == null ? new Base[0] : new Base[] { this.cancelledReason }; // StringType
2587    case 3575610:
2588      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2589    case -1867885268:
2590      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2591    case 820081177:
2592      /* recipient */ return this.recipient == null ? new Base[0] : new Base[] { this.recipient }; // Reference
2593    case 3076014:
2594      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
2595    case 767422259:
2596      /* participant */ return this.participant == null ? new Base[0]
2597          : this.participant.toArray(new Base[this.participant.size()]); // InvoiceParticipantComponent
2598    case -1179159879:
2599      /* issuer */ return this.issuer == null ? new Base[0] : new Base[] { this.issuer }; // Reference
2600    case -1177318867:
2601      /* account */ return this.account == null ? new Base[0] : new Base[] { this.account }; // Reference
2602    case 1188332839:
2603      /* lineItem */ return this.lineItem == null ? new Base[0] : this.lineItem.toArray(new Base[this.lineItem.size()]); // InvoiceLineItemComponent
2604    case 1731497496:
2605      /* totalPriceComponent */ return this.totalPriceComponent == null ? new Base[0]
2606          : this.totalPriceComponent.toArray(new Base[this.totalPriceComponent.size()]); // InvoiceLineItemPriceComponentComponent
2607    case -849911879:
2608      /* totalNet */ return this.totalNet == null ? new Base[0] : new Base[] { this.totalNet }; // Money
2609    case -727607968:
2610      /* totalGross */ return this.totalGross == null ? new Base[0] : new Base[] { this.totalGross }; // Money
2611    case -507544799:
2612      /* paymentTerms */ return this.paymentTerms == null ? new Base[0] : new Base[] { this.paymentTerms }; // MarkdownType
2613    case 3387378:
2614      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2615    default:
2616      return super.getProperty(hash, name, checkValid);
2617    }
2618
2619  }
2620
2621  @Override
2622  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2623    switch (hash) {
2624    case -1618432855: // identifier
2625      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2626      return value;
2627    case -892481550: // status
2628      value = new InvoiceStatusEnumFactory().fromType(castToCode(value));
2629      this.status = (Enumeration) value; // Enumeration<InvoiceStatus>
2630      return value;
2631    case 1550362357: // cancelledReason
2632      this.cancelledReason = castToString(value); // StringType
2633      return value;
2634    case 3575610: // type
2635      this.type = castToCodeableConcept(value); // CodeableConcept
2636      return value;
2637    case -1867885268: // subject
2638      this.subject = castToReference(value); // Reference
2639      return value;
2640    case 820081177: // recipient
2641      this.recipient = castToReference(value); // Reference
2642      return value;
2643    case 3076014: // date
2644      this.date = castToDateTime(value); // DateTimeType
2645      return value;
2646    case 767422259: // participant
2647      this.getParticipant().add((InvoiceParticipantComponent) value); // InvoiceParticipantComponent
2648      return value;
2649    case -1179159879: // issuer
2650      this.issuer = castToReference(value); // Reference
2651      return value;
2652    case -1177318867: // account
2653      this.account = castToReference(value); // Reference
2654      return value;
2655    case 1188332839: // lineItem
2656      this.getLineItem().add((InvoiceLineItemComponent) value); // InvoiceLineItemComponent
2657      return value;
2658    case 1731497496: // totalPriceComponent
2659      this.getTotalPriceComponent().add((InvoiceLineItemPriceComponentComponent) value); // InvoiceLineItemPriceComponentComponent
2660      return value;
2661    case -849911879: // totalNet
2662      this.totalNet = castToMoney(value); // Money
2663      return value;
2664    case -727607968: // totalGross
2665      this.totalGross = castToMoney(value); // Money
2666      return value;
2667    case -507544799: // paymentTerms
2668      this.paymentTerms = castToMarkdown(value); // MarkdownType
2669      return value;
2670    case 3387378: // note
2671      this.getNote().add(castToAnnotation(value)); // Annotation
2672      return value;
2673    default:
2674      return super.setProperty(hash, name, value);
2675    }
2676
2677  }
2678
2679  @Override
2680  public Base setProperty(String name, Base value) throws FHIRException {
2681    if (name.equals("identifier")) {
2682      this.getIdentifier().add(castToIdentifier(value));
2683    } else if (name.equals("status")) {
2684      value = new InvoiceStatusEnumFactory().fromType(castToCode(value));
2685      this.status = (Enumeration) value; // Enumeration<InvoiceStatus>
2686    } else if (name.equals("cancelledReason")) {
2687      this.cancelledReason = castToString(value); // StringType
2688    } else if (name.equals("type")) {
2689      this.type = castToCodeableConcept(value); // CodeableConcept
2690    } else if (name.equals("subject")) {
2691      this.subject = castToReference(value); // Reference
2692    } else if (name.equals("recipient")) {
2693      this.recipient = castToReference(value); // Reference
2694    } else if (name.equals("date")) {
2695      this.date = castToDateTime(value); // DateTimeType
2696    } else if (name.equals("participant")) {
2697      this.getParticipant().add((InvoiceParticipantComponent) value);
2698    } else if (name.equals("issuer")) {
2699      this.issuer = castToReference(value); // Reference
2700    } else if (name.equals("account")) {
2701      this.account = castToReference(value); // Reference
2702    } else if (name.equals("lineItem")) {
2703      this.getLineItem().add((InvoiceLineItemComponent) value);
2704    } else if (name.equals("totalPriceComponent")) {
2705      this.getTotalPriceComponent().add((InvoiceLineItemPriceComponentComponent) value);
2706    } else if (name.equals("totalNet")) {
2707      this.totalNet = castToMoney(value); // Money
2708    } else if (name.equals("totalGross")) {
2709      this.totalGross = castToMoney(value); // Money
2710    } else if (name.equals("paymentTerms")) {
2711      this.paymentTerms = castToMarkdown(value); // MarkdownType
2712    } else if (name.equals("note")) {
2713      this.getNote().add(castToAnnotation(value));
2714    } else
2715      return super.setProperty(name, value);
2716    return value;
2717  }
2718
2719  @Override
2720  public Base makeProperty(int hash, String name) throws FHIRException {
2721    switch (hash) {
2722    case -1618432855:
2723      return addIdentifier();
2724    case -892481550:
2725      return getStatusElement();
2726    case 1550362357:
2727      return getCancelledReasonElement();
2728    case 3575610:
2729      return getType();
2730    case -1867885268:
2731      return getSubject();
2732    case 820081177:
2733      return getRecipient();
2734    case 3076014:
2735      return getDateElement();
2736    case 767422259:
2737      return addParticipant();
2738    case -1179159879:
2739      return getIssuer();
2740    case -1177318867:
2741      return getAccount();
2742    case 1188332839:
2743      return addLineItem();
2744    case 1731497496:
2745      return addTotalPriceComponent();
2746    case -849911879:
2747      return getTotalNet();
2748    case -727607968:
2749      return getTotalGross();
2750    case -507544799:
2751      return getPaymentTermsElement();
2752    case 3387378:
2753      return addNote();
2754    default:
2755      return super.makeProperty(hash, name);
2756    }
2757
2758  }
2759
2760  @Override
2761  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2762    switch (hash) {
2763    case -1618432855:
2764      /* identifier */ return new String[] { "Identifier" };
2765    case -892481550:
2766      /* status */ return new String[] { "code" };
2767    case 1550362357:
2768      /* cancelledReason */ return new String[] { "string" };
2769    case 3575610:
2770      /* type */ return new String[] { "CodeableConcept" };
2771    case -1867885268:
2772      /* subject */ return new String[] { "Reference" };
2773    case 820081177:
2774      /* recipient */ return new String[] { "Reference" };
2775    case 3076014:
2776      /* date */ return new String[] { "dateTime" };
2777    case 767422259:
2778      /* participant */ return new String[] {};
2779    case -1179159879:
2780      /* issuer */ return new String[] { "Reference" };
2781    case -1177318867:
2782      /* account */ return new String[] { "Reference" };
2783    case 1188332839:
2784      /* lineItem */ return new String[] {};
2785    case 1731497496:
2786      /* totalPriceComponent */ return new String[] { "@Invoice.lineItem.priceComponent" };
2787    case -849911879:
2788      /* totalNet */ return new String[] { "Money" };
2789    case -727607968:
2790      /* totalGross */ return new String[] { "Money" };
2791    case -507544799:
2792      /* paymentTerms */ return new String[] { "markdown" };
2793    case 3387378:
2794      /* note */ return new String[] { "Annotation" };
2795    default:
2796      return super.getTypesForProperty(hash, name);
2797    }
2798
2799  }
2800
2801  @Override
2802  public Base addChild(String name) throws FHIRException {
2803    if (name.equals("identifier")) {
2804      return addIdentifier();
2805    } else if (name.equals("status")) {
2806      throw new FHIRException("Cannot call addChild on a singleton property Invoice.status");
2807    } else if (name.equals("cancelledReason")) {
2808      throw new FHIRException("Cannot call addChild on a singleton property Invoice.cancelledReason");
2809    } else if (name.equals("type")) {
2810      this.type = new CodeableConcept();
2811      return this.type;
2812    } else if (name.equals("subject")) {
2813      this.subject = new Reference();
2814      return this.subject;
2815    } else if (name.equals("recipient")) {
2816      this.recipient = new Reference();
2817      return this.recipient;
2818    } else if (name.equals("date")) {
2819      throw new FHIRException("Cannot call addChild on a singleton property Invoice.date");
2820    } else if (name.equals("participant")) {
2821      return addParticipant();
2822    } else if (name.equals("issuer")) {
2823      this.issuer = new Reference();
2824      return this.issuer;
2825    } else if (name.equals("account")) {
2826      this.account = new Reference();
2827      return this.account;
2828    } else if (name.equals("lineItem")) {
2829      return addLineItem();
2830    } else if (name.equals("totalPriceComponent")) {
2831      return addTotalPriceComponent();
2832    } else if (name.equals("totalNet")) {
2833      this.totalNet = new Money();
2834      return this.totalNet;
2835    } else if (name.equals("totalGross")) {
2836      this.totalGross = new Money();
2837      return this.totalGross;
2838    } else if (name.equals("paymentTerms")) {
2839      throw new FHIRException("Cannot call addChild on a singleton property Invoice.paymentTerms");
2840    } else if (name.equals("note")) {
2841      return addNote();
2842    } else
2843      return super.addChild(name);
2844  }
2845
2846  public String fhirType() {
2847    return "Invoice";
2848
2849  }
2850
2851  public Invoice copy() {
2852    Invoice dst = new Invoice();
2853    copyValues(dst);
2854    return dst;
2855  }
2856
2857  public void copyValues(Invoice dst) {
2858    super.copyValues(dst);
2859    if (identifier != null) {
2860      dst.identifier = new ArrayList<Identifier>();
2861      for (Identifier i : identifier)
2862        dst.identifier.add(i.copy());
2863    }
2864    ;
2865    dst.status = status == null ? null : status.copy();
2866    dst.cancelledReason = cancelledReason == null ? null : cancelledReason.copy();
2867    dst.type = type == null ? null : type.copy();
2868    dst.subject = subject == null ? null : subject.copy();
2869    dst.recipient = recipient == null ? null : recipient.copy();
2870    dst.date = date == null ? null : date.copy();
2871    if (participant != null) {
2872      dst.participant = new ArrayList<InvoiceParticipantComponent>();
2873      for (InvoiceParticipantComponent i : participant)
2874        dst.participant.add(i.copy());
2875    }
2876    ;
2877    dst.issuer = issuer == null ? null : issuer.copy();
2878    dst.account = account == null ? null : account.copy();
2879    if (lineItem != null) {
2880      dst.lineItem = new ArrayList<InvoiceLineItemComponent>();
2881      for (InvoiceLineItemComponent i : lineItem)
2882        dst.lineItem.add(i.copy());
2883    }
2884    ;
2885    if (totalPriceComponent != null) {
2886      dst.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
2887      for (InvoiceLineItemPriceComponentComponent i : totalPriceComponent)
2888        dst.totalPriceComponent.add(i.copy());
2889    }
2890    ;
2891    dst.totalNet = totalNet == null ? null : totalNet.copy();
2892    dst.totalGross = totalGross == null ? null : totalGross.copy();
2893    dst.paymentTerms = paymentTerms == null ? null : paymentTerms.copy();
2894    if (note != null) {
2895      dst.note = new ArrayList<Annotation>();
2896      for (Annotation i : note)
2897        dst.note.add(i.copy());
2898    }
2899    ;
2900  }
2901
2902  protected Invoice typedCopy() {
2903    return copy();
2904  }
2905
2906  @Override
2907  public boolean equalsDeep(Base other_) {
2908    if (!super.equalsDeep(other_))
2909      return false;
2910    if (!(other_ instanceof Invoice))
2911      return false;
2912    Invoice o = (Invoice) other_;
2913    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
2914        && compareDeep(cancelledReason, o.cancelledReason, true) && compareDeep(type, o.type, true)
2915        && compareDeep(subject, o.subject, true) && compareDeep(recipient, o.recipient, true)
2916        && compareDeep(date, o.date, true) && compareDeep(participant, o.participant, true)
2917        && compareDeep(issuer, o.issuer, true) && compareDeep(account, o.account, true)
2918        && compareDeep(lineItem, o.lineItem, true) && compareDeep(totalPriceComponent, o.totalPriceComponent, true)
2919        && compareDeep(totalNet, o.totalNet, true) && compareDeep(totalGross, o.totalGross, true)
2920        && compareDeep(paymentTerms, o.paymentTerms, true) && compareDeep(note, o.note, true);
2921  }
2922
2923  @Override
2924  public boolean equalsShallow(Base other_) {
2925    if (!super.equalsShallow(other_))
2926      return false;
2927    if (!(other_ instanceof Invoice))
2928      return false;
2929    Invoice o = (Invoice) other_;
2930    return compareValues(status, o.status, true) && compareValues(cancelledReason, o.cancelledReason, true)
2931        && compareValues(date, o.date, true) && compareValues(paymentTerms, o.paymentTerms, true);
2932  }
2933
2934  public boolean isEmpty() {
2935    return super.isEmpty()
2936        && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, cancelledReason, type, subject, recipient, date,
2937            participant, issuer, account, lineItem, totalPriceComponent, totalNet, totalGross, paymentTerms, note);
2938  }
2939
2940  @Override
2941  public ResourceType getResourceType() {
2942    return ResourceType.Invoice;
2943  }
2944
2945  /**
2946   * Search parameter: <b>date</b>
2947   * <p>
2948   * Description: <b>Invoice date / posting date</b><br>
2949   * Type: <b>date</b><br>
2950   * Path: <b>Invoice.date</b><br>
2951   * </p>
2952   */
2953  @SearchParamDefinition(name = "date", path = "Invoice.date", description = "Invoice date / posting date", type = "date")
2954  public static final String SP_DATE = "date";
2955  /**
2956   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2957   * <p>
2958   * Description: <b>Invoice date / posting date</b><br>
2959   * Type: <b>date</b><br>
2960   * Path: <b>Invoice.date</b><br>
2961   * </p>
2962   */
2963  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2964      SP_DATE);
2965
2966  /**
2967   * Search parameter: <b>identifier</b>
2968   * <p>
2969   * Description: <b>Business Identifier for item</b><br>
2970   * Type: <b>token</b><br>
2971   * Path: <b>Invoice.identifier</b><br>
2972   * </p>
2973   */
2974  @SearchParamDefinition(name = "identifier", path = "Invoice.identifier", description = "Business Identifier for item", type = "token")
2975  public static final String SP_IDENTIFIER = "identifier";
2976  /**
2977   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2978   * <p>
2979   * Description: <b>Business Identifier for item</b><br>
2980   * Type: <b>token</b><br>
2981   * Path: <b>Invoice.identifier</b><br>
2982   * </p>
2983   */
2984  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2985      SP_IDENTIFIER);
2986
2987  /**
2988   * Search parameter: <b>totalgross</b>
2989   * <p>
2990   * Description: <b>Gross total of this Invoice</b><br>
2991   * Type: <b>quantity</b><br>
2992   * Path: <b>Invoice.totalGross</b><br>
2993   * </p>
2994   */
2995  @SearchParamDefinition(name = "totalgross", path = "Invoice.totalGross", description = "Gross total of this Invoice", type = "quantity")
2996  public static final String SP_TOTALGROSS = "totalgross";
2997  /**
2998   * <b>Fluent Client</b> search parameter constant for <b>totalgross</b>
2999   * <p>
3000   * Description: <b>Gross total of this Invoice</b><br>
3001   * Type: <b>quantity</b><br>
3002   * Path: <b>Invoice.totalGross</b><br>
3003   * </p>
3004   */
3005  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam TOTALGROSS = new ca.uhn.fhir.rest.gclient.QuantityClientParam(
3006      SP_TOTALGROSS);
3007
3008  /**
3009   * Search parameter: <b>subject</b>
3010   * <p>
3011   * Description: <b>Recipient(s) of goods and services</b><br>
3012   * Type: <b>reference</b><br>
3013   * Path: <b>Invoice.subject</b><br>
3014   * </p>
3015   */
3016  @SearchParamDefinition(name = "subject", path = "Invoice.subject", description = "Recipient(s) of goods and services", type = "reference", providesMembershipIn = {
3017      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Group.class, Patient.class })
3018  public static final String SP_SUBJECT = "subject";
3019  /**
3020   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3021   * <p>
3022   * Description: <b>Recipient(s) of goods and services</b><br>
3023   * Type: <b>reference</b><br>
3024   * Path: <b>Invoice.subject</b><br>
3025   * </p>
3026   */
3027  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3028      SP_SUBJECT);
3029
3030  /**
3031   * Constant for fluent queries to be used to add include statements. Specifies
3032   * the path value of "<b>Invoice:subject</b>".
3033   */
3034  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
3035      "Invoice:subject").toLocked();
3036
3037  /**
3038   * Search parameter: <b>participant-role</b>
3039   * <p>
3040   * Description: <b>Type of involvement in creation of this Invoice</b><br>
3041   * Type: <b>token</b><br>
3042   * Path: <b>Invoice.participant.role</b><br>
3043   * </p>
3044   */
3045  @SearchParamDefinition(name = "participant-role", path = "Invoice.participant.role", description = "Type of involvement in creation of this Invoice", type = "token")
3046  public static final String SP_PARTICIPANT_ROLE = "participant-role";
3047  /**
3048   * <b>Fluent Client</b> search parameter constant for <b>participant-role</b>
3049   * <p>
3050   * Description: <b>Type of involvement in creation of this Invoice</b><br>
3051   * Type: <b>token</b><br>
3052   * Path: <b>Invoice.participant.role</b><br>
3053   * </p>
3054   */
3055  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PARTICIPANT_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3056      SP_PARTICIPANT_ROLE);
3057
3058  /**
3059   * Search parameter: <b>type</b>
3060   * <p>
3061   * Description: <b>Type of Invoice</b><br>
3062   * Type: <b>token</b><br>
3063   * Path: <b>Invoice.type</b><br>
3064   * </p>
3065   */
3066  @SearchParamDefinition(name = "type", path = "Invoice.type", description = "Type of Invoice", type = "token")
3067  public static final String SP_TYPE = "type";
3068  /**
3069   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3070   * <p>
3071   * Description: <b>Type of Invoice</b><br>
3072   * Type: <b>token</b><br>
3073   * Path: <b>Invoice.type</b><br>
3074   * </p>
3075   */
3076  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3077      SP_TYPE);
3078
3079  /**
3080   * Search parameter: <b>issuer</b>
3081   * <p>
3082   * Description: <b>Issuing Organization of Invoice</b><br>
3083   * Type: <b>reference</b><br>
3084   * Path: <b>Invoice.issuer</b><br>
3085   * </p>
3086   */
3087  @SearchParamDefinition(name = "issuer", path = "Invoice.issuer", description = "Issuing Organization of Invoice", type = "reference", target = {
3088      Organization.class })
3089  public static final String SP_ISSUER = "issuer";
3090  /**
3091   * <b>Fluent Client</b> search parameter constant for <b>issuer</b>
3092   * <p>
3093   * Description: <b>Issuing Organization of Invoice</b><br>
3094   * Type: <b>reference</b><br>
3095   * Path: <b>Invoice.issuer</b><br>
3096   * </p>
3097   */
3098  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ISSUER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3099      SP_ISSUER);
3100
3101  /**
3102   * Constant for fluent queries to be used to add include statements. Specifies
3103   * the path value of "<b>Invoice:issuer</b>".
3104   */
3105  public static final ca.uhn.fhir.model.api.Include INCLUDE_ISSUER = new ca.uhn.fhir.model.api.Include("Invoice:issuer")
3106      .toLocked();
3107
3108  /**
3109   * Search parameter: <b>participant</b>
3110   * <p>
3111   * Description: <b>Individual who was involved</b><br>
3112   * Type: <b>reference</b><br>
3113   * Path: <b>Invoice.participant.actor</b><br>
3114   * </p>
3115   */
3116  @SearchParamDefinition(name = "participant", path = "Invoice.participant.actor", description = "Individual who was involved", type = "reference", providesMembershipIn = {
3117      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3118      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class,
3119          Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
3120  public static final String SP_PARTICIPANT = "participant";
3121  /**
3122   * <b>Fluent Client</b> search parameter constant for <b>participant</b>
3123   * <p>
3124   * Description: <b>Individual who was involved</b><br>
3125   * Type: <b>reference</b><br>
3126   * Path: <b>Invoice.participant.actor</b><br>
3127   * </p>
3128   */
3129  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3130      SP_PARTICIPANT);
3131
3132  /**
3133   * Constant for fluent queries to be used to add include statements. Specifies
3134   * the path value of "<b>Invoice:participant</b>".
3135   */
3136  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include(
3137      "Invoice:participant").toLocked();
3138
3139  /**
3140   * Search parameter: <b>totalnet</b>
3141   * <p>
3142   * Description: <b>Net total of this Invoice</b><br>
3143   * Type: <b>quantity</b><br>
3144   * Path: <b>Invoice.totalNet</b><br>
3145   * </p>
3146   */
3147  @SearchParamDefinition(name = "totalnet", path = "Invoice.totalNet", description = "Net total of this Invoice", type = "quantity")
3148  public static final String SP_TOTALNET = "totalnet";
3149  /**
3150   * <b>Fluent Client</b> search parameter constant for <b>totalnet</b>
3151   * <p>
3152   * Description: <b>Net total of this Invoice</b><br>
3153   * Type: <b>quantity</b><br>
3154   * Path: <b>Invoice.totalNet</b><br>
3155   * </p>
3156   */
3157  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam TOTALNET = new ca.uhn.fhir.rest.gclient.QuantityClientParam(
3158      SP_TOTALNET);
3159
3160  /**
3161   * Search parameter: <b>patient</b>
3162   * <p>
3163   * Description: <b>Recipient(s) of goods and services</b><br>
3164   * Type: <b>reference</b><br>
3165   * Path: <b>Invoice.subject</b><br>
3166   * </p>
3167   */
3168  @SearchParamDefinition(name = "patient", path = "Invoice.subject.where(resolve() is Patient)", description = "Recipient(s) of goods and services", type = "reference", providesMembershipIn = {
3169      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
3170  public static final String SP_PATIENT = "patient";
3171  /**
3172   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3173   * <p>
3174   * Description: <b>Recipient(s) of goods and services</b><br>
3175   * Type: <b>reference</b><br>
3176   * Path: <b>Invoice.subject</b><br>
3177   * </p>
3178   */
3179  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3180      SP_PATIENT);
3181
3182  /**
3183   * Constant for fluent queries to be used to add include statements. Specifies
3184   * the path value of "<b>Invoice:patient</b>".
3185   */
3186  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
3187      "Invoice:patient").toLocked();
3188
3189  /**
3190   * Search parameter: <b>recipient</b>
3191   * <p>
3192   * Description: <b>Recipient of this invoice</b><br>
3193   * Type: <b>reference</b><br>
3194   * Path: <b>Invoice.recipient</b><br>
3195   * </p>
3196   */
3197  @SearchParamDefinition(name = "recipient", path = "Invoice.recipient", description = "Recipient of this invoice", type = "reference", providesMembershipIn = {
3198      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
3199      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Organization.class,
3200          Patient.class, RelatedPerson.class })
3201  public static final String SP_RECIPIENT = "recipient";
3202  /**
3203   * <b>Fluent Client</b> search parameter constant for <b>recipient</b>
3204   * <p>
3205   * Description: <b>Recipient of this invoice</b><br>
3206   * Type: <b>reference</b><br>
3207   * Path: <b>Invoice.recipient</b><br>
3208   * </p>
3209   */
3210  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECIPIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3211      SP_RECIPIENT);
3212
3213  /**
3214   * Constant for fluent queries to be used to add include statements. Specifies
3215   * the path value of "<b>Invoice:recipient</b>".
3216   */
3217  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECIPIENT = new ca.uhn.fhir.model.api.Include(
3218      "Invoice:recipient").toLocked();
3219
3220  /**
3221   * Search parameter: <b>account</b>
3222   * <p>
3223   * Description: <b>Account that is being balanced</b><br>
3224   * Type: <b>reference</b><br>
3225   * Path: <b>Invoice.account</b><br>
3226   * </p>
3227   */
3228  @SearchParamDefinition(name = "account", path = "Invoice.account", description = "Account that is being balanced", type = "reference", target = {
3229      Account.class })
3230  public static final String SP_ACCOUNT = "account";
3231  /**
3232   * <b>Fluent Client</b> search parameter constant for <b>account</b>
3233   * <p>
3234   * Description: <b>Account that is being balanced</b><br>
3235   * Type: <b>reference</b><br>
3236   * Path: <b>Invoice.account</b><br>
3237   * </p>
3238   */
3239  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACCOUNT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3240      SP_ACCOUNT);
3241
3242  /**
3243   * Constant for fluent queries to be used to add include statements. Specifies
3244   * the path value of "<b>Invoice:account</b>".
3245   */
3246  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACCOUNT = new ca.uhn.fhir.model.api.Include(
3247      "Invoice:account").toLocked();
3248
3249  /**
3250   * Search parameter: <b>status</b>
3251   * <p>
3252   * Description: <b>draft | issued | balanced | cancelled |
3253   * entered-in-error</b><br>
3254   * Type: <b>token</b><br>
3255   * Path: <b>Invoice.status</b><br>
3256   * </p>
3257   */
3258  @SearchParamDefinition(name = "status", path = "Invoice.status", description = "draft | issued | balanced | cancelled | entered-in-error", type = "token")
3259  public static final String SP_STATUS = "status";
3260  /**
3261   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3262   * <p>
3263   * Description: <b>draft | issued | balanced | cancelled |
3264   * entered-in-error</b><br>
3265   * Type: <b>token</b><br>
3266   * Path: <b>Invoice.status</b><br>
3267   * </p>
3268   */
3269  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3270      SP_STATUS);
3271
3272}