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