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