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