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