001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import java.math.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.r5.model.Enumerations.*;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.ICompositeType;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.Block;
050
051/**
052 * Invoice containing collected ChargeItems from an Account with calculated individual and total price for Billing purpose.
053 */
054@ResourceDef(name="Invoice", profile="http://hl7.org/fhir/StructureDefinition/Invoice")
055public class Invoice extends DomainResource {
056
057    public enum InvoiceStatus {
058        /**
059         * the invoice has been prepared but not yet finalized.
060         */
061        DRAFT, 
062        /**
063         * the invoice has been finalized and sent to the recipient.
064         */
065        ISSUED, 
066        /**
067         * the invoice has been balaced / completely paid.
068         */
069        BALANCED, 
070        /**
071         * the invoice was cancelled.
072         */
073        CANCELLED, 
074        /**
075         * the invoice was determined as entered in error before it was issued.
076         */
077        ENTEREDINERROR, 
078        /**
079         * added to help the parsers with the generic types
080         */
081        NULL;
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        public String toCode() {
101          switch (this) {
102            case DRAFT: return "draft";
103            case ISSUED: return "issued";
104            case BALANCED: return "balanced";
105            case CANCELLED: return "cancelled";
106            case ENTEREDINERROR: return "entered-in-error";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111        public String getSystem() {
112          switch (this) {
113            case DRAFT: return "http://hl7.org/fhir/invoice-status";
114            case ISSUED: return "http://hl7.org/fhir/invoice-status";
115            case BALANCED: return "http://hl7.org/fhir/invoice-status";
116            case CANCELLED: return "http://hl7.org/fhir/invoice-status";
117            case ENTEREDINERROR: return "http://hl7.org/fhir/invoice-status";
118            case NULL: return null;
119            default: return "?";
120          }
121        }
122        public String getDefinition() {
123          switch (this) {
124            case DRAFT: return "the invoice has been prepared but not yet finalized.";
125            case ISSUED: return "the invoice has been finalized and sent to the recipient.";
126            case BALANCED: return "the invoice has been balaced / completely paid.";
127            case CANCELLED: return "the invoice was cancelled.";
128            case ENTEREDINERROR: return "the invoice was determined as entered in error before it was issued.";
129            case NULL: return null;
130            default: return "?";
131          }
132        }
133        public String getDisplay() {
134          switch (this) {
135            case DRAFT: return "draft";
136            case ISSUED: return "issued";
137            case BALANCED: return "balanced";
138            case CANCELLED: return "cancelled";
139            case ENTEREDINERROR: return "entered in error";
140            case NULL: return null;
141            default: return "?";
142          }
143        }
144    }
145
146  public static class InvoiceStatusEnumFactory implements EnumFactory<InvoiceStatus> {
147    public InvoiceStatus fromCode(String codeString) throws IllegalArgumentException {
148      if (codeString == null || "".equals(codeString))
149            if (codeString == null || "".equals(codeString))
150                return null;
151        if ("draft".equals(codeString))
152          return InvoiceStatus.DRAFT;
153        if ("issued".equals(codeString))
154          return InvoiceStatus.ISSUED;
155        if ("balanced".equals(codeString))
156          return InvoiceStatus.BALANCED;
157        if ("cancelled".equals(codeString))
158          return InvoiceStatus.CANCELLED;
159        if ("entered-in-error".equals(codeString))
160          return InvoiceStatus.ENTEREDINERROR;
161        throw new IllegalArgumentException("Unknown InvoiceStatus code '"+codeString+"'");
162        }
163        public Enumeration<InvoiceStatus> fromType(Base code) throws FHIRException {
164          if (code == null)
165            return null;
166          if (code.isEmpty())
167            return new Enumeration<InvoiceStatus>(this);
168          String codeString = ((PrimitiveType) code).asStringValue();
169          if (codeString == null || "".equals(codeString))
170            return null;
171        if ("draft".equals(codeString))
172          return new Enumeration<InvoiceStatus>(this, InvoiceStatus.DRAFT);
173        if ("issued".equals(codeString))
174          return new Enumeration<InvoiceStatus>(this, InvoiceStatus.ISSUED);
175        if ("balanced".equals(codeString))
176          return new Enumeration<InvoiceStatus>(this, InvoiceStatus.BALANCED);
177        if ("cancelled".equals(codeString))
178          return new Enumeration<InvoiceStatus>(this, InvoiceStatus.CANCELLED);
179        if ("entered-in-error".equals(codeString))
180          return new Enumeration<InvoiceStatus>(this, InvoiceStatus.ENTEREDINERROR);
181        throw new FHIRException("Unknown InvoiceStatus code '"+codeString+"'");
182        }
183    public String toCode(InvoiceStatus code) {
184      if (code == InvoiceStatus.DRAFT)
185        return "draft";
186      if (code == InvoiceStatus.ISSUED)
187        return "issued";
188      if (code == InvoiceStatus.BALANCED)
189        return "balanced";
190      if (code == InvoiceStatus.CANCELLED)
191        return "cancelled";
192      if (code == InvoiceStatus.ENTEREDINERROR)
193        return "entered-in-error";
194      return "?";
195      }
196    public String toSystem(InvoiceStatus code) {
197      return code.getSystem();
198      }
199    }
200
201    @Block()
202    public static class InvoiceParticipantComponent extends BackboneElement implements IBaseBackboneElement {
203        /**
204         * 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.
205         */
206        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
207        @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." )
208        protected CodeableConcept role;
209
210        /**
211         * The device, practitioner, etc. who performed or participated in the service.
212         */
213        @Child(name = "actor", type = {Practitioner.class, Organization.class, Patient.class, PractitionerRole.class, Device.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
214        @Description(shortDefinition="Individual who was involved", formalDefinition="The device, practitioner, etc. who performed or participated in the service." )
215        protected Reference actor;
216
217        private static final long serialVersionUID = -1684441509L;
218
219    /**
220     * Constructor
221     */
222      public InvoiceParticipantComponent() {
223        super();
224      }
225
226    /**
227     * Constructor
228     */
229      public InvoiceParticipantComponent(Reference actor) {
230        super();
231        this.setActor(actor);
232      }
233
234        /**
235         * @return {@link #role} (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.)
236         */
237        public CodeableConcept getRole() { 
238          if (this.role == null)
239            if (Configuration.errorOnAutoCreate())
240              throw new Error("Attempt to auto-create InvoiceParticipantComponent.role");
241            else if (Configuration.doAutoCreate())
242              this.role = new CodeableConcept(); // cc
243          return this.role;
244        }
245
246        public boolean hasRole() { 
247          return this.role != null && !this.role.isEmpty();
248        }
249
250        /**
251         * @param value {@link #role} (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.)
252         */
253        public InvoiceParticipantComponent setRole(CodeableConcept value) { 
254          this.role = value;
255          return this;
256        }
257
258        /**
259         * @return {@link #actor} (The device, practitioner, etc. who performed or participated in the service.)
260         */
261        public Reference getActor() { 
262          if (this.actor == null)
263            if (Configuration.errorOnAutoCreate())
264              throw new Error("Attempt to auto-create InvoiceParticipantComponent.actor");
265            else if (Configuration.doAutoCreate())
266              this.actor = new Reference(); // cc
267          return this.actor;
268        }
269
270        public boolean hasActor() { 
271          return this.actor != null && !this.actor.isEmpty();
272        }
273
274        /**
275         * @param value {@link #actor} (The device, practitioner, etc. who performed or participated in the service.)
276         */
277        public InvoiceParticipantComponent setActor(Reference value) { 
278          this.actor = value;
279          return this;
280        }
281
282        protected void listChildren(List<Property> children) {
283          super.listChildren(children);
284          children.add(new Property("role", "CodeableConcept", "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.", 0, 1, role));
285          children.add(new Property("actor", "Reference(Practitioner|Organization|Patient|PractitionerRole|Device|RelatedPerson)", "The device, practitioner, etc. who performed or participated in the service.", 0, 1, actor));
286        }
287
288        @Override
289        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
290          switch (_hash) {
291          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "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.", 0, 1, role);
292          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|Organization|Patient|PractitionerRole|Device|RelatedPerson)", "The device, practitioner, etc. who performed or participated in the service.", 0, 1, actor);
293          default: return super.getNamedProperty(_hash, _name, _checkValid);
294          }
295
296        }
297
298      @Override
299      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
300        switch (hash) {
301        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
302        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
303        default: return super.getProperty(hash, name, checkValid);
304        }
305
306      }
307
308      @Override
309      public Base setProperty(int hash, String name, Base value) throws FHIRException {
310        switch (hash) {
311        case 3506294: // role
312          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
313          return value;
314        case 92645877: // actor
315          this.actor = TypeConvertor.castToReference(value); // Reference
316          return value;
317        default: return super.setProperty(hash, name, value);
318        }
319
320      }
321
322      @Override
323      public Base setProperty(String name, Base value) throws FHIRException {
324        if (name.equals("role")) {
325          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
326        } else if (name.equals("actor")) {
327          this.actor = TypeConvertor.castToReference(value); // Reference
328        } else
329          return super.setProperty(name, value);
330        return value;
331      }
332
333      @Override
334      public Base makeProperty(int hash, String name) throws FHIRException {
335        switch (hash) {
336        case 3506294:  return getRole();
337        case 92645877:  return getActor();
338        default: return super.makeProperty(hash, name);
339        }
340
341      }
342
343      @Override
344      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
345        switch (hash) {
346        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
347        case 92645877: /*actor*/ return new String[] {"Reference"};
348        default: return super.getTypesForProperty(hash, name);
349        }
350
351      }
352
353      @Override
354      public Base addChild(String name) throws FHIRException {
355        if (name.equals("role")) {
356          this.role = new CodeableConcept();
357          return this.role;
358        }
359        else if (name.equals("actor")) {
360          this.actor = new Reference();
361          return this.actor;
362        }
363        else
364          return super.addChild(name);
365      }
366
367      public InvoiceParticipantComponent copy() {
368        InvoiceParticipantComponent dst = new InvoiceParticipantComponent();
369        copyValues(dst);
370        return dst;
371      }
372
373      public void copyValues(InvoiceParticipantComponent dst) {
374        super.copyValues(dst);
375        dst.role = role == null ? null : role.copy();
376        dst.actor = actor == null ? null : actor.copy();
377      }
378
379      @Override
380      public boolean equalsDeep(Base other_) {
381        if (!super.equalsDeep(other_))
382          return false;
383        if (!(other_ instanceof InvoiceParticipantComponent))
384          return false;
385        InvoiceParticipantComponent o = (InvoiceParticipantComponent) other_;
386        return compareDeep(role, o.role, true) && compareDeep(actor, o.actor, true);
387      }
388
389      @Override
390      public boolean equalsShallow(Base other_) {
391        if (!super.equalsShallow(other_))
392          return false;
393        if (!(other_ instanceof InvoiceParticipantComponent))
394          return false;
395        InvoiceParticipantComponent o = (InvoiceParticipantComponent) other_;
396        return true;
397      }
398
399      public boolean isEmpty() {
400        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, actor);
401      }
402
403  public String fhirType() {
404    return "Invoice.participant";
405
406  }
407
408  }
409
410    @Block()
411    public static class InvoiceLineItemComponent extends BackboneElement implements IBaseBackboneElement {
412        /**
413         * Sequence in which the items appear on the invoice.
414         */
415        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
416        @Description(shortDefinition="Sequence number of line item", formalDefinition="Sequence in which the items appear on the invoice." )
417        protected PositiveIntType sequence;
418
419        /**
420         * 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.
421         */
422        @Child(name = "chargeItem", type = {ChargeItem.class, CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
423        @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." )
424        protected DataType chargeItem;
425
426        /**
427         * 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.
428         */
429        @Child(name = "priceComponent", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
430        @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." )
431        protected List<InvoiceLineItemPriceComponentComponent> priceComponent;
432
433        private static final long serialVersionUID = -973836547L;
434
435    /**
436     * Constructor
437     */
438      public InvoiceLineItemComponent() {
439        super();
440      }
441
442    /**
443     * Constructor
444     */
445      public InvoiceLineItemComponent(DataType chargeItem) {
446        super();
447        this.setChargeItem(chargeItem);
448      }
449
450        /**
451         * @return {@link #sequence} (Sequence in which the items appear on the invoice.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
452         */
453        public PositiveIntType getSequenceElement() { 
454          if (this.sequence == null)
455            if (Configuration.errorOnAutoCreate())
456              throw new Error("Attempt to auto-create InvoiceLineItemComponent.sequence");
457            else if (Configuration.doAutoCreate())
458              this.sequence = new PositiveIntType(); // bb
459          return this.sequence;
460        }
461
462        public boolean hasSequenceElement() { 
463          return this.sequence != null && !this.sequence.isEmpty();
464        }
465
466        public boolean hasSequence() { 
467          return this.sequence != null && !this.sequence.isEmpty();
468        }
469
470        /**
471         * @param value {@link #sequence} (Sequence in which the items appear on the invoice.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
472         */
473        public InvoiceLineItemComponent setSequenceElement(PositiveIntType value) { 
474          this.sequence = value;
475          return this;
476        }
477
478        /**
479         * @return Sequence in which the items appear on the invoice.
480         */
481        public int getSequence() { 
482          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
483        }
484
485        /**
486         * @param value Sequence in which the items appear on the invoice.
487         */
488        public InvoiceLineItemComponent setSequence(int value) { 
489            if (this.sequence == null)
490              this.sequence = new PositiveIntType();
491            this.sequence.setValue(value);
492          return this;
493        }
494
495        /**
496         * @return {@link #chargeItem} (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.)
497         */
498        public DataType getChargeItem() { 
499          return this.chargeItem;
500        }
501
502        /**
503         * @return {@link #chargeItem} (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.)
504         */
505        public Reference getChargeItemReference() throws FHIRException { 
506          if (this.chargeItem == null)
507            this.chargeItem = new Reference();
508          if (!(this.chargeItem instanceof Reference))
509            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.chargeItem.getClass().getName()+" was encountered");
510          return (Reference) this.chargeItem;
511        }
512
513        public boolean hasChargeItemReference() { 
514          return this != null && this.chargeItem instanceof Reference;
515        }
516
517        /**
518         * @return {@link #chargeItem} (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.)
519         */
520        public CodeableConcept getChargeItemCodeableConcept() throws FHIRException { 
521          if (this.chargeItem == null)
522            this.chargeItem = new CodeableConcept();
523          if (!(this.chargeItem instanceof CodeableConcept))
524            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.chargeItem.getClass().getName()+" was encountered");
525          return (CodeableConcept) this.chargeItem;
526        }
527
528        public boolean hasChargeItemCodeableConcept() { 
529          return this != null && this.chargeItem instanceof CodeableConcept;
530        }
531
532        public boolean hasChargeItem() { 
533          return this.chargeItem != null && !this.chargeItem.isEmpty();
534        }
535
536        /**
537         * @param value {@link #chargeItem} (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.)
538         */
539        public InvoiceLineItemComponent setChargeItem(DataType value) { 
540          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
541            throw new Error("Not the right type for Invoice.lineItem.chargeItem[x]: "+value.fhirType());
542          this.chargeItem = value;
543          return this;
544        }
545
546        /**
547         * @return {@link #priceComponent} (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.)
548         */
549        public List<InvoiceLineItemPriceComponentComponent> getPriceComponent() { 
550          if (this.priceComponent == null)
551            this.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
552          return this.priceComponent;
553        }
554
555        /**
556         * @return Returns a reference to <code>this</code> for easy method chaining
557         */
558        public InvoiceLineItemComponent setPriceComponent(List<InvoiceLineItemPriceComponentComponent> thePriceComponent) { 
559          this.priceComponent = thePriceComponent;
560          return this;
561        }
562
563        public boolean hasPriceComponent() { 
564          if (this.priceComponent == null)
565            return false;
566          for (InvoiceLineItemPriceComponentComponent item : this.priceComponent)
567            if (!item.isEmpty())
568              return true;
569          return false;
570        }
571
572        public InvoiceLineItemPriceComponentComponent addPriceComponent() { //3
573          InvoiceLineItemPriceComponentComponent t = new InvoiceLineItemPriceComponentComponent();
574          if (this.priceComponent == null)
575            this.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
576          this.priceComponent.add(t);
577          return t;
578        }
579
580        public InvoiceLineItemComponent addPriceComponent(InvoiceLineItemPriceComponentComponent t) { //3
581          if (t == null)
582            return this;
583          if (this.priceComponent == null)
584            this.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
585          this.priceComponent.add(t);
586          return this;
587        }
588
589        /**
590         * @return The first repetition of repeating field {@link #priceComponent}, creating it if it does not already exist {3}
591         */
592        public InvoiceLineItemPriceComponentComponent getPriceComponentFirstRep() { 
593          if (getPriceComponent().isEmpty()) {
594            addPriceComponent();
595          }
596          return getPriceComponent().get(0);
597        }
598
599        protected void listChildren(List<Property> children) {
600          super.listChildren(children);
601          children.add(new Property("sequence", "positiveInt", "Sequence in which the items appear on the invoice.", 0, 1, sequence));
602          children.add(new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept", "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.", 0, 1, chargeItem));
603          children.add(new Property("priceComponent", "", "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.", 0, java.lang.Integer.MAX_VALUE, priceComponent));
604        }
605
606        @Override
607        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
608          switch (_hash) {
609          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence in which the items appear on the invoice.", 0, 1, sequence);
610          case 351104825: /*chargeItem[x]*/  return new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept", "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.", 0, 1, chargeItem);
611          case 1417779175: /*chargeItem*/  return new Property("chargeItem[x]", "Reference(ChargeItem)|CodeableConcept", "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.", 0, 1, chargeItem);
612          case 753580836: /*chargeItemReference*/  return new Property("chargeItem[x]", "Reference(ChargeItem)", "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.", 0, 1, chargeItem);
613          case 1226532026: /*chargeItemCodeableConcept*/  return new Property("chargeItem[x]", "CodeableConcept", "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.", 0, 1, chargeItem);
614          case 1219095988: /*priceComponent*/  return new Property("priceComponent", "", "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.", 0, java.lang.Integer.MAX_VALUE, priceComponent);
615          default: return super.getNamedProperty(_hash, _name, _checkValid);
616          }
617
618        }
619
620      @Override
621      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
622        switch (hash) {
623        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
624        case 1417779175: /*chargeItem*/ return this.chargeItem == null ? new Base[0] : new Base[] {this.chargeItem}; // DataType
625        case 1219095988: /*priceComponent*/ return this.priceComponent == null ? new Base[0] : this.priceComponent.toArray(new Base[this.priceComponent.size()]); // InvoiceLineItemPriceComponentComponent
626        default: return super.getProperty(hash, name, checkValid);
627        }
628
629      }
630
631      @Override
632      public Base setProperty(int hash, String name, Base value) throws FHIRException {
633        switch (hash) {
634        case 1349547969: // sequence
635          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
636          return value;
637        case 1417779175: // chargeItem
638          this.chargeItem = TypeConvertor.castToType(value); // DataType
639          return value;
640        case 1219095988: // priceComponent
641          this.getPriceComponent().add((InvoiceLineItemPriceComponentComponent) value); // InvoiceLineItemPriceComponentComponent
642          return value;
643        default: return super.setProperty(hash, name, value);
644        }
645
646      }
647
648      @Override
649      public Base setProperty(String name, Base value) throws FHIRException {
650        if (name.equals("sequence")) {
651          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
652        } else if (name.equals("chargeItem[x]")) {
653          this.chargeItem = TypeConvertor.castToType(value); // DataType
654        } else if (name.equals("priceComponent")) {
655          this.getPriceComponent().add((InvoiceLineItemPriceComponentComponent) value);
656        } else
657          return super.setProperty(name, value);
658        return value;
659      }
660
661      @Override
662      public Base makeProperty(int hash, String name) throws FHIRException {
663        switch (hash) {
664        case 1349547969:  return getSequenceElement();
665        case 351104825:  return getChargeItem();
666        case 1417779175:  return getChargeItem();
667        case 1219095988:  return addPriceComponent(); 
668        default: return super.makeProperty(hash, name);
669        }
670
671      }
672
673      @Override
674      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
675        switch (hash) {
676        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
677        case 1417779175: /*chargeItem*/ return new String[] {"Reference", "CodeableConcept"};
678        case 1219095988: /*priceComponent*/ return new String[] {};
679        default: return super.getTypesForProperty(hash, name);
680        }
681
682      }
683
684      @Override
685      public Base addChild(String name) throws FHIRException {
686        if (name.equals("sequence")) {
687          throw new FHIRException("Cannot call addChild on a primitive type Invoice.lineItem.sequence");
688        }
689        else if (name.equals("chargeItemReference")) {
690          this.chargeItem = new Reference();
691          return this.chargeItem;
692        }
693        else if (name.equals("chargeItemCodeableConcept")) {
694          this.chargeItem = new CodeableConcept();
695          return this.chargeItem;
696        }
697        else if (name.equals("priceComponent")) {
698          return addPriceComponent();
699        }
700        else
701          return super.addChild(name);
702      }
703
704      public InvoiceLineItemComponent copy() {
705        InvoiceLineItemComponent dst = new InvoiceLineItemComponent();
706        copyValues(dst);
707        return dst;
708      }
709
710      public void copyValues(InvoiceLineItemComponent dst) {
711        super.copyValues(dst);
712        dst.sequence = sequence == null ? null : sequence.copy();
713        dst.chargeItem = chargeItem == null ? null : chargeItem.copy();
714        if (priceComponent != null) {
715          dst.priceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
716          for (InvoiceLineItemPriceComponentComponent i : priceComponent)
717            dst.priceComponent.add(i.copy());
718        };
719      }
720
721      @Override
722      public boolean equalsDeep(Base other_) {
723        if (!super.equalsDeep(other_))
724          return false;
725        if (!(other_ instanceof InvoiceLineItemComponent))
726          return false;
727        InvoiceLineItemComponent o = (InvoiceLineItemComponent) other_;
728        return compareDeep(sequence, o.sequence, true) && compareDeep(chargeItem, o.chargeItem, true) && compareDeep(priceComponent, o.priceComponent, true)
729          ;
730      }
731
732      @Override
733      public boolean equalsShallow(Base other_) {
734        if (!super.equalsShallow(other_))
735          return false;
736        if (!(other_ instanceof InvoiceLineItemComponent))
737          return false;
738        InvoiceLineItemComponent o = (InvoiceLineItemComponent) other_;
739        return compareValues(sequence, o.sequence, true);
740      }
741
742      public boolean isEmpty() {
743        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, chargeItem, priceComponent
744          );
745      }
746
747  public String fhirType() {
748    return "Invoice.lineItem";
749
750  }
751
752  }
753
754    @Block()
755    public static class InvoiceLineItemPriceComponentComponent extends BackboneElement implements IBaseBackboneElement {
756        /**
757         * This code identifies the type of the component.
758         */
759        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
760        @Description(shortDefinition="base | surcharge | deduction | discount | tax | informational", formalDefinition="This code identifies the type of the component." )
761        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/invoice-priceComponentType")
762        protected Enumeration<InvoicePriceComponentType> type;
763
764        /**
765         * A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.
766         */
767        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
768        @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." )
769        protected CodeableConcept code;
770
771        /**
772         * The factor that has been applied on the base price for calculating this component.
773         */
774        @Child(name = "factor", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
775        @Description(shortDefinition="Factor used for calculating this component", formalDefinition="The factor that has been applied on the base price for calculating this component." )
776        protected DecimalType factor;
777
778        /**
779         * The amount calculated for this component.
780         */
781        @Child(name = "amount", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
782        @Description(shortDefinition="Monetary amount associated with this component", formalDefinition="The amount calculated for this component." )
783        protected Money amount;
784
785        private static final long serialVersionUID = 1223988958L;
786
787    /**
788     * Constructor
789     */
790      public InvoiceLineItemPriceComponentComponent() {
791        super();
792      }
793
794    /**
795     * Constructor
796     */
797      public InvoiceLineItemPriceComponentComponent(InvoicePriceComponentType type) {
798        super();
799        this.setType(type);
800      }
801
802        /**
803         * @return {@link #type} (This code identifies the type of the component.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
804         */
805        public Enumeration<InvoicePriceComponentType> getTypeElement() { 
806          if (this.type == null)
807            if (Configuration.errorOnAutoCreate())
808              throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.type");
809            else if (Configuration.doAutoCreate())
810              this.type = new Enumeration<InvoicePriceComponentType>(new InvoicePriceComponentTypeEnumFactory()); // bb
811          return this.type;
812        }
813
814        public boolean hasTypeElement() { 
815          return this.type != null && !this.type.isEmpty();
816        }
817
818        public boolean hasType() { 
819          return this.type != null && !this.type.isEmpty();
820        }
821
822        /**
823         * @param value {@link #type} (This code identifies the type of the component.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
824         */
825        public InvoiceLineItemPriceComponentComponent setTypeElement(Enumeration<InvoicePriceComponentType> value) { 
826          this.type = value;
827          return this;
828        }
829
830        /**
831         * @return This code identifies the type of the component.
832         */
833        public InvoicePriceComponentType getType() { 
834          return this.type == null ? null : this.type.getValue();
835        }
836
837        /**
838         * @param value This code identifies the type of the component.
839         */
840        public InvoiceLineItemPriceComponentComponent setType(InvoicePriceComponentType value) { 
841            if (this.type == null)
842              this.type = new Enumeration<InvoicePriceComponentType>(new InvoicePriceComponentTypeEnumFactory());
843            this.type.setValue(value);
844          return this;
845        }
846
847        /**
848         * @return {@link #code} (A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.)
849         */
850        public CodeableConcept getCode() { 
851          if (this.code == null)
852            if (Configuration.errorOnAutoCreate())
853              throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.code");
854            else if (Configuration.doAutoCreate())
855              this.code = new CodeableConcept(); // cc
856          return this.code;
857        }
858
859        public boolean hasCode() { 
860          return this.code != null && !this.code.isEmpty();
861        }
862
863        /**
864         * @param value {@link #code} (A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.)
865         */
866        public InvoiceLineItemPriceComponentComponent setCode(CodeableConcept value) { 
867          this.code = value;
868          return this;
869        }
870
871        /**
872         * @return {@link #factor} (The factor that has been applied on the base price for calculating this component.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
873         */
874        public DecimalType getFactorElement() { 
875          if (this.factor == null)
876            if (Configuration.errorOnAutoCreate())
877              throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.factor");
878            else if (Configuration.doAutoCreate())
879              this.factor = new DecimalType(); // bb
880          return this.factor;
881        }
882
883        public boolean hasFactorElement() { 
884          return this.factor != null && !this.factor.isEmpty();
885        }
886
887        public boolean hasFactor() { 
888          return this.factor != null && !this.factor.isEmpty();
889        }
890
891        /**
892         * @param value {@link #factor} (The factor that has been applied on the base price for calculating this component.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
893         */
894        public InvoiceLineItemPriceComponentComponent setFactorElement(DecimalType value) { 
895          this.factor = value;
896          return this;
897        }
898
899        /**
900         * @return The factor that has been applied on the base price for calculating this component.
901         */
902        public BigDecimal getFactor() { 
903          return this.factor == null ? null : this.factor.getValue();
904        }
905
906        /**
907         * @param value The factor that has been applied on the base price for calculating this component.
908         */
909        public InvoiceLineItemPriceComponentComponent setFactor(BigDecimal value) { 
910          if (value == null)
911            this.factor = null;
912          else {
913            if (this.factor == null)
914              this.factor = new DecimalType();
915            this.factor.setValue(value);
916          }
917          return this;
918        }
919
920        /**
921         * @param value The factor that has been applied on the base price for calculating this component.
922         */
923        public InvoiceLineItemPriceComponentComponent setFactor(long value) { 
924              this.factor = new DecimalType();
925            this.factor.setValue(value);
926          return this;
927        }
928
929        /**
930         * @param value The factor that has been applied on the base price for calculating this component.
931         */
932        public InvoiceLineItemPriceComponentComponent setFactor(double value) { 
933              this.factor = new DecimalType();
934            this.factor.setValue(value);
935          return this;
936        }
937
938        /**
939         * @return {@link #amount} (The amount calculated for this component.)
940         */
941        public Money getAmount() { 
942          if (this.amount == null)
943            if (Configuration.errorOnAutoCreate())
944              throw new Error("Attempt to auto-create InvoiceLineItemPriceComponentComponent.amount");
945            else if (Configuration.doAutoCreate())
946              this.amount = new Money(); // cc
947          return this.amount;
948        }
949
950        public boolean hasAmount() { 
951          return this.amount != null && !this.amount.isEmpty();
952        }
953
954        /**
955         * @param value {@link #amount} (The amount calculated for this component.)
956         */
957        public InvoiceLineItemPriceComponentComponent setAmount(Money value) { 
958          this.amount = value;
959          return this;
960        }
961
962        protected void listChildren(List<Property> children) {
963          super.listChildren(children);
964          children.add(new Property("type", "code", "This code identifies the type of the component.", 0, 1, type));
965          children.add(new Property("code", "CodeableConcept", "A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.", 0, 1, code));
966          children.add(new Property("factor", "decimal", "The factor that has been applied on the base price for calculating this component.", 0, 1, factor));
967          children.add(new Property("amount", "Money", "The amount calculated for this component.", 0, 1, amount));
968        }
969
970        @Override
971        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
972          switch (_hash) {
973          case 3575610: /*type*/  return new Property("type", "code", "This code identifies the type of the component.", 0, 1, type);
974          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code that identifies the component. Codes may be used to differentiate between kinds of taxes, surcharges, discounts etc.", 0, 1, code);
975          case -1282148017: /*factor*/  return new Property("factor", "decimal", "The factor that has been applied on the base price for calculating this component.", 0, 1, factor);
976          case -1413853096: /*amount*/  return new Property("amount", "Money", "The amount calculated for this component.", 0, 1, amount);
977          default: return super.getNamedProperty(_hash, _name, _checkValid);
978          }
979
980        }
981
982      @Override
983      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
984        switch (hash) {
985        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<InvoicePriceComponentType>
986        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
987        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
988        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
989        default: return super.getProperty(hash, name, checkValid);
990        }
991
992      }
993
994      @Override
995      public Base setProperty(int hash, String name, Base value) throws FHIRException {
996        switch (hash) {
997        case 3575610: // type
998          value = new InvoicePriceComponentTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
999          this.type = (Enumeration) value; // Enumeration<InvoicePriceComponentType>
1000          return value;
1001        case 3059181: // code
1002          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1003          return value;
1004        case -1282148017: // factor
1005          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
1006          return value;
1007        case -1413853096: // amount
1008          this.amount = TypeConvertor.castToMoney(value); // Money
1009          return value;
1010        default: return super.setProperty(hash, name, value);
1011        }
1012
1013      }
1014
1015      @Override
1016      public Base setProperty(String name, Base value) throws FHIRException {
1017        if (name.equals("type")) {
1018          value = new InvoicePriceComponentTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1019          this.type = (Enumeration) value; // Enumeration<InvoicePriceComponentType>
1020        } else if (name.equals("code")) {
1021          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1022        } else if (name.equals("factor")) {
1023          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
1024        } else if (name.equals("amount")) {
1025          this.amount = TypeConvertor.castToMoney(value); // Money
1026        } else
1027          return super.setProperty(name, value);
1028        return value;
1029      }
1030
1031      @Override
1032      public Base makeProperty(int hash, String name) throws FHIRException {
1033        switch (hash) {
1034        case 3575610:  return getTypeElement();
1035        case 3059181:  return getCode();
1036        case -1282148017:  return getFactorElement();
1037        case -1413853096:  return getAmount();
1038        default: return super.makeProperty(hash, name);
1039        }
1040
1041      }
1042
1043      @Override
1044      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1045        switch (hash) {
1046        case 3575610: /*type*/ return new String[] {"code"};
1047        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1048        case -1282148017: /*factor*/ return new String[] {"decimal"};
1049        case -1413853096: /*amount*/ return new String[] {"Money"};
1050        default: return super.getTypesForProperty(hash, name);
1051        }
1052
1053      }
1054
1055      @Override
1056      public Base addChild(String name) throws FHIRException {
1057        if (name.equals("type")) {
1058          throw new FHIRException("Cannot call addChild on a primitive type Invoice.lineItem.priceComponent.type");
1059        }
1060        else if (name.equals("code")) {
1061          this.code = new CodeableConcept();
1062          return this.code;
1063        }
1064        else if (name.equals("factor")) {
1065          throw new FHIRException("Cannot call addChild on a primitive type Invoice.lineItem.priceComponent.factor");
1066        }
1067        else if (name.equals("amount")) {
1068          this.amount = new Money();
1069          return this.amount;
1070        }
1071        else
1072          return super.addChild(name);
1073      }
1074
1075      public InvoiceLineItemPriceComponentComponent copy() {
1076        InvoiceLineItemPriceComponentComponent dst = new InvoiceLineItemPriceComponentComponent();
1077        copyValues(dst);
1078        return dst;
1079      }
1080
1081      public void copyValues(InvoiceLineItemPriceComponentComponent dst) {
1082        super.copyValues(dst);
1083        dst.type = type == null ? null : type.copy();
1084        dst.code = code == null ? null : code.copy();
1085        dst.factor = factor == null ? null : factor.copy();
1086        dst.amount = amount == null ? null : amount.copy();
1087      }
1088
1089      @Override
1090      public boolean equalsDeep(Base other_) {
1091        if (!super.equalsDeep(other_))
1092          return false;
1093        if (!(other_ instanceof InvoiceLineItemPriceComponentComponent))
1094          return false;
1095        InvoiceLineItemPriceComponentComponent o = (InvoiceLineItemPriceComponentComponent) other_;
1096        return compareDeep(type, o.type, true) && compareDeep(code, o.code, true) && compareDeep(factor, o.factor, true)
1097           && compareDeep(amount, o.amount, true);
1098      }
1099
1100      @Override
1101      public boolean equalsShallow(Base other_) {
1102        if (!super.equalsShallow(other_))
1103          return false;
1104        if (!(other_ instanceof InvoiceLineItemPriceComponentComponent))
1105          return false;
1106        InvoiceLineItemPriceComponentComponent o = (InvoiceLineItemPriceComponentComponent) other_;
1107        return compareValues(type, o.type, true) && compareValues(factor, o.factor, true);
1108      }
1109
1110      public boolean isEmpty() {
1111        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, code, factor, amount
1112          );
1113      }
1114
1115  public String fhirType() {
1116    return "Invoice.lineItem.priceComponent";
1117
1118  }
1119
1120  }
1121
1122    /**
1123     * Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.
1124     */
1125    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1126    @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." )
1127    protected List<Identifier> identifier;
1128
1129    /**
1130     * The current state of the Invoice.
1131     */
1132    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1133    @Description(shortDefinition="draft | issued | balanced | cancelled | entered-in-error", formalDefinition="The current state of the Invoice." )
1134    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/invoice-status")
1135    protected Enumeration<InvoiceStatus> status;
1136
1137    /**
1138     * In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).
1139     */
1140    @Child(name = "cancelledReason", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1141    @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.)." )
1142    protected StringType cancelledReason;
1143
1144    /**
1145     * Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).
1146     */
1147    @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1148    @Description(shortDefinition="Type of Invoice", formalDefinition="Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary)." )
1149    protected CodeableConcept type;
1150
1151    /**
1152     * The individual or set of individuals receiving the goods and services billed in this invoice.
1153     */
1154    @Child(name = "subject", type = {Patient.class, Group.class}, order=4, min=0, max=1, modifier=false, summary=true)
1155    @Description(shortDefinition="Recipient(s) of goods and services", formalDefinition="The individual or set of individuals receiving the goods and services billed in this invoice." )
1156    protected Reference subject;
1157
1158    /**
1159     * The individual or Organization responsible for balancing of this invoice.
1160     */
1161    @Child(name = "recipient", type = {Organization.class, Patient.class, RelatedPerson.class}, order=5, min=0, max=1, modifier=false, summary=true)
1162    @Description(shortDefinition="Recipient of this invoice", formalDefinition="The individual or Organization responsible for balancing of this invoice." )
1163    protected Reference recipient;
1164
1165    /**
1166     * Date/time(s) of when this Invoice was posted.
1167     */
1168    @Child(name = "date", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1169    @Description(shortDefinition="Invoice date / posting date", formalDefinition="Date/time(s) of when this Invoice was posted." )
1170    protected DateTimeType date;
1171
1172    /**
1173     * Indicates who or what performed or participated in the charged service.
1174     */
1175    @Child(name = "participant", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1176    @Description(shortDefinition="Participant in creation of this Invoice", formalDefinition="Indicates who or what performed or participated in the charged service." )
1177    protected List<InvoiceParticipantComponent> participant;
1178
1179    /**
1180     * The organizationissuing the Invoice.
1181     */
1182    @Child(name = "issuer", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
1183    @Description(shortDefinition="Issuing Organization of Invoice", formalDefinition="The organizationissuing the Invoice." )
1184    protected Reference issuer;
1185
1186    /**
1187     * Account which is supposed to be balanced with this Invoice.
1188     */
1189    @Child(name = "account", type = {Account.class}, order=9, min=0, max=1, modifier=false, summary=false)
1190    @Description(shortDefinition="Account that is being balanced", formalDefinition="Account which is supposed to be balanced with this Invoice." )
1191    protected Reference account;
1192
1193    /**
1194     * 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.
1195     */
1196    @Child(name = "lineItem", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1197    @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." )
1198    protected List<InvoiceLineItemComponent> lineItem;
1199
1200    /**
1201     * 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.
1202     */
1203    @Child(name = "totalPriceComponent", type = {InvoiceLineItemPriceComponentComponent.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1204    @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." )
1205    protected List<InvoiceLineItemPriceComponentComponent> totalPriceComponent;
1206
1207    /**
1208     * Invoice total , taxes excluded.
1209     */
1210    @Child(name = "totalNet", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=true)
1211    @Description(shortDefinition="Net total of this Invoice", formalDefinition="Invoice total , taxes excluded." )
1212    protected Money totalNet;
1213
1214    /**
1215     * Invoice total, tax included.
1216     */
1217    @Child(name = "totalGross", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=true)
1218    @Description(shortDefinition="Gross total of this Invoice", formalDefinition="Invoice total, tax included." )
1219    protected Money totalGross;
1220
1221    /**
1222     * Payment details such as banking details, period of payment, deductibles, methods of payment.
1223     */
1224    @Child(name = "paymentTerms", type = {MarkdownType.class}, order=14, min=0, max=1, modifier=false, summary=false)
1225    @Description(shortDefinition="Payment details", formalDefinition="Payment details such as banking details, period of payment, deductibles, methods of payment." )
1226    protected MarkdownType paymentTerms;
1227
1228    /**
1229     * Comments made about the invoice by the issuer, subject, or other participants.
1230     */
1231    @Child(name = "note", type = {Annotation.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1232    @Description(shortDefinition="Comments made about the invoice", formalDefinition="Comments made about the invoice by the issuer, subject, or other participants." )
1233    protected List<Annotation> note;
1234
1235    private static final long serialVersionUID = -841380390L;
1236
1237  /**
1238   * Constructor
1239   */
1240    public Invoice() {
1241      super();
1242    }
1243
1244  /**
1245   * Constructor
1246   */
1247    public Invoice(InvoiceStatus status) {
1248      super();
1249      this.setStatus(status);
1250    }
1251
1252    /**
1253     * @return {@link #identifier} (Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.)
1254     */
1255    public List<Identifier> getIdentifier() { 
1256      if (this.identifier == null)
1257        this.identifier = new ArrayList<Identifier>();
1258      return this.identifier;
1259    }
1260
1261    /**
1262     * @return Returns a reference to <code>this</code> for easy method chaining
1263     */
1264    public Invoice setIdentifier(List<Identifier> theIdentifier) { 
1265      this.identifier = theIdentifier;
1266      return this;
1267    }
1268
1269    public boolean hasIdentifier() { 
1270      if (this.identifier == null)
1271        return false;
1272      for (Identifier item : this.identifier)
1273        if (!item.isEmpty())
1274          return true;
1275      return false;
1276    }
1277
1278    public Identifier addIdentifier() { //3
1279      Identifier t = new Identifier();
1280      if (this.identifier == null)
1281        this.identifier = new ArrayList<Identifier>();
1282      this.identifier.add(t);
1283      return t;
1284    }
1285
1286    public Invoice addIdentifier(Identifier t) { //3
1287      if (t == null)
1288        return this;
1289      if (this.identifier == null)
1290        this.identifier = new ArrayList<Identifier>();
1291      this.identifier.add(t);
1292      return this;
1293    }
1294
1295    /**
1296     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1297     */
1298    public Identifier getIdentifierFirstRep() { 
1299      if (getIdentifier().isEmpty()) {
1300        addIdentifier();
1301      }
1302      return getIdentifier().get(0);
1303    }
1304
1305    /**
1306     * @return {@link #status} (The current state of the Invoice.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1307     */
1308    public Enumeration<InvoiceStatus> getStatusElement() { 
1309      if (this.status == null)
1310        if (Configuration.errorOnAutoCreate())
1311          throw new Error("Attempt to auto-create Invoice.status");
1312        else if (Configuration.doAutoCreate())
1313          this.status = new Enumeration<InvoiceStatus>(new InvoiceStatusEnumFactory()); // bb
1314      return this.status;
1315    }
1316
1317    public boolean hasStatusElement() { 
1318      return this.status != null && !this.status.isEmpty();
1319    }
1320
1321    public boolean hasStatus() { 
1322      return this.status != null && !this.status.isEmpty();
1323    }
1324
1325    /**
1326     * @param value {@link #status} (The current state of the Invoice.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1327     */
1328    public Invoice setStatusElement(Enumeration<InvoiceStatus> value) { 
1329      this.status = value;
1330      return this;
1331    }
1332
1333    /**
1334     * @return The current state of the Invoice.
1335     */
1336    public InvoiceStatus getStatus() { 
1337      return this.status == null ? null : this.status.getValue();
1338    }
1339
1340    /**
1341     * @param value The current state of the Invoice.
1342     */
1343    public Invoice setStatus(InvoiceStatus value) { 
1344        if (this.status == null)
1345          this.status = new Enumeration<InvoiceStatus>(new InvoiceStatusEnumFactory());
1346        this.status.setValue(value);
1347      return this;
1348    }
1349
1350    /**
1351     * @return {@link #cancelledReason} (In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).). This is the underlying object with id, value and extensions. The accessor "getCancelledReason" gives direct access to the value
1352     */
1353    public StringType getCancelledReasonElement() { 
1354      if (this.cancelledReason == null)
1355        if (Configuration.errorOnAutoCreate())
1356          throw new Error("Attempt to auto-create Invoice.cancelledReason");
1357        else if (Configuration.doAutoCreate())
1358          this.cancelledReason = new StringType(); // bb
1359      return this.cancelledReason;
1360    }
1361
1362    public boolean hasCancelledReasonElement() { 
1363      return this.cancelledReason != null && !this.cancelledReason.isEmpty();
1364    }
1365
1366    public boolean hasCancelledReason() { 
1367      return this.cancelledReason != null && !this.cancelledReason.isEmpty();
1368    }
1369
1370    /**
1371     * @param value {@link #cancelledReason} (In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).). This is the underlying object with id, value and extensions. The accessor "getCancelledReason" gives direct access to the value
1372     */
1373    public Invoice setCancelledReasonElement(StringType value) { 
1374      this.cancelledReason = value;
1375      return this;
1376    }
1377
1378    /**
1379     * @return In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).
1380     */
1381    public String getCancelledReason() { 
1382      return this.cancelledReason == null ? null : this.cancelledReason.getValue();
1383    }
1384
1385    /**
1386     * @param value In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).
1387     */
1388    public Invoice setCancelledReason(String value) { 
1389      if (Utilities.noString(value))
1390        this.cancelledReason = null;
1391      else {
1392        if (this.cancelledReason == null)
1393          this.cancelledReason = new StringType();
1394        this.cancelledReason.setValue(value);
1395      }
1396      return this;
1397    }
1398
1399    /**
1400     * @return {@link #type} (Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).)
1401     */
1402    public CodeableConcept getType() { 
1403      if (this.type == null)
1404        if (Configuration.errorOnAutoCreate())
1405          throw new Error("Attempt to auto-create Invoice.type");
1406        else if (Configuration.doAutoCreate())
1407          this.type = new CodeableConcept(); // cc
1408      return this.type;
1409    }
1410
1411    public boolean hasType() { 
1412      return this.type != null && !this.type.isEmpty();
1413    }
1414
1415    /**
1416     * @param value {@link #type} (Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).)
1417     */
1418    public Invoice setType(CodeableConcept value) { 
1419      this.type = value;
1420      return this;
1421    }
1422
1423    /**
1424     * @return {@link #subject} (The individual or set of individuals receiving the goods and services billed in this invoice.)
1425     */
1426    public Reference getSubject() { 
1427      if (this.subject == null)
1428        if (Configuration.errorOnAutoCreate())
1429          throw new Error("Attempt to auto-create Invoice.subject");
1430        else if (Configuration.doAutoCreate())
1431          this.subject = new Reference(); // cc
1432      return this.subject;
1433    }
1434
1435    public boolean hasSubject() { 
1436      return this.subject != null && !this.subject.isEmpty();
1437    }
1438
1439    /**
1440     * @param value {@link #subject} (The individual or set of individuals receiving the goods and services billed in this invoice.)
1441     */
1442    public Invoice setSubject(Reference value) { 
1443      this.subject = value;
1444      return this;
1445    }
1446
1447    /**
1448     * @return {@link #recipient} (The individual or Organization responsible for balancing of this invoice.)
1449     */
1450    public Reference getRecipient() { 
1451      if (this.recipient == null)
1452        if (Configuration.errorOnAutoCreate())
1453          throw new Error("Attempt to auto-create Invoice.recipient");
1454        else if (Configuration.doAutoCreate())
1455          this.recipient = new Reference(); // cc
1456      return this.recipient;
1457    }
1458
1459    public boolean hasRecipient() { 
1460      return this.recipient != null && !this.recipient.isEmpty();
1461    }
1462
1463    /**
1464     * @param value {@link #recipient} (The individual or Organization responsible for balancing of this invoice.)
1465     */
1466    public Invoice setRecipient(Reference value) { 
1467      this.recipient = value;
1468      return this;
1469    }
1470
1471    /**
1472     * @return {@link #date} (Date/time(s) of when this Invoice was posted.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1473     */
1474    public DateTimeType getDateElement() { 
1475      if (this.date == null)
1476        if (Configuration.errorOnAutoCreate())
1477          throw new Error("Attempt to auto-create Invoice.date");
1478        else if (Configuration.doAutoCreate())
1479          this.date = new DateTimeType(); // bb
1480      return this.date;
1481    }
1482
1483    public boolean hasDateElement() { 
1484      return this.date != null && !this.date.isEmpty();
1485    }
1486
1487    public boolean hasDate() { 
1488      return this.date != null && !this.date.isEmpty();
1489    }
1490
1491    /**
1492     * @param value {@link #date} (Date/time(s) of when this Invoice was posted.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1493     */
1494    public Invoice setDateElement(DateTimeType value) { 
1495      this.date = value;
1496      return this;
1497    }
1498
1499    /**
1500     * @return Date/time(s) of when this Invoice was posted.
1501     */
1502    public Date getDate() { 
1503      return this.date == null ? null : this.date.getValue();
1504    }
1505
1506    /**
1507     * @param value Date/time(s) of when this Invoice was posted.
1508     */
1509    public Invoice setDate(Date value) { 
1510      if (value == null)
1511        this.date = null;
1512      else {
1513        if (this.date == null)
1514          this.date = new DateTimeType();
1515        this.date.setValue(value);
1516      }
1517      return this;
1518    }
1519
1520    /**
1521     * @return {@link #participant} (Indicates who or what performed or participated in the charged service.)
1522     */
1523    public List<InvoiceParticipantComponent> getParticipant() { 
1524      if (this.participant == null)
1525        this.participant = new ArrayList<InvoiceParticipantComponent>();
1526      return this.participant;
1527    }
1528
1529    /**
1530     * @return Returns a reference to <code>this</code> for easy method chaining
1531     */
1532    public Invoice setParticipant(List<InvoiceParticipantComponent> theParticipant) { 
1533      this.participant = theParticipant;
1534      return this;
1535    }
1536
1537    public boolean hasParticipant() { 
1538      if (this.participant == null)
1539        return false;
1540      for (InvoiceParticipantComponent item : this.participant)
1541        if (!item.isEmpty())
1542          return true;
1543      return false;
1544    }
1545
1546    public InvoiceParticipantComponent addParticipant() { //3
1547      InvoiceParticipantComponent t = new InvoiceParticipantComponent();
1548      if (this.participant == null)
1549        this.participant = new ArrayList<InvoiceParticipantComponent>();
1550      this.participant.add(t);
1551      return t;
1552    }
1553
1554    public Invoice addParticipant(InvoiceParticipantComponent t) { //3
1555      if (t == null)
1556        return this;
1557      if (this.participant == null)
1558        this.participant = new ArrayList<InvoiceParticipantComponent>();
1559      this.participant.add(t);
1560      return this;
1561    }
1562
1563    /**
1564     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist {3}
1565     */
1566    public InvoiceParticipantComponent getParticipantFirstRep() { 
1567      if (getParticipant().isEmpty()) {
1568        addParticipant();
1569      }
1570      return getParticipant().get(0);
1571    }
1572
1573    /**
1574     * @return {@link #issuer} (The organizationissuing the Invoice.)
1575     */
1576    public Reference getIssuer() { 
1577      if (this.issuer == null)
1578        if (Configuration.errorOnAutoCreate())
1579          throw new Error("Attempt to auto-create Invoice.issuer");
1580        else if (Configuration.doAutoCreate())
1581          this.issuer = new Reference(); // cc
1582      return this.issuer;
1583    }
1584
1585    public boolean hasIssuer() { 
1586      return this.issuer != null && !this.issuer.isEmpty();
1587    }
1588
1589    /**
1590     * @param value {@link #issuer} (The organizationissuing the Invoice.)
1591     */
1592    public Invoice setIssuer(Reference value) { 
1593      this.issuer = value;
1594      return this;
1595    }
1596
1597    /**
1598     * @return {@link #account} (Account which is supposed to be balanced with this Invoice.)
1599     */
1600    public Reference getAccount() { 
1601      if (this.account == null)
1602        if (Configuration.errorOnAutoCreate())
1603          throw new Error("Attempt to auto-create Invoice.account");
1604        else if (Configuration.doAutoCreate())
1605          this.account = new Reference(); // cc
1606      return this.account;
1607    }
1608
1609    public boolean hasAccount() { 
1610      return this.account != null && !this.account.isEmpty();
1611    }
1612
1613    /**
1614     * @param value {@link #account} (Account which is supposed to be balanced with this Invoice.)
1615     */
1616    public Invoice setAccount(Reference value) { 
1617      this.account = value;
1618      return this;
1619    }
1620
1621    /**
1622     * @return {@link #lineItem} (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.)
1623     */
1624    public List<InvoiceLineItemComponent> getLineItem() { 
1625      if (this.lineItem == null)
1626        this.lineItem = new ArrayList<InvoiceLineItemComponent>();
1627      return this.lineItem;
1628    }
1629
1630    /**
1631     * @return Returns a reference to <code>this</code> for easy method chaining
1632     */
1633    public Invoice setLineItem(List<InvoiceLineItemComponent> theLineItem) { 
1634      this.lineItem = theLineItem;
1635      return this;
1636    }
1637
1638    public boolean hasLineItem() { 
1639      if (this.lineItem == null)
1640        return false;
1641      for (InvoiceLineItemComponent item : this.lineItem)
1642        if (!item.isEmpty())
1643          return true;
1644      return false;
1645    }
1646
1647    public InvoiceLineItemComponent addLineItem() { //3
1648      InvoiceLineItemComponent t = new InvoiceLineItemComponent();
1649      if (this.lineItem == null)
1650        this.lineItem = new ArrayList<InvoiceLineItemComponent>();
1651      this.lineItem.add(t);
1652      return t;
1653    }
1654
1655    public Invoice addLineItem(InvoiceLineItemComponent t) { //3
1656      if (t == null)
1657        return this;
1658      if (this.lineItem == null)
1659        this.lineItem = new ArrayList<InvoiceLineItemComponent>();
1660      this.lineItem.add(t);
1661      return this;
1662    }
1663
1664    /**
1665     * @return The first repetition of repeating field {@link #lineItem}, creating it if it does not already exist {3}
1666     */
1667    public InvoiceLineItemComponent getLineItemFirstRep() { 
1668      if (getLineItem().isEmpty()) {
1669        addLineItem();
1670      }
1671      return getLineItem().get(0);
1672    }
1673
1674    /**
1675     * @return {@link #totalPriceComponent} (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.)
1676     */
1677    public List<InvoiceLineItemPriceComponentComponent> getTotalPriceComponent() { 
1678      if (this.totalPriceComponent == null)
1679        this.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
1680      return this.totalPriceComponent;
1681    }
1682
1683    /**
1684     * @return Returns a reference to <code>this</code> for easy method chaining
1685     */
1686    public Invoice setTotalPriceComponent(List<InvoiceLineItemPriceComponentComponent> theTotalPriceComponent) { 
1687      this.totalPriceComponent = theTotalPriceComponent;
1688      return this;
1689    }
1690
1691    public boolean hasTotalPriceComponent() { 
1692      if (this.totalPriceComponent == null)
1693        return false;
1694      for (InvoiceLineItemPriceComponentComponent item : this.totalPriceComponent)
1695        if (!item.isEmpty())
1696          return true;
1697      return false;
1698    }
1699
1700    public InvoiceLineItemPriceComponentComponent addTotalPriceComponent() { //3
1701      InvoiceLineItemPriceComponentComponent t = new InvoiceLineItemPriceComponentComponent();
1702      if (this.totalPriceComponent == null)
1703        this.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
1704      this.totalPriceComponent.add(t);
1705      return t;
1706    }
1707
1708    public Invoice addTotalPriceComponent(InvoiceLineItemPriceComponentComponent t) { //3
1709      if (t == null)
1710        return this;
1711      if (this.totalPriceComponent == null)
1712        this.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
1713      this.totalPriceComponent.add(t);
1714      return this;
1715    }
1716
1717    /**
1718     * @return The first repetition of repeating field {@link #totalPriceComponent}, creating it if it does not already exist {3}
1719     */
1720    public InvoiceLineItemPriceComponentComponent getTotalPriceComponentFirstRep() { 
1721      if (getTotalPriceComponent().isEmpty()) {
1722        addTotalPriceComponent();
1723      }
1724      return getTotalPriceComponent().get(0);
1725    }
1726
1727    /**
1728     * @return {@link #totalNet} (Invoice total , taxes excluded.)
1729     */
1730    public Money getTotalNet() { 
1731      if (this.totalNet == null)
1732        if (Configuration.errorOnAutoCreate())
1733          throw new Error("Attempt to auto-create Invoice.totalNet");
1734        else if (Configuration.doAutoCreate())
1735          this.totalNet = new Money(); // cc
1736      return this.totalNet;
1737    }
1738
1739    public boolean hasTotalNet() { 
1740      return this.totalNet != null && !this.totalNet.isEmpty();
1741    }
1742
1743    /**
1744     * @param value {@link #totalNet} (Invoice total , taxes excluded.)
1745     */
1746    public Invoice setTotalNet(Money value) { 
1747      this.totalNet = value;
1748      return this;
1749    }
1750
1751    /**
1752     * @return {@link #totalGross} (Invoice total, tax included.)
1753     */
1754    public Money getTotalGross() { 
1755      if (this.totalGross == null)
1756        if (Configuration.errorOnAutoCreate())
1757          throw new Error("Attempt to auto-create Invoice.totalGross");
1758        else if (Configuration.doAutoCreate())
1759          this.totalGross = new Money(); // cc
1760      return this.totalGross;
1761    }
1762
1763    public boolean hasTotalGross() { 
1764      return this.totalGross != null && !this.totalGross.isEmpty();
1765    }
1766
1767    /**
1768     * @param value {@link #totalGross} (Invoice total, tax included.)
1769     */
1770    public Invoice setTotalGross(Money value) { 
1771      this.totalGross = value;
1772      return this;
1773    }
1774
1775    /**
1776     * @return {@link #paymentTerms} (Payment details such as banking details, period of payment, deductibles, methods of payment.). This is the underlying object with id, value and extensions. The accessor "getPaymentTerms" gives direct access to the value
1777     */
1778    public MarkdownType getPaymentTermsElement() { 
1779      if (this.paymentTerms == null)
1780        if (Configuration.errorOnAutoCreate())
1781          throw new Error("Attempt to auto-create Invoice.paymentTerms");
1782        else if (Configuration.doAutoCreate())
1783          this.paymentTerms = new MarkdownType(); // bb
1784      return this.paymentTerms;
1785    }
1786
1787    public boolean hasPaymentTermsElement() { 
1788      return this.paymentTerms != null && !this.paymentTerms.isEmpty();
1789    }
1790
1791    public boolean hasPaymentTerms() { 
1792      return this.paymentTerms != null && !this.paymentTerms.isEmpty();
1793    }
1794
1795    /**
1796     * @param value {@link #paymentTerms} (Payment details such as banking details, period of payment, deductibles, methods of payment.). This is the underlying object with id, value and extensions. The accessor "getPaymentTerms" gives direct access to the value
1797     */
1798    public Invoice setPaymentTermsElement(MarkdownType value) { 
1799      this.paymentTerms = value;
1800      return this;
1801    }
1802
1803    /**
1804     * @return Payment details such as banking details, period of payment, deductibles, methods of payment.
1805     */
1806    public String getPaymentTerms() { 
1807      return this.paymentTerms == null ? null : this.paymentTerms.getValue();
1808    }
1809
1810    /**
1811     * @param value Payment details such as banking details, period of payment, deductibles, methods of payment.
1812     */
1813    public Invoice setPaymentTerms(String value) { 
1814      if (value == null)
1815        this.paymentTerms = null;
1816      else {
1817        if (this.paymentTerms == null)
1818          this.paymentTerms = new MarkdownType();
1819        this.paymentTerms.setValue(value);
1820      }
1821      return this;
1822    }
1823
1824    /**
1825     * @return {@link #note} (Comments made about the invoice by the issuer, subject, or other participants.)
1826     */
1827    public List<Annotation> getNote() { 
1828      if (this.note == null)
1829        this.note = new ArrayList<Annotation>();
1830      return this.note;
1831    }
1832
1833    /**
1834     * @return Returns a reference to <code>this</code> for easy method chaining
1835     */
1836    public Invoice setNote(List<Annotation> theNote) { 
1837      this.note = theNote;
1838      return this;
1839    }
1840
1841    public boolean hasNote() { 
1842      if (this.note == null)
1843        return false;
1844      for (Annotation item : this.note)
1845        if (!item.isEmpty())
1846          return true;
1847      return false;
1848    }
1849
1850    public Annotation addNote() { //3
1851      Annotation t = new Annotation();
1852      if (this.note == null)
1853        this.note = new ArrayList<Annotation>();
1854      this.note.add(t);
1855      return t;
1856    }
1857
1858    public Invoice addNote(Annotation t) { //3
1859      if (t == null)
1860        return this;
1861      if (this.note == null)
1862        this.note = new ArrayList<Annotation>();
1863      this.note.add(t);
1864      return this;
1865    }
1866
1867    /**
1868     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1869     */
1870    public Annotation getNoteFirstRep() { 
1871      if (getNote().isEmpty()) {
1872        addNote();
1873      }
1874      return getNote().get(0);
1875    }
1876
1877      protected void listChildren(List<Property> children) {
1878        super.listChildren(children);
1879        children.add(new Property("identifier", "Identifier", "Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.", 0, java.lang.Integer.MAX_VALUE, identifier));
1880        children.add(new Property("status", "code", "The current state of the Invoice.", 0, 1, status));
1881        children.add(new Property("cancelledReason", "string", "In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).", 0, 1, cancelledReason));
1882        children.add(new Property("type", "CodeableConcept", "Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).", 0, 1, type));
1883        children.add(new Property("subject", "Reference(Patient|Group)", "The individual or set of individuals receiving the goods and services billed in this invoice.", 0, 1, subject));
1884        children.add(new Property("recipient", "Reference(Organization|Patient|RelatedPerson)", "The individual or Organization responsible for balancing of this invoice.", 0, 1, recipient));
1885        children.add(new Property("date", "dateTime", "Date/time(s) of when this Invoice was posted.", 0, 1, date));
1886        children.add(new Property("participant", "", "Indicates who or what performed or participated in the charged service.", 0, java.lang.Integer.MAX_VALUE, participant));
1887        children.add(new Property("issuer", "Reference(Organization)", "The organizationissuing the Invoice.", 0, 1, issuer));
1888        children.add(new Property("account", "Reference(Account)", "Account which is supposed to be balanced with this Invoice.", 0, 1, account));
1889        children.add(new Property("lineItem", "", "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.", 0, java.lang.Integer.MAX_VALUE, lineItem));
1890        children.add(new Property("totalPriceComponent", "@Invoice.lineItem.priceComponent", "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.", 0, java.lang.Integer.MAX_VALUE, totalPriceComponent));
1891        children.add(new Property("totalNet", "Money", "Invoice total , taxes excluded.", 0, 1, totalNet));
1892        children.add(new Property("totalGross", "Money", "Invoice total, tax included.", 0, 1, totalGross));
1893        children.add(new Property("paymentTerms", "markdown", "Payment details such as banking details, period of payment, deductibles, methods of payment.", 0, 1, paymentTerms));
1894        children.add(new Property("note", "Annotation", "Comments made about the invoice by the issuer, subject, or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
1895      }
1896
1897      @Override
1898      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1899        switch (_hash) {
1900        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.", 0, java.lang.Integer.MAX_VALUE, identifier);
1901        case -892481550: /*status*/  return new Property("status", "code", "The current state of the Invoice.", 0, 1, status);
1902        case 1550362357: /*cancelledReason*/  return new Property("cancelledReason", "string", "In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).", 0, 1, cancelledReason);
1903        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).", 0, 1, type);
1904        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The individual or set of individuals receiving the goods and services billed in this invoice.", 0, 1, subject);
1905        case 820081177: /*recipient*/  return new Property("recipient", "Reference(Organization|Patient|RelatedPerson)", "The individual or Organization responsible for balancing of this invoice.", 0, 1, recipient);
1906        case 3076014: /*date*/  return new Property("date", "dateTime", "Date/time(s) of when this Invoice was posted.", 0, 1, date);
1907        case 767422259: /*participant*/  return new Property("participant", "", "Indicates who or what performed or participated in the charged service.", 0, java.lang.Integer.MAX_VALUE, participant);
1908        case -1179159879: /*issuer*/  return new Property("issuer", "Reference(Organization)", "The organizationissuing the Invoice.", 0, 1, issuer);
1909        case -1177318867: /*account*/  return new Property("account", "Reference(Account)", "Account which is supposed to be balanced with this Invoice.", 0, 1, account);
1910        case 1188332839: /*lineItem*/  return new Property("lineItem", "", "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.", 0, java.lang.Integer.MAX_VALUE, lineItem);
1911        case 1731497496: /*totalPriceComponent*/  return new Property("totalPriceComponent", "@Invoice.lineItem.priceComponent", "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.", 0, java.lang.Integer.MAX_VALUE, totalPriceComponent);
1912        case -849911879: /*totalNet*/  return new Property("totalNet", "Money", "Invoice total , taxes excluded.", 0, 1, totalNet);
1913        case -727607968: /*totalGross*/  return new Property("totalGross", "Money", "Invoice total, tax included.", 0, 1, totalGross);
1914        case -507544799: /*paymentTerms*/  return new Property("paymentTerms", "markdown", "Payment details such as banking details, period of payment, deductibles, methods of payment.", 0, 1, paymentTerms);
1915        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the invoice by the issuer, subject, or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
1916        default: return super.getNamedProperty(_hash, _name, _checkValid);
1917        }
1918
1919      }
1920
1921      @Override
1922      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1923        switch (hash) {
1924        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1925        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<InvoiceStatus>
1926        case 1550362357: /*cancelledReason*/ return this.cancelledReason == null ? new Base[0] : new Base[] {this.cancelledReason}; // StringType
1927        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1928        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1929        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : new Base[] {this.recipient}; // Reference
1930        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
1931        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // InvoiceParticipantComponent
1932        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // Reference
1933        case -1177318867: /*account*/ return this.account == null ? new Base[0] : new Base[] {this.account}; // Reference
1934        case 1188332839: /*lineItem*/ return this.lineItem == null ? new Base[0] : this.lineItem.toArray(new Base[this.lineItem.size()]); // InvoiceLineItemComponent
1935        case 1731497496: /*totalPriceComponent*/ return this.totalPriceComponent == null ? new Base[0] : this.totalPriceComponent.toArray(new Base[this.totalPriceComponent.size()]); // InvoiceLineItemPriceComponentComponent
1936        case -849911879: /*totalNet*/ return this.totalNet == null ? new Base[0] : new Base[] {this.totalNet}; // Money
1937        case -727607968: /*totalGross*/ return this.totalGross == null ? new Base[0] : new Base[] {this.totalGross}; // Money
1938        case -507544799: /*paymentTerms*/ return this.paymentTerms == null ? new Base[0] : new Base[] {this.paymentTerms}; // MarkdownType
1939        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1940        default: return super.getProperty(hash, name, checkValid);
1941        }
1942
1943      }
1944
1945      @Override
1946      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1947        switch (hash) {
1948        case -1618432855: // identifier
1949          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1950          return value;
1951        case -892481550: // status
1952          value = new InvoiceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1953          this.status = (Enumeration) value; // Enumeration<InvoiceStatus>
1954          return value;
1955        case 1550362357: // cancelledReason
1956          this.cancelledReason = TypeConvertor.castToString(value); // StringType
1957          return value;
1958        case 3575610: // type
1959          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1960          return value;
1961        case -1867885268: // subject
1962          this.subject = TypeConvertor.castToReference(value); // Reference
1963          return value;
1964        case 820081177: // recipient
1965          this.recipient = TypeConvertor.castToReference(value); // Reference
1966          return value;
1967        case 3076014: // date
1968          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
1969          return value;
1970        case 767422259: // participant
1971          this.getParticipant().add((InvoiceParticipantComponent) value); // InvoiceParticipantComponent
1972          return value;
1973        case -1179159879: // issuer
1974          this.issuer = TypeConvertor.castToReference(value); // Reference
1975          return value;
1976        case -1177318867: // account
1977          this.account = TypeConvertor.castToReference(value); // Reference
1978          return value;
1979        case 1188332839: // lineItem
1980          this.getLineItem().add((InvoiceLineItemComponent) value); // InvoiceLineItemComponent
1981          return value;
1982        case 1731497496: // totalPriceComponent
1983          this.getTotalPriceComponent().add((InvoiceLineItemPriceComponentComponent) value); // InvoiceLineItemPriceComponentComponent
1984          return value;
1985        case -849911879: // totalNet
1986          this.totalNet = TypeConvertor.castToMoney(value); // Money
1987          return value;
1988        case -727607968: // totalGross
1989          this.totalGross = TypeConvertor.castToMoney(value); // Money
1990          return value;
1991        case -507544799: // paymentTerms
1992          this.paymentTerms = TypeConvertor.castToMarkdown(value); // MarkdownType
1993          return value;
1994        case 3387378: // note
1995          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
1996          return value;
1997        default: return super.setProperty(hash, name, value);
1998        }
1999
2000      }
2001
2002      @Override
2003      public Base setProperty(String name, Base value) throws FHIRException {
2004        if (name.equals("identifier")) {
2005          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2006        } else if (name.equals("status")) {
2007          value = new InvoiceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2008          this.status = (Enumeration) value; // Enumeration<InvoiceStatus>
2009        } else if (name.equals("cancelledReason")) {
2010          this.cancelledReason = TypeConvertor.castToString(value); // StringType
2011        } else if (name.equals("type")) {
2012          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2013        } else if (name.equals("subject")) {
2014          this.subject = TypeConvertor.castToReference(value); // Reference
2015        } else if (name.equals("recipient")) {
2016          this.recipient = TypeConvertor.castToReference(value); // Reference
2017        } else if (name.equals("date")) {
2018          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2019        } else if (name.equals("participant")) {
2020          this.getParticipant().add((InvoiceParticipantComponent) value);
2021        } else if (name.equals("issuer")) {
2022          this.issuer = TypeConvertor.castToReference(value); // Reference
2023        } else if (name.equals("account")) {
2024          this.account = TypeConvertor.castToReference(value); // Reference
2025        } else if (name.equals("lineItem")) {
2026          this.getLineItem().add((InvoiceLineItemComponent) value);
2027        } else if (name.equals("totalPriceComponent")) {
2028          this.getTotalPriceComponent().add((InvoiceLineItemPriceComponentComponent) value);
2029        } else if (name.equals("totalNet")) {
2030          this.totalNet = TypeConvertor.castToMoney(value); // Money
2031        } else if (name.equals("totalGross")) {
2032          this.totalGross = TypeConvertor.castToMoney(value); // Money
2033        } else if (name.equals("paymentTerms")) {
2034          this.paymentTerms = TypeConvertor.castToMarkdown(value); // MarkdownType
2035        } else if (name.equals("note")) {
2036          this.getNote().add(TypeConvertor.castToAnnotation(value));
2037        } else
2038          return super.setProperty(name, value);
2039        return value;
2040      }
2041
2042      @Override
2043      public Base makeProperty(int hash, String name) throws FHIRException {
2044        switch (hash) {
2045        case -1618432855:  return addIdentifier(); 
2046        case -892481550:  return getStatusElement();
2047        case 1550362357:  return getCancelledReasonElement();
2048        case 3575610:  return getType();
2049        case -1867885268:  return getSubject();
2050        case 820081177:  return getRecipient();
2051        case 3076014:  return getDateElement();
2052        case 767422259:  return addParticipant(); 
2053        case -1179159879:  return getIssuer();
2054        case -1177318867:  return getAccount();
2055        case 1188332839:  return addLineItem(); 
2056        case 1731497496:  return addTotalPriceComponent(); 
2057        case -849911879:  return getTotalNet();
2058        case -727607968:  return getTotalGross();
2059        case -507544799:  return getPaymentTermsElement();
2060        case 3387378:  return addNote(); 
2061        default: return super.makeProperty(hash, name);
2062        }
2063
2064      }
2065
2066      @Override
2067      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2068        switch (hash) {
2069        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2070        case -892481550: /*status*/ return new String[] {"code"};
2071        case 1550362357: /*cancelledReason*/ return new String[] {"string"};
2072        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2073        case -1867885268: /*subject*/ return new String[] {"Reference"};
2074        case 820081177: /*recipient*/ return new String[] {"Reference"};
2075        case 3076014: /*date*/ return new String[] {"dateTime"};
2076        case 767422259: /*participant*/ return new String[] {};
2077        case -1179159879: /*issuer*/ return new String[] {"Reference"};
2078        case -1177318867: /*account*/ return new String[] {"Reference"};
2079        case 1188332839: /*lineItem*/ return new String[] {};
2080        case 1731497496: /*totalPriceComponent*/ return new String[] {"@Invoice.lineItem.priceComponent"};
2081        case -849911879: /*totalNet*/ return new String[] {"Money"};
2082        case -727607968: /*totalGross*/ return new String[] {"Money"};
2083        case -507544799: /*paymentTerms*/ return new String[] {"markdown"};
2084        case 3387378: /*note*/ return new String[] {"Annotation"};
2085        default: return super.getTypesForProperty(hash, name);
2086        }
2087
2088      }
2089
2090      @Override
2091      public Base addChild(String name) throws FHIRException {
2092        if (name.equals("identifier")) {
2093          return addIdentifier();
2094        }
2095        else if (name.equals("status")) {
2096          throw new FHIRException("Cannot call addChild on a primitive type Invoice.status");
2097        }
2098        else if (name.equals("cancelledReason")) {
2099          throw new FHIRException("Cannot call addChild on a primitive type Invoice.cancelledReason");
2100        }
2101        else if (name.equals("type")) {
2102          this.type = new CodeableConcept();
2103          return this.type;
2104        }
2105        else if (name.equals("subject")) {
2106          this.subject = new Reference();
2107          return this.subject;
2108        }
2109        else if (name.equals("recipient")) {
2110          this.recipient = new Reference();
2111          return this.recipient;
2112        }
2113        else if (name.equals("date")) {
2114          throw new FHIRException("Cannot call addChild on a primitive type Invoice.date");
2115        }
2116        else if (name.equals("participant")) {
2117          return addParticipant();
2118        }
2119        else if (name.equals("issuer")) {
2120          this.issuer = new Reference();
2121          return this.issuer;
2122        }
2123        else if (name.equals("account")) {
2124          this.account = new Reference();
2125          return this.account;
2126        }
2127        else if (name.equals("lineItem")) {
2128          return addLineItem();
2129        }
2130        else if (name.equals("totalPriceComponent")) {
2131          return addTotalPriceComponent();
2132        }
2133        else if (name.equals("totalNet")) {
2134          this.totalNet = new Money();
2135          return this.totalNet;
2136        }
2137        else if (name.equals("totalGross")) {
2138          this.totalGross = new Money();
2139          return this.totalGross;
2140        }
2141        else if (name.equals("paymentTerms")) {
2142          throw new FHIRException("Cannot call addChild on a primitive type Invoice.paymentTerms");
2143        }
2144        else if (name.equals("note")) {
2145          return addNote();
2146        }
2147        else
2148          return super.addChild(name);
2149      }
2150
2151  public String fhirType() {
2152    return "Invoice";
2153
2154  }
2155
2156      public Invoice copy() {
2157        Invoice dst = new Invoice();
2158        copyValues(dst);
2159        return dst;
2160      }
2161
2162      public void copyValues(Invoice dst) {
2163        super.copyValues(dst);
2164        if (identifier != null) {
2165          dst.identifier = new ArrayList<Identifier>();
2166          for (Identifier i : identifier)
2167            dst.identifier.add(i.copy());
2168        };
2169        dst.status = status == null ? null : status.copy();
2170        dst.cancelledReason = cancelledReason == null ? null : cancelledReason.copy();
2171        dst.type = type == null ? null : type.copy();
2172        dst.subject = subject == null ? null : subject.copy();
2173        dst.recipient = recipient == null ? null : recipient.copy();
2174        dst.date = date == null ? null : date.copy();
2175        if (participant != null) {
2176          dst.participant = new ArrayList<InvoiceParticipantComponent>();
2177          for (InvoiceParticipantComponent i : participant)
2178            dst.participant.add(i.copy());
2179        };
2180        dst.issuer = issuer == null ? null : issuer.copy();
2181        dst.account = account == null ? null : account.copy();
2182        if (lineItem != null) {
2183          dst.lineItem = new ArrayList<InvoiceLineItemComponent>();
2184          for (InvoiceLineItemComponent i : lineItem)
2185            dst.lineItem.add(i.copy());
2186        };
2187        if (totalPriceComponent != null) {
2188          dst.totalPriceComponent = new ArrayList<InvoiceLineItemPriceComponentComponent>();
2189          for (InvoiceLineItemPriceComponentComponent i : totalPriceComponent)
2190            dst.totalPriceComponent.add(i.copy());
2191        };
2192        dst.totalNet = totalNet == null ? null : totalNet.copy();
2193        dst.totalGross = totalGross == null ? null : totalGross.copy();
2194        dst.paymentTerms = paymentTerms == null ? null : paymentTerms.copy();
2195        if (note != null) {
2196          dst.note = new ArrayList<Annotation>();
2197          for (Annotation i : note)
2198            dst.note.add(i.copy());
2199        };
2200      }
2201
2202      protected Invoice typedCopy() {
2203        return copy();
2204      }
2205
2206      @Override
2207      public boolean equalsDeep(Base other_) {
2208        if (!super.equalsDeep(other_))
2209          return false;
2210        if (!(other_ instanceof Invoice))
2211          return false;
2212        Invoice o = (Invoice) other_;
2213        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(cancelledReason, o.cancelledReason, true)
2214           && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true) && compareDeep(recipient, o.recipient, true)
2215           && compareDeep(date, o.date, true) && compareDeep(participant, o.participant, true) && compareDeep(issuer, o.issuer, true)
2216           && compareDeep(account, o.account, true) && compareDeep(lineItem, o.lineItem, true) && compareDeep(totalPriceComponent, o.totalPriceComponent, true)
2217           && compareDeep(totalNet, o.totalNet, true) && compareDeep(totalGross, o.totalGross, true) && compareDeep(paymentTerms, o.paymentTerms, true)
2218           && compareDeep(note, o.note, true);
2219      }
2220
2221      @Override
2222      public boolean equalsShallow(Base other_) {
2223        if (!super.equalsShallow(other_))
2224          return false;
2225        if (!(other_ instanceof Invoice))
2226          return false;
2227        Invoice o = (Invoice) other_;
2228        return compareValues(status, o.status, true) && compareValues(cancelledReason, o.cancelledReason, true)
2229           && compareValues(date, o.date, true) && compareValues(paymentTerms, o.paymentTerms, true);
2230      }
2231
2232      public boolean isEmpty() {
2233        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, cancelledReason
2234          , type, subject, recipient, date, participant, issuer, account, lineItem, totalPriceComponent
2235          , totalNet, totalGross, paymentTerms, note);
2236      }
2237
2238  @Override
2239  public ResourceType getResourceType() {
2240    return ResourceType.Invoice;
2241   }
2242
2243 /**
2244   * Search parameter: <b>account</b>
2245   * <p>
2246   * Description: <b>Account that is being balanced</b><br>
2247   * Type: <b>reference</b><br>
2248   * Path: <b>Invoice.account</b><br>
2249   * </p>
2250   */
2251  @SearchParamDefinition(name="account", path="Invoice.account", description="Account that is being balanced", type="reference", target={Account.class } )
2252  public static final String SP_ACCOUNT = "account";
2253 /**
2254   * <b>Fluent Client</b> search parameter constant for <b>account</b>
2255   * <p>
2256   * Description: <b>Account that is being balanced</b><br>
2257   * Type: <b>reference</b><br>
2258   * Path: <b>Invoice.account</b><br>
2259   * </p>
2260   */
2261  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACCOUNT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACCOUNT);
2262
2263/**
2264   * Constant for fluent queries to be used to add include statements. Specifies
2265   * the path value of "<b>Invoice:account</b>".
2266   */
2267  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACCOUNT = new ca.uhn.fhir.model.api.Include("Invoice:account").toLocked();
2268
2269 /**
2270   * Search parameter: <b>date</b>
2271   * <p>
2272   * Description: <b>Invoice date / posting date</b><br>
2273   * Type: <b>date</b><br>
2274   * Path: <b>Invoice.date</b><br>
2275   * </p>
2276   */
2277  @SearchParamDefinition(name="date", path="Invoice.date", description="Invoice date / posting date", type="date" )
2278  public static final String SP_DATE = "date";
2279 /**
2280   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2281   * <p>
2282   * Description: <b>Invoice date / posting date</b><br>
2283   * Type: <b>date</b><br>
2284   * Path: <b>Invoice.date</b><br>
2285   * </p>
2286   */
2287  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2288
2289 /**
2290   * Search parameter: <b>identifier</b>
2291   * <p>
2292   * Description: <b>Business Identifier for item</b><br>
2293   * Type: <b>token</b><br>
2294   * Path: <b>Invoice.identifier</b><br>
2295   * </p>
2296   */
2297  @SearchParamDefinition(name="identifier", path="Invoice.identifier", description="Business Identifier for item", type="token" )
2298  public static final String SP_IDENTIFIER = "identifier";
2299 /**
2300   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2301   * <p>
2302   * Description: <b>Business Identifier for item</b><br>
2303   * Type: <b>token</b><br>
2304   * Path: <b>Invoice.identifier</b><br>
2305   * </p>
2306   */
2307  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2308
2309 /**
2310   * Search parameter: <b>issuer</b>
2311   * <p>
2312   * Description: <b>Issuing Organization of Invoice</b><br>
2313   * Type: <b>reference</b><br>
2314   * Path: <b>Invoice.issuer</b><br>
2315   * </p>
2316   */
2317  @SearchParamDefinition(name="issuer", path="Invoice.issuer", description="Issuing Organization of Invoice", type="reference", target={Organization.class } )
2318  public static final String SP_ISSUER = "issuer";
2319 /**
2320   * <b>Fluent Client</b> search parameter constant for <b>issuer</b>
2321   * <p>
2322   * Description: <b>Issuing Organization of Invoice</b><br>
2323   * Type: <b>reference</b><br>
2324   * Path: <b>Invoice.issuer</b><br>
2325   * </p>
2326   */
2327  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ISSUER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ISSUER);
2328
2329/**
2330   * Constant for fluent queries to be used to add include statements. Specifies
2331   * the path value of "<b>Invoice:issuer</b>".
2332   */
2333  public static final ca.uhn.fhir.model.api.Include INCLUDE_ISSUER = new ca.uhn.fhir.model.api.Include("Invoice:issuer").toLocked();
2334
2335 /**
2336   * Search parameter: <b>participant-role</b>
2337   * <p>
2338   * Description: <b>Type of involvement in creation of this Invoice</b><br>
2339   * Type: <b>token</b><br>
2340   * Path: <b>Invoice.participant.role</b><br>
2341   * </p>
2342   */
2343  @SearchParamDefinition(name="participant-role", path="Invoice.participant.role", description="Type of involvement in creation of this Invoice", type="token" )
2344  public static final String SP_PARTICIPANT_ROLE = "participant-role";
2345 /**
2346   * <b>Fluent Client</b> search parameter constant for <b>participant-role</b>
2347   * <p>
2348   * Description: <b>Type of involvement in creation of this Invoice</b><br>
2349   * Type: <b>token</b><br>
2350   * Path: <b>Invoice.participant.role</b><br>
2351   * </p>
2352   */
2353  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PARTICIPANT_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PARTICIPANT_ROLE);
2354
2355 /**
2356   * Search parameter: <b>participant</b>
2357   * <p>
2358   * Description: <b>Individual who was involved</b><br>
2359   * Type: <b>reference</b><br>
2360   * Path: <b>Invoice.participant.actor</b><br>
2361   * </p>
2362   */
2363  @SearchParamDefinition(name="participant", path="Invoice.participant.actor", description="Individual who was involved", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2364  public static final String SP_PARTICIPANT = "participant";
2365 /**
2366   * <b>Fluent Client</b> search parameter constant for <b>participant</b>
2367   * <p>
2368   * Description: <b>Individual who was involved</b><br>
2369   * Type: <b>reference</b><br>
2370   * Path: <b>Invoice.participant.actor</b><br>
2371   * </p>
2372   */
2373  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTICIPANT);
2374
2375/**
2376   * Constant for fluent queries to be used to add include statements. Specifies
2377   * the path value of "<b>Invoice:participant</b>".
2378   */
2379  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include("Invoice:participant").toLocked();
2380
2381 /**
2382   * Search parameter: <b>patient</b>
2383   * <p>
2384   * Description: <b>Recipient(s) of goods and services</b><br>
2385   * Type: <b>reference</b><br>
2386   * Path: <b>Invoice.subject.where(resolve() is Patient)</b><br>
2387   * </p>
2388   */
2389  @SearchParamDefinition(name="patient", path="Invoice.subject.where(resolve() is Patient)", description="Recipient(s) of goods and services", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
2390  public static final String SP_PATIENT = "patient";
2391 /**
2392   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2393   * <p>
2394   * Description: <b>Recipient(s) of goods and services</b><br>
2395   * Type: <b>reference</b><br>
2396   * Path: <b>Invoice.subject.where(resolve() is Patient)</b><br>
2397   * </p>
2398   */
2399  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2400
2401/**
2402   * Constant for fluent queries to be used to add include statements. Specifies
2403   * the path value of "<b>Invoice:patient</b>".
2404   */
2405  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Invoice:patient").toLocked();
2406
2407 /**
2408   * Search parameter: <b>recipient</b>
2409   * <p>
2410   * Description: <b>Recipient of this invoice</b><br>
2411   * Type: <b>reference</b><br>
2412   * Path: <b>Invoice.recipient</b><br>
2413   * </p>
2414   */
2415  @SearchParamDefinition(name="recipient", path="Invoice.recipient", description="Recipient of this invoice", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={Organization.class, Patient.class, RelatedPerson.class } )
2416  public static final String SP_RECIPIENT = "recipient";
2417 /**
2418   * <b>Fluent Client</b> search parameter constant for <b>recipient</b>
2419   * <p>
2420   * Description: <b>Recipient of this invoice</b><br>
2421   * Type: <b>reference</b><br>
2422   * Path: <b>Invoice.recipient</b><br>
2423   * </p>
2424   */
2425  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECIPIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECIPIENT);
2426
2427/**
2428   * Constant for fluent queries to be used to add include statements. Specifies
2429   * the path value of "<b>Invoice:recipient</b>".
2430   */
2431  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECIPIENT = new ca.uhn.fhir.model.api.Include("Invoice:recipient").toLocked();
2432
2433 /**
2434   * Search parameter: <b>status</b>
2435   * <p>
2436   * Description: <b>draft | issued | balanced | cancelled | entered-in-error</b><br>
2437   * Type: <b>token</b><br>
2438   * Path: <b>Invoice.status</b><br>
2439   * </p>
2440   */
2441  @SearchParamDefinition(name="status", path="Invoice.status", description="draft | issued | balanced | cancelled | entered-in-error", type="token" )
2442  public static final String SP_STATUS = "status";
2443 /**
2444   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2445   * <p>
2446   * Description: <b>draft | issued | balanced | cancelled | entered-in-error</b><br>
2447   * Type: <b>token</b><br>
2448   * Path: <b>Invoice.status</b><br>
2449   * </p>
2450   */
2451  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2452
2453 /**
2454   * Search parameter: <b>subject</b>
2455   * <p>
2456   * Description: <b>Recipient(s) of goods and services</b><br>
2457   * Type: <b>reference</b><br>
2458   * Path: <b>Invoice.subject</b><br>
2459   * </p>
2460   */
2461  @SearchParamDefinition(name="subject", path="Invoice.subject", description="Recipient(s) of goods and services", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Group.class, Patient.class } )
2462  public static final String SP_SUBJECT = "subject";
2463 /**
2464   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2465   * <p>
2466   * Description: <b>Recipient(s) of goods and services</b><br>
2467   * Type: <b>reference</b><br>
2468   * Path: <b>Invoice.subject</b><br>
2469   * </p>
2470   */
2471  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2472
2473/**
2474   * Constant for fluent queries to be used to add include statements. Specifies
2475   * the path value of "<b>Invoice:subject</b>".
2476   */
2477  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Invoice:subject").toLocked();
2478
2479 /**
2480   * Search parameter: <b>totalgross</b>
2481   * <p>
2482   * Description: <b>Gross total of this Invoice</b><br>
2483   * Type: <b>quantity</b><br>
2484   * Path: <b>Invoice.totalGross</b><br>
2485   * </p>
2486   */
2487  @SearchParamDefinition(name="totalgross", path="Invoice.totalGross", description="Gross total of this Invoice", type="quantity" )
2488  public static final String SP_TOTALGROSS = "totalgross";
2489 /**
2490   * <b>Fluent Client</b> search parameter constant for <b>totalgross</b>
2491   * <p>
2492   * Description: <b>Gross total of this Invoice</b><br>
2493   * Type: <b>quantity</b><br>
2494   * Path: <b>Invoice.totalGross</b><br>
2495   * </p>
2496   */
2497  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam TOTALGROSS = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_TOTALGROSS);
2498
2499 /**
2500   * Search parameter: <b>totalnet</b>
2501   * <p>
2502   * Description: <b>Net total of this Invoice</b><br>
2503   * Type: <b>quantity</b><br>
2504   * Path: <b>Invoice.totalNet</b><br>
2505   * </p>
2506   */
2507  @SearchParamDefinition(name="totalnet", path="Invoice.totalNet", description="Net total of this Invoice", type="quantity" )
2508  public static final String SP_TOTALNET = "totalnet";
2509 /**
2510   * <b>Fluent Client</b> search parameter constant for <b>totalnet</b>
2511   * <p>
2512   * Description: <b>Net total of this Invoice</b><br>
2513   * Type: <b>quantity</b><br>
2514   * Path: <b>Invoice.totalNet</b><br>
2515   * </p>
2516   */
2517  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam TOTALNET = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_TOTALNET);
2518
2519 /**
2520   * Search parameter: <b>type</b>
2521   * <p>
2522   * Description: <b>Type of Invoice</b><br>
2523   * Type: <b>token</b><br>
2524   * Path: <b>Invoice.type</b><br>
2525   * </p>
2526   */
2527  @SearchParamDefinition(name="type", path="Invoice.type", description="Type of Invoice", type="token" )
2528  public static final String SP_TYPE = "type";
2529 /**
2530   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2531   * <p>
2532   * Description: <b>Type of Invoice</b><br>
2533   * Type: <b>token</b><br>
2534   * Path: <b>Invoice.type</b><br>
2535   * </p>
2536   */
2537  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2538
2539
2540}
2541