001package org.hl7.fhir.r5.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, \
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this \
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, \
016     this list of conditions and the following disclaimer in the documentation \
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
031  POSSIBILITY OF SUCH DAMAGE.
032  */
033
034// Generated on Mon, May 11, 2020 09:58+1000 for FHIR vcurrent
035
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r5.model.Enumerations.*;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.exceptions.FHIRException;
043import org.hl7.fhir.instance.model.api.ICompositeType;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
047import ca.uhn.fhir.model.api.annotation.Child;
048import ca.uhn.fhir.model.api.annotation.ChildOrder;
049import ca.uhn.fhir.model.api.annotation.Description;
050import ca.uhn.fhir.model.api.annotation.Block;
051
052/**
053 * A financial tool for tracking value accrued for a particular purpose.  In the healthcare field, used to track charges for a patient, cost centers, etc.
054 */
055@ResourceDef(name="Account", profile="http://hl7.org/fhir/StructureDefinition/Account")
056public class Account extends DomainResource {
057
058    public enum AccountStatus {
059        /**
060         * This account is active and may be used.
061         */
062        ACTIVE, 
063        /**
064         * This account is inactive and should not be used to track financial information.
065         */
066        INACTIVE, 
067        /**
068         * This instance should not have been part of this patient's medical record.
069         */
070        ENTEREDINERROR, 
071        /**
072         * This account is on hold.
073         */
074        ONHOLD, 
075        /**
076         * The account status is unknown.
077         */
078        UNKNOWN, 
079        /**
080         * added to help the parsers with the generic types
081         */
082        NULL;
083        public static AccountStatus fromCode(String codeString) throws FHIRException {
084            if (codeString == null || "".equals(codeString))
085                return null;
086        if ("active".equals(codeString))
087          return ACTIVE;
088        if ("inactive".equals(codeString))
089          return INACTIVE;
090        if ("entered-in-error".equals(codeString))
091          return ENTEREDINERROR;
092        if ("on-hold".equals(codeString))
093          return ONHOLD;
094        if ("unknown".equals(codeString))
095          return UNKNOWN;
096        if (Configuration.isAcceptInvalidEnums())
097          return null;
098        else
099          throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
100        }
101        public String toCode() {
102          switch (this) {
103            case ACTIVE: return "active";
104            case INACTIVE: return "inactive";
105            case ENTEREDINERROR: return "entered-in-error";
106            case ONHOLD: return "on-hold";
107            case UNKNOWN: return "unknown";
108            default: return "?";
109          }
110        }
111        public String getSystem() {
112          switch (this) {
113            case ACTIVE: return "http://hl7.org/fhir/account-status";
114            case INACTIVE: return "http://hl7.org/fhir/account-status";
115            case ENTEREDINERROR: return "http://hl7.org/fhir/account-status";
116            case ONHOLD: return "http://hl7.org/fhir/account-status";
117            case UNKNOWN: return "http://hl7.org/fhir/account-status";
118            default: return "?";
119          }
120        }
121        public String getDefinition() {
122          switch (this) {
123            case ACTIVE: return "This account is active and may be used.";
124            case INACTIVE: return "This account is inactive and should not be used to track financial information.";
125            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
126            case ONHOLD: return "This account is on hold.";
127            case UNKNOWN: return "The account status is unknown.";
128            default: return "?";
129          }
130        }
131        public String getDisplay() {
132          switch (this) {
133            case ACTIVE: return "Active";
134            case INACTIVE: return "Inactive";
135            case ENTEREDINERROR: return "Entered in error";
136            case ONHOLD: return "On Hold";
137            case UNKNOWN: return "Unknown";
138            default: return "?";
139          }
140        }
141    }
142
143  public static class AccountStatusEnumFactory implements EnumFactory<AccountStatus> {
144    public AccountStatus fromCode(String codeString) throws IllegalArgumentException {
145      if (codeString == null || "".equals(codeString))
146            if (codeString == null || "".equals(codeString))
147                return null;
148        if ("active".equals(codeString))
149          return AccountStatus.ACTIVE;
150        if ("inactive".equals(codeString))
151          return AccountStatus.INACTIVE;
152        if ("entered-in-error".equals(codeString))
153          return AccountStatus.ENTEREDINERROR;
154        if ("on-hold".equals(codeString))
155          return AccountStatus.ONHOLD;
156        if ("unknown".equals(codeString))
157          return AccountStatus.UNKNOWN;
158        throw new IllegalArgumentException("Unknown AccountStatus code '"+codeString+"'");
159        }
160        public Enumeration<AccountStatus> fromType(Base code) throws FHIRException {
161          if (code == null)
162            return null;
163          if (code.isEmpty())
164            return new Enumeration<AccountStatus>(this);
165          String codeString = ((PrimitiveType) code).asStringValue();
166          if (codeString == null || "".equals(codeString))
167            return null;
168        if ("active".equals(codeString))
169          return new Enumeration<AccountStatus>(this, AccountStatus.ACTIVE);
170        if ("inactive".equals(codeString))
171          return new Enumeration<AccountStatus>(this, AccountStatus.INACTIVE);
172        if ("entered-in-error".equals(codeString))
173          return new Enumeration<AccountStatus>(this, AccountStatus.ENTEREDINERROR);
174        if ("on-hold".equals(codeString))
175          return new Enumeration<AccountStatus>(this, AccountStatus.ONHOLD);
176        if ("unknown".equals(codeString))
177          return new Enumeration<AccountStatus>(this, AccountStatus.UNKNOWN);
178        throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
179        }
180    public String toCode(AccountStatus code) {
181      if (code == AccountStatus.ACTIVE)
182        return "active";
183      if (code == AccountStatus.INACTIVE)
184        return "inactive";
185      if (code == AccountStatus.ENTEREDINERROR)
186        return "entered-in-error";
187      if (code == AccountStatus.ONHOLD)
188        return "on-hold";
189      if (code == AccountStatus.UNKNOWN)
190        return "unknown";
191      return "?";
192      }
193    public String toSystem(AccountStatus code) {
194      return code.getSystem();
195      }
196    }
197
198    @Block()
199    public static class CoverageComponent extends BackboneElement implements IBaseBackboneElement {
200        /**
201         * The party(s) that contribute to payment (or part of) of the charges applied to this account (including self-pay).
202
203A coverage may only be responsible for specific types of charges, and the sequence of the coverages in the account could be important when processing billing.
204         */
205        @Child(name = "coverage", type = {Coverage.class}, order=1, min=1, max=1, modifier=false, summary=true)
206        @Description(shortDefinition="The party(s), such as insurances, that may contribute to the payment of this account", formalDefinition="The party(s) that contribute to payment (or part of) of the charges applied to this account (including self-pay).\n\nA coverage may only be responsible for specific types of charges, and the sequence of the coverages in the account could be important when processing billing." )
207        protected Reference coverage;
208
209        /**
210         * The priority of the coverage in the context of this account.
211         */
212        @Child(name = "priority", type = {PositiveIntType.class}, order=2, min=0, max=1, modifier=false, summary=true)
213        @Description(shortDefinition="The priority of the coverage in the context of this account", formalDefinition="The priority of the coverage in the context of this account." )
214        protected PositiveIntType priority;
215
216        private static final long serialVersionUID = 1695665065L;
217
218    /**
219     * Constructor
220     */
221      public CoverageComponent() {
222        super();
223      }
224
225    /**
226     * Constructor
227     */
228      public CoverageComponent(Reference coverage) {
229        super();
230        this.setCoverage(coverage);
231      }
232
233        /**
234         * @return {@link #coverage} (The party(s) that contribute to payment (or part of) of the charges applied to this account (including self-pay).
235
236A coverage may only be responsible for specific types of charges, and the sequence of the coverages in the account could be important when processing billing.)
237         */
238        public Reference getCoverage() { 
239          if (this.coverage == null)
240            if (Configuration.errorOnAutoCreate())
241              throw new Error("Attempt to auto-create CoverageComponent.coverage");
242            else if (Configuration.doAutoCreate())
243              this.coverage = new Reference(); // cc
244          return this.coverage;
245        }
246
247        public boolean hasCoverage() { 
248          return this.coverage != null && !this.coverage.isEmpty();
249        }
250
251        /**
252         * @param value {@link #coverage} (The party(s) that contribute to payment (or part of) of the charges applied to this account (including self-pay).
253
254A coverage may only be responsible for specific types of charges, and the sequence of the coverages in the account could be important when processing billing.)
255         */
256        public CoverageComponent setCoverage(Reference value) { 
257          this.coverage = value;
258          return this;
259        }
260
261        /**
262         * @return {@link #priority} (The priority of the coverage in the context of this account.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
263         */
264        public PositiveIntType getPriorityElement() { 
265          if (this.priority == null)
266            if (Configuration.errorOnAutoCreate())
267              throw new Error("Attempt to auto-create CoverageComponent.priority");
268            else if (Configuration.doAutoCreate())
269              this.priority = new PositiveIntType(); // bb
270          return this.priority;
271        }
272
273        public boolean hasPriorityElement() { 
274          return this.priority != null && !this.priority.isEmpty();
275        }
276
277        public boolean hasPriority() { 
278          return this.priority != null && !this.priority.isEmpty();
279        }
280
281        /**
282         * @param value {@link #priority} (The priority of the coverage in the context of this account.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
283         */
284        public CoverageComponent setPriorityElement(PositiveIntType value) { 
285          this.priority = value;
286          return this;
287        }
288
289        /**
290         * @return The priority of the coverage in the context of this account.
291         */
292        public int getPriority() { 
293          return this.priority == null || this.priority.isEmpty() ? 0 : this.priority.getValue();
294        }
295
296        /**
297         * @param value The priority of the coverage in the context of this account.
298         */
299        public CoverageComponent setPriority(int value) { 
300            if (this.priority == null)
301              this.priority = new PositiveIntType();
302            this.priority.setValue(value);
303          return this;
304        }
305
306        protected void listChildren(List<Property> children) {
307          super.listChildren(children);
308          children.add(new Property("coverage", "Reference(Coverage)", "The party(s) that contribute to payment (or part of) of the charges applied to this account (including self-pay).\n\nA coverage may only be responsible for specific types of charges, and the sequence of the coverages in the account could be important when processing billing.", 0, 1, coverage));
309          children.add(new Property("priority", "positiveInt", "The priority of the coverage in the context of this account.", 0, 1, priority));
310        }
311
312        @Override
313        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
314          switch (_hash) {
315          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "The party(s) that contribute to payment (or part of) of the charges applied to this account (including self-pay).\n\nA coverage may only be responsible for specific types of charges, and the sequence of the coverages in the account could be important when processing billing.", 0, 1, coverage);
316          case -1165461084: /*priority*/  return new Property("priority", "positiveInt", "The priority of the coverage in the context of this account.", 0, 1, priority);
317          default: return super.getNamedProperty(_hash, _name, _checkValid);
318          }
319
320        }
321
322      @Override
323      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
324        switch (hash) {
325        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
326        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // PositiveIntType
327        default: return super.getProperty(hash, name, checkValid);
328        }
329
330      }
331
332      @Override
333      public Base setProperty(int hash, String name, Base value) throws FHIRException {
334        switch (hash) {
335        case -351767064: // coverage
336          this.coverage = TypeConvertor.castToReference(value); // Reference
337          return value;
338        case -1165461084: // priority
339          this.priority = TypeConvertor.castToPositiveInt(value); // PositiveIntType
340          return value;
341        default: return super.setProperty(hash, name, value);
342        }
343
344      }
345
346      @Override
347      public Base setProperty(String name, Base value) throws FHIRException {
348        if (name.equals("coverage")) {
349          this.coverage = TypeConvertor.castToReference(value); // Reference
350        } else if (name.equals("priority")) {
351          this.priority = TypeConvertor.castToPositiveInt(value); // PositiveIntType
352        } else
353          return super.setProperty(name, value);
354        return value;
355      }
356
357      @Override
358      public Base makeProperty(int hash, String name) throws FHIRException {
359        switch (hash) {
360        case -351767064:  return getCoverage();
361        case -1165461084:  return getPriorityElement();
362        default: return super.makeProperty(hash, name);
363        }
364
365      }
366
367      @Override
368      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
369        switch (hash) {
370        case -351767064: /*coverage*/ return new String[] {"Reference"};
371        case -1165461084: /*priority*/ return new String[] {"positiveInt"};
372        default: return super.getTypesForProperty(hash, name);
373        }
374
375      }
376
377      @Override
378      public Base addChild(String name) throws FHIRException {
379        if (name.equals("coverage")) {
380          this.coverage = new Reference();
381          return this.coverage;
382        }
383        else if (name.equals("priority")) {
384          throw new FHIRException("Cannot call addChild on a primitive type Account.coverage.priority");
385        }
386        else
387          return super.addChild(name);
388      }
389
390      public CoverageComponent copy() {
391        CoverageComponent dst = new CoverageComponent();
392        copyValues(dst);
393        return dst;
394      }
395
396      public void copyValues(CoverageComponent dst) {
397        super.copyValues(dst);
398        dst.coverage = coverage == null ? null : coverage.copy();
399        dst.priority = priority == null ? null : priority.copy();
400      }
401
402      @Override
403      public boolean equalsDeep(Base other_) {
404        if (!super.equalsDeep(other_))
405          return false;
406        if (!(other_ instanceof CoverageComponent))
407          return false;
408        CoverageComponent o = (CoverageComponent) other_;
409        return compareDeep(coverage, o.coverage, true) && compareDeep(priority, o.priority, true);
410      }
411
412      @Override
413      public boolean equalsShallow(Base other_) {
414        if (!super.equalsShallow(other_))
415          return false;
416        if (!(other_ instanceof CoverageComponent))
417          return false;
418        CoverageComponent o = (CoverageComponent) other_;
419        return compareValues(priority, o.priority, true);
420      }
421
422      public boolean isEmpty() {
423        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coverage, priority);
424      }
425
426  public String fhirType() {
427    return "Account.coverage";
428
429  }
430
431  }
432
433    @Block()
434    public static class GuarantorComponent extends BackboneElement implements IBaseBackboneElement {
435        /**
436         * The entity who is responsible.
437         */
438        @Child(name = "party", type = {Patient.class, RelatedPerson.class, Organization.class}, order=1, min=1, max=1, modifier=false, summary=false)
439        @Description(shortDefinition="Responsible entity", formalDefinition="The entity who is responsible." )
440        protected Reference party;
441
442        /**
443         * A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.
444         */
445        @Child(name = "onHold", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
446        @Description(shortDefinition="Credit or other hold applied", formalDefinition="A guarantor may be placed on credit hold or otherwise have their role temporarily suspended." )
447        protected BooleanType onHold;
448
449        /**
450         * The timeframe during which the guarantor accepts responsibility for the account.
451         */
452        @Child(name = "period", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
453        @Description(shortDefinition="Guarantee account during", formalDefinition="The timeframe during which the guarantor accepts responsibility for the account." )
454        protected Period period;
455
456        private static final long serialVersionUID = -523056773L;
457
458    /**
459     * Constructor
460     */
461      public GuarantorComponent() {
462        super();
463      }
464
465    /**
466     * Constructor
467     */
468      public GuarantorComponent(Reference party) {
469        super();
470        this.setParty(party);
471      }
472
473        /**
474         * @return {@link #party} (The entity who is responsible.)
475         */
476        public Reference getParty() { 
477          if (this.party == null)
478            if (Configuration.errorOnAutoCreate())
479              throw new Error("Attempt to auto-create GuarantorComponent.party");
480            else if (Configuration.doAutoCreate())
481              this.party = new Reference(); // cc
482          return this.party;
483        }
484
485        public boolean hasParty() { 
486          return this.party != null && !this.party.isEmpty();
487        }
488
489        /**
490         * @param value {@link #party} (The entity who is responsible.)
491         */
492        public GuarantorComponent setParty(Reference value) { 
493          this.party = value;
494          return this;
495        }
496
497        /**
498         * @return {@link #onHold} (A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.). This is the underlying object with id, value and extensions. The accessor "getOnHold" gives direct access to the value
499         */
500        public BooleanType getOnHoldElement() { 
501          if (this.onHold == null)
502            if (Configuration.errorOnAutoCreate())
503              throw new Error("Attempt to auto-create GuarantorComponent.onHold");
504            else if (Configuration.doAutoCreate())
505              this.onHold = new BooleanType(); // bb
506          return this.onHold;
507        }
508
509        public boolean hasOnHoldElement() { 
510          return this.onHold != null && !this.onHold.isEmpty();
511        }
512
513        public boolean hasOnHold() { 
514          return this.onHold != null && !this.onHold.isEmpty();
515        }
516
517        /**
518         * @param value {@link #onHold} (A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.). This is the underlying object with id, value and extensions. The accessor "getOnHold" gives direct access to the value
519         */
520        public GuarantorComponent setOnHoldElement(BooleanType value) { 
521          this.onHold = value;
522          return this;
523        }
524
525        /**
526         * @return A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.
527         */
528        public boolean getOnHold() { 
529          return this.onHold == null || this.onHold.isEmpty() ? false : this.onHold.getValue();
530        }
531
532        /**
533         * @param value A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.
534         */
535        public GuarantorComponent setOnHold(boolean value) { 
536            if (this.onHold == null)
537              this.onHold = new BooleanType();
538            this.onHold.setValue(value);
539          return this;
540        }
541
542        /**
543         * @return {@link #period} (The timeframe during which the guarantor accepts responsibility for the account.)
544         */
545        public Period getPeriod() { 
546          if (this.period == null)
547            if (Configuration.errorOnAutoCreate())
548              throw new Error("Attempt to auto-create GuarantorComponent.period");
549            else if (Configuration.doAutoCreate())
550              this.period = new Period(); // cc
551          return this.period;
552        }
553
554        public boolean hasPeriod() { 
555          return this.period != null && !this.period.isEmpty();
556        }
557
558        /**
559         * @param value {@link #period} (The timeframe during which the guarantor accepts responsibility for the account.)
560         */
561        public GuarantorComponent setPeriod(Period value) { 
562          this.period = value;
563          return this;
564        }
565
566        protected void listChildren(List<Property> children) {
567          super.listChildren(children);
568          children.add(new Property("party", "Reference(Patient|RelatedPerson|Organization)", "The entity who is responsible.", 0, 1, party));
569          children.add(new Property("onHold", "boolean", "A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.", 0, 1, onHold));
570          children.add(new Property("period", "Period", "The timeframe during which the guarantor accepts responsibility for the account.", 0, 1, period));
571        }
572
573        @Override
574        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
575          switch (_hash) {
576          case 106437350: /*party*/  return new Property("party", "Reference(Patient|RelatedPerson|Organization)", "The entity who is responsible.", 0, 1, party);
577          case -1013289154: /*onHold*/  return new Property("onHold", "boolean", "A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.", 0, 1, onHold);
578          case -991726143: /*period*/  return new Property("period", "Period", "The timeframe during which the guarantor accepts responsibility for the account.", 0, 1, period);
579          default: return super.getNamedProperty(_hash, _name, _checkValid);
580          }
581
582        }
583
584      @Override
585      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
586        switch (hash) {
587        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
588        case -1013289154: /*onHold*/ return this.onHold == null ? new Base[0] : new Base[] {this.onHold}; // BooleanType
589        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
590        default: return super.getProperty(hash, name, checkValid);
591        }
592
593      }
594
595      @Override
596      public Base setProperty(int hash, String name, Base value) throws FHIRException {
597        switch (hash) {
598        case 106437350: // party
599          this.party = TypeConvertor.castToReference(value); // Reference
600          return value;
601        case -1013289154: // onHold
602          this.onHold = TypeConvertor.castToBoolean(value); // BooleanType
603          return value;
604        case -991726143: // period
605          this.period = TypeConvertor.castToPeriod(value); // Period
606          return value;
607        default: return super.setProperty(hash, name, value);
608        }
609
610      }
611
612      @Override
613      public Base setProperty(String name, Base value) throws FHIRException {
614        if (name.equals("party")) {
615          this.party = TypeConvertor.castToReference(value); // Reference
616        } else if (name.equals("onHold")) {
617          this.onHold = TypeConvertor.castToBoolean(value); // BooleanType
618        } else if (name.equals("period")) {
619          this.period = TypeConvertor.castToPeriod(value); // Period
620        } else
621          return super.setProperty(name, value);
622        return value;
623      }
624
625      @Override
626      public Base makeProperty(int hash, String name) throws FHIRException {
627        switch (hash) {
628        case 106437350:  return getParty();
629        case -1013289154:  return getOnHoldElement();
630        case -991726143:  return getPeriod();
631        default: return super.makeProperty(hash, name);
632        }
633
634      }
635
636      @Override
637      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
638        switch (hash) {
639        case 106437350: /*party*/ return new String[] {"Reference"};
640        case -1013289154: /*onHold*/ return new String[] {"boolean"};
641        case -991726143: /*period*/ return new String[] {"Period"};
642        default: return super.getTypesForProperty(hash, name);
643        }
644
645      }
646
647      @Override
648      public Base addChild(String name) throws FHIRException {
649        if (name.equals("party")) {
650          this.party = new Reference();
651          return this.party;
652        }
653        else if (name.equals("onHold")) {
654          throw new FHIRException("Cannot call addChild on a primitive type Account.guarantor.onHold");
655        }
656        else if (name.equals("period")) {
657          this.period = new Period();
658          return this.period;
659        }
660        else
661          return super.addChild(name);
662      }
663
664      public GuarantorComponent copy() {
665        GuarantorComponent dst = new GuarantorComponent();
666        copyValues(dst);
667        return dst;
668      }
669
670      public void copyValues(GuarantorComponent dst) {
671        super.copyValues(dst);
672        dst.party = party == null ? null : party.copy();
673        dst.onHold = onHold == null ? null : onHold.copy();
674        dst.period = period == null ? null : period.copy();
675      }
676
677      @Override
678      public boolean equalsDeep(Base other_) {
679        if (!super.equalsDeep(other_))
680          return false;
681        if (!(other_ instanceof GuarantorComponent))
682          return false;
683        GuarantorComponent o = (GuarantorComponent) other_;
684        return compareDeep(party, o.party, true) && compareDeep(onHold, o.onHold, true) && compareDeep(period, o.period, true)
685          ;
686      }
687
688      @Override
689      public boolean equalsShallow(Base other_) {
690        if (!super.equalsShallow(other_))
691          return false;
692        if (!(other_ instanceof GuarantorComponent))
693          return false;
694        GuarantorComponent o = (GuarantorComponent) other_;
695        return compareValues(onHold, o.onHold, true);
696      }
697
698      public boolean isEmpty() {
699        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(party, onHold, period);
700      }
701
702  public String fhirType() {
703    return "Account.guarantor";
704
705  }
706
707  }
708
709    /**
710     * Unique identifier used to reference the account.  Might or might not be intended for human use (e.g. credit card number).
711     */
712    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
713    @Description(shortDefinition="Account number", formalDefinition="Unique identifier used to reference the account.  Might or might not be intended for human use (e.g. credit card number)." )
714    protected List<Identifier> identifier;
715
716    /**
717     * Indicates whether the account is presently used/usable or not.
718     */
719    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
720    @Description(shortDefinition="active | inactive | entered-in-error | on-hold | unknown", formalDefinition="Indicates whether the account is presently used/usable or not." )
721    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/account-status")
722    protected Enumeration<AccountStatus> status;
723
724    /**
725     * Categorizes the account for reporting and searching purposes.
726     */
727    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
728    @Description(shortDefinition="E.g. patient, expense, depreciation", formalDefinition="Categorizes the account for reporting and searching purposes." )
729    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/account-type")
730    protected CodeableConcept type;
731
732    /**
733     * Name used for the account when displaying it to humans in reports, etc.
734     */
735    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
736    @Description(shortDefinition="Human-readable label", formalDefinition="Name used for the account when displaying it to humans in reports, etc." )
737    protected StringType name;
738
739    /**
740     * Identifies the entity which incurs the expenses. While the immediate recipients of services or goods might be entities related to the subject, the expenses were ultimately incurred by the subject of the Account.
741     */
742    @Child(name = "subject", type = {Patient.class, Device.class, Practitioner.class, PractitionerRole.class, Location.class, HealthcareService.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
743    @Description(shortDefinition="The entity that caused the expenses", formalDefinition="Identifies the entity which incurs the expenses. While the immediate recipients of services or goods might be entities related to the subject, the expenses were ultimately incurred by the subject of the Account." )
744    protected List<Reference> subject;
745
746    /**
747     * The date range of services associated with this account.
748     */
749    @Child(name = "servicePeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
750    @Description(shortDefinition="Transaction window", formalDefinition="The date range of services associated with this account." )
751    protected Period servicePeriod;
752
753    /**
754     * The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.
755     */
756    @Child(name = "coverage", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
757    @Description(shortDefinition="The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account", formalDefinition="The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account." )
758    protected List<CoverageComponent> coverage;
759
760    /**
761     * Indicates the service area, hospital, department, etc. with responsibility for managing the Account.
762     */
763    @Child(name = "owner", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
764    @Description(shortDefinition="Entity managing the Account", formalDefinition="Indicates the service area, hospital, department, etc. with responsibility for managing the Account." )
765    protected Reference owner;
766
767    /**
768     * Provides additional information about what the account tracks and how it is used.
769     */
770    @Child(name = "description", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
771    @Description(shortDefinition="Explanation of purpose/use", formalDefinition="Provides additional information about what the account tracks and how it is used." )
772    protected StringType description;
773
774    /**
775     * The parties responsible for balancing the account if other payment options fall short.
776     */
777    @Child(name = "guarantor", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
778    @Description(shortDefinition="The parties ultimately responsible for balancing the Account", formalDefinition="The parties responsible for balancing the account if other payment options fall short." )
779    protected List<GuarantorComponent> guarantor;
780
781    /**
782     * Reference to a parent Account.
783     */
784    @Child(name = "partOf", type = {Account.class}, order=10, min=0, max=1, modifier=false, summary=false)
785    @Description(shortDefinition="Reference to a parent Account", formalDefinition="Reference to a parent Account." )
786    protected Reference partOf;
787
788    private static final long serialVersionUID = 1572782679L;
789
790  /**
791   * Constructor
792   */
793    public Account() {
794      super();
795    }
796
797  /**
798   * Constructor
799   */
800    public Account(AccountStatus status) {
801      super();
802      this.setStatus(status);
803    }
804
805    /**
806     * @return {@link #identifier} (Unique identifier used to reference the account.  Might or might not be intended for human use (e.g. credit card number).)
807     */
808    public List<Identifier> getIdentifier() { 
809      if (this.identifier == null)
810        this.identifier = new ArrayList<Identifier>();
811      return this.identifier;
812    }
813
814    /**
815     * @return Returns a reference to <code>this</code> for easy method chaining
816     */
817    public Account setIdentifier(List<Identifier> theIdentifier) { 
818      this.identifier = theIdentifier;
819      return this;
820    }
821
822    public boolean hasIdentifier() { 
823      if (this.identifier == null)
824        return false;
825      for (Identifier item : this.identifier)
826        if (!item.isEmpty())
827          return true;
828      return false;
829    }
830
831    public Identifier addIdentifier() { //3
832      Identifier t = new Identifier();
833      if (this.identifier == null)
834        this.identifier = new ArrayList<Identifier>();
835      this.identifier.add(t);
836      return t;
837    }
838
839    public Account addIdentifier(Identifier t) { //3
840      if (t == null)
841        return this;
842      if (this.identifier == null)
843        this.identifier = new ArrayList<Identifier>();
844      this.identifier.add(t);
845      return this;
846    }
847
848    /**
849     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
850     */
851    public Identifier getIdentifierFirstRep() { 
852      if (getIdentifier().isEmpty()) {
853        addIdentifier();
854      }
855      return getIdentifier().get(0);
856    }
857
858    /**
859     * @return {@link #status} (Indicates whether the account is presently used/usable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
860     */
861    public Enumeration<AccountStatus> getStatusElement() { 
862      if (this.status == null)
863        if (Configuration.errorOnAutoCreate())
864          throw new Error("Attempt to auto-create Account.status");
865        else if (Configuration.doAutoCreate())
866          this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory()); // bb
867      return this.status;
868    }
869
870    public boolean hasStatusElement() { 
871      return this.status != null && !this.status.isEmpty();
872    }
873
874    public boolean hasStatus() { 
875      return this.status != null && !this.status.isEmpty();
876    }
877
878    /**
879     * @param value {@link #status} (Indicates whether the account is presently used/usable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
880     */
881    public Account setStatusElement(Enumeration<AccountStatus> value) { 
882      this.status = value;
883      return this;
884    }
885
886    /**
887     * @return Indicates whether the account is presently used/usable or not.
888     */
889    public AccountStatus getStatus() { 
890      return this.status == null ? null : this.status.getValue();
891    }
892
893    /**
894     * @param value Indicates whether the account is presently used/usable or not.
895     */
896    public Account setStatus(AccountStatus value) { 
897        if (this.status == null)
898          this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory());
899        this.status.setValue(value);
900      return this;
901    }
902
903    /**
904     * @return {@link #type} (Categorizes the account for reporting and searching purposes.)
905     */
906    public CodeableConcept getType() { 
907      if (this.type == null)
908        if (Configuration.errorOnAutoCreate())
909          throw new Error("Attempt to auto-create Account.type");
910        else if (Configuration.doAutoCreate())
911          this.type = new CodeableConcept(); // cc
912      return this.type;
913    }
914
915    public boolean hasType() { 
916      return this.type != null && !this.type.isEmpty();
917    }
918
919    /**
920     * @param value {@link #type} (Categorizes the account for reporting and searching purposes.)
921     */
922    public Account setType(CodeableConcept value) { 
923      this.type = value;
924      return this;
925    }
926
927    /**
928     * @return {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
929     */
930    public StringType getNameElement() { 
931      if (this.name == null)
932        if (Configuration.errorOnAutoCreate())
933          throw new Error("Attempt to auto-create Account.name");
934        else if (Configuration.doAutoCreate())
935          this.name = new StringType(); // bb
936      return this.name;
937    }
938
939    public boolean hasNameElement() { 
940      return this.name != null && !this.name.isEmpty();
941    }
942
943    public boolean hasName() { 
944      return this.name != null && !this.name.isEmpty();
945    }
946
947    /**
948     * @param value {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
949     */
950    public Account setNameElement(StringType value) { 
951      this.name = value;
952      return this;
953    }
954
955    /**
956     * @return Name used for the account when displaying it to humans in reports, etc.
957     */
958    public String getName() { 
959      return this.name == null ? null : this.name.getValue();
960    }
961
962    /**
963     * @param value Name used for the account when displaying it to humans in reports, etc.
964     */
965    public Account setName(String value) { 
966      if (Utilities.noString(value))
967        this.name = null;
968      else {
969        if (this.name == null)
970          this.name = new StringType();
971        this.name.setValue(value);
972      }
973      return this;
974    }
975
976    /**
977     * @return {@link #subject} (Identifies the entity which incurs the expenses. While the immediate recipients of services or goods might be entities related to the subject, the expenses were ultimately incurred by the subject of the Account.)
978     */
979    public List<Reference> getSubject() { 
980      if (this.subject == null)
981        this.subject = new ArrayList<Reference>();
982      return this.subject;
983    }
984
985    /**
986     * @return Returns a reference to <code>this</code> for easy method chaining
987     */
988    public Account setSubject(List<Reference> theSubject) { 
989      this.subject = theSubject;
990      return this;
991    }
992
993    public boolean hasSubject() { 
994      if (this.subject == null)
995        return false;
996      for (Reference item : this.subject)
997        if (!item.isEmpty())
998          return true;
999      return false;
1000    }
1001
1002    public Reference addSubject() { //3
1003      Reference t = new Reference();
1004      if (this.subject == null)
1005        this.subject = new ArrayList<Reference>();
1006      this.subject.add(t);
1007      return t;
1008    }
1009
1010    public Account addSubject(Reference t) { //3
1011      if (t == null)
1012        return this;
1013      if (this.subject == null)
1014        this.subject = new ArrayList<Reference>();
1015      this.subject.add(t);
1016      return this;
1017    }
1018
1019    /**
1020     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
1021     */
1022    public Reference getSubjectFirstRep() { 
1023      if (getSubject().isEmpty()) {
1024        addSubject();
1025      }
1026      return getSubject().get(0);
1027    }
1028
1029    /**
1030     * @return {@link #servicePeriod} (The date range of services associated with this account.)
1031     */
1032    public Period getServicePeriod() { 
1033      if (this.servicePeriod == null)
1034        if (Configuration.errorOnAutoCreate())
1035          throw new Error("Attempt to auto-create Account.servicePeriod");
1036        else if (Configuration.doAutoCreate())
1037          this.servicePeriod = new Period(); // cc
1038      return this.servicePeriod;
1039    }
1040
1041    public boolean hasServicePeriod() { 
1042      return this.servicePeriod != null && !this.servicePeriod.isEmpty();
1043    }
1044
1045    /**
1046     * @param value {@link #servicePeriod} (The date range of services associated with this account.)
1047     */
1048    public Account setServicePeriod(Period value) { 
1049      this.servicePeriod = value;
1050      return this;
1051    }
1052
1053    /**
1054     * @return {@link #coverage} (The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.)
1055     */
1056    public List<CoverageComponent> getCoverage() { 
1057      if (this.coverage == null)
1058        this.coverage = new ArrayList<CoverageComponent>();
1059      return this.coverage;
1060    }
1061
1062    /**
1063     * @return Returns a reference to <code>this</code> for easy method chaining
1064     */
1065    public Account setCoverage(List<CoverageComponent> theCoverage) { 
1066      this.coverage = theCoverage;
1067      return this;
1068    }
1069
1070    public boolean hasCoverage() { 
1071      if (this.coverage == null)
1072        return false;
1073      for (CoverageComponent item : this.coverage)
1074        if (!item.isEmpty())
1075          return true;
1076      return false;
1077    }
1078
1079    public CoverageComponent addCoverage() { //3
1080      CoverageComponent t = new CoverageComponent();
1081      if (this.coverage == null)
1082        this.coverage = new ArrayList<CoverageComponent>();
1083      this.coverage.add(t);
1084      return t;
1085    }
1086
1087    public Account addCoverage(CoverageComponent t) { //3
1088      if (t == null)
1089        return this;
1090      if (this.coverage == null)
1091        this.coverage = new ArrayList<CoverageComponent>();
1092      this.coverage.add(t);
1093      return this;
1094    }
1095
1096    /**
1097     * @return The first repetition of repeating field {@link #coverage}, creating it if it does not already exist {3}
1098     */
1099    public CoverageComponent getCoverageFirstRep() { 
1100      if (getCoverage().isEmpty()) {
1101        addCoverage();
1102      }
1103      return getCoverage().get(0);
1104    }
1105
1106    /**
1107     * @return {@link #owner} (Indicates the service area, hospital, department, etc. with responsibility for managing the Account.)
1108     */
1109    public Reference getOwner() { 
1110      if (this.owner == null)
1111        if (Configuration.errorOnAutoCreate())
1112          throw new Error("Attempt to auto-create Account.owner");
1113        else if (Configuration.doAutoCreate())
1114          this.owner = new Reference(); // cc
1115      return this.owner;
1116    }
1117
1118    public boolean hasOwner() { 
1119      return this.owner != null && !this.owner.isEmpty();
1120    }
1121
1122    /**
1123     * @param value {@link #owner} (Indicates the service area, hospital, department, etc. with responsibility for managing the Account.)
1124     */
1125    public Account setOwner(Reference value) { 
1126      this.owner = value;
1127      return this;
1128    }
1129
1130    /**
1131     * @return {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1132     */
1133    public StringType getDescriptionElement() { 
1134      if (this.description == null)
1135        if (Configuration.errorOnAutoCreate())
1136          throw new Error("Attempt to auto-create Account.description");
1137        else if (Configuration.doAutoCreate())
1138          this.description = new StringType(); // bb
1139      return this.description;
1140    }
1141
1142    public boolean hasDescriptionElement() { 
1143      return this.description != null && !this.description.isEmpty();
1144    }
1145
1146    public boolean hasDescription() { 
1147      return this.description != null && !this.description.isEmpty();
1148    }
1149
1150    /**
1151     * @param value {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1152     */
1153    public Account setDescriptionElement(StringType value) { 
1154      this.description = value;
1155      return this;
1156    }
1157
1158    /**
1159     * @return Provides additional information about what the account tracks and how it is used.
1160     */
1161    public String getDescription() { 
1162      return this.description == null ? null : this.description.getValue();
1163    }
1164
1165    /**
1166     * @param value Provides additional information about what the account tracks and how it is used.
1167     */
1168    public Account setDescription(String value) { 
1169      if (Utilities.noString(value))
1170        this.description = null;
1171      else {
1172        if (this.description == null)
1173          this.description = new StringType();
1174        this.description.setValue(value);
1175      }
1176      return this;
1177    }
1178
1179    /**
1180     * @return {@link #guarantor} (The parties responsible for balancing the account if other payment options fall short.)
1181     */
1182    public List<GuarantorComponent> getGuarantor() { 
1183      if (this.guarantor == null)
1184        this.guarantor = new ArrayList<GuarantorComponent>();
1185      return this.guarantor;
1186    }
1187
1188    /**
1189     * @return Returns a reference to <code>this</code> for easy method chaining
1190     */
1191    public Account setGuarantor(List<GuarantorComponent> theGuarantor) { 
1192      this.guarantor = theGuarantor;
1193      return this;
1194    }
1195
1196    public boolean hasGuarantor() { 
1197      if (this.guarantor == null)
1198        return false;
1199      for (GuarantorComponent item : this.guarantor)
1200        if (!item.isEmpty())
1201          return true;
1202      return false;
1203    }
1204
1205    public GuarantorComponent addGuarantor() { //3
1206      GuarantorComponent t = new GuarantorComponent();
1207      if (this.guarantor == null)
1208        this.guarantor = new ArrayList<GuarantorComponent>();
1209      this.guarantor.add(t);
1210      return t;
1211    }
1212
1213    public Account addGuarantor(GuarantorComponent t) { //3
1214      if (t == null)
1215        return this;
1216      if (this.guarantor == null)
1217        this.guarantor = new ArrayList<GuarantorComponent>();
1218      this.guarantor.add(t);
1219      return this;
1220    }
1221
1222    /**
1223     * @return The first repetition of repeating field {@link #guarantor}, creating it if it does not already exist {3}
1224     */
1225    public GuarantorComponent getGuarantorFirstRep() { 
1226      if (getGuarantor().isEmpty()) {
1227        addGuarantor();
1228      }
1229      return getGuarantor().get(0);
1230    }
1231
1232    /**
1233     * @return {@link #partOf} (Reference to a parent Account.)
1234     */
1235    public Reference getPartOf() { 
1236      if (this.partOf == null)
1237        if (Configuration.errorOnAutoCreate())
1238          throw new Error("Attempt to auto-create Account.partOf");
1239        else if (Configuration.doAutoCreate())
1240          this.partOf = new Reference(); // cc
1241      return this.partOf;
1242    }
1243
1244    public boolean hasPartOf() { 
1245      return this.partOf != null && !this.partOf.isEmpty();
1246    }
1247
1248    /**
1249     * @param value {@link #partOf} (Reference to a parent Account.)
1250     */
1251    public Account setPartOf(Reference value) { 
1252      this.partOf = value;
1253      return this;
1254    }
1255
1256      protected void listChildren(List<Property> children) {
1257        super.listChildren(children);
1258        children.add(new Property("identifier", "Identifier", "Unique identifier used to reference the account.  Might or might not be intended for human use (e.g. credit card number).", 0, java.lang.Integer.MAX_VALUE, identifier));
1259        children.add(new Property("status", "code", "Indicates whether the account is presently used/usable or not.", 0, 1, status));
1260        children.add(new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, 1, type));
1261        children.add(new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, 1, name));
1262        children.add(new Property("subject", "Reference(Patient|Device|Practitioner|PractitionerRole|Location|HealthcareService|Organization)", "Identifies the entity which incurs the expenses. While the immediate recipients of services or goods might be entities related to the subject, the expenses were ultimately incurred by the subject of the Account.", 0, java.lang.Integer.MAX_VALUE, subject));
1263        children.add(new Property("servicePeriod", "Period", "The date range of services associated with this account.", 0, 1, servicePeriod));
1264        children.add(new Property("coverage", "", "The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.", 0, java.lang.Integer.MAX_VALUE, coverage));
1265        children.add(new Property("owner", "Reference(Organization)", "Indicates the service area, hospital, department, etc. with responsibility for managing the Account.", 0, 1, owner));
1266        children.add(new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, 1, description));
1267        children.add(new Property("guarantor", "", "The parties responsible for balancing the account if other payment options fall short.", 0, java.lang.Integer.MAX_VALUE, guarantor));
1268        children.add(new Property("partOf", "Reference(Account)", "Reference to a parent Account.", 0, 1, partOf));
1269      }
1270
1271      @Override
1272      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1273        switch (_hash) {
1274        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier used to reference the account.  Might or might not be intended for human use (e.g. credit card number).", 0, java.lang.Integer.MAX_VALUE, identifier);
1275        case -892481550: /*status*/  return new Property("status", "code", "Indicates whether the account is presently used/usable or not.", 0, 1, status);
1276        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, 1, type);
1277        case 3373707: /*name*/  return new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, 1, name);
1278        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Device|Practitioner|PractitionerRole|Location|HealthcareService|Organization)", "Identifies the entity which incurs the expenses. While the immediate recipients of services or goods might be entities related to the subject, the expenses were ultimately incurred by the subject of the Account.", 0, java.lang.Integer.MAX_VALUE, subject);
1279        case 2129104086: /*servicePeriod*/  return new Property("servicePeriod", "Period", "The date range of services associated with this account.", 0, 1, servicePeriod);
1280        case -351767064: /*coverage*/  return new Property("coverage", "", "The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.", 0, java.lang.Integer.MAX_VALUE, coverage);
1281        case 106164915: /*owner*/  return new Property("owner", "Reference(Organization)", "Indicates the service area, hospital, department, etc. with responsibility for managing the Account.", 0, 1, owner);
1282        case -1724546052: /*description*/  return new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, 1, description);
1283        case -188629045: /*guarantor*/  return new Property("guarantor", "", "The parties responsible for balancing the account if other payment options fall short.", 0, java.lang.Integer.MAX_VALUE, guarantor);
1284        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Account)", "Reference to a parent Account.", 0, 1, partOf);
1285        default: return super.getNamedProperty(_hash, _name, _checkValid);
1286        }
1287
1288      }
1289
1290      @Override
1291      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1292        switch (hash) {
1293        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1294        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AccountStatus>
1295        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1296        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1297        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
1298        case 2129104086: /*servicePeriod*/ return this.servicePeriod == null ? new Base[0] : new Base[] {this.servicePeriod}; // Period
1299        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : this.coverage.toArray(new Base[this.coverage.size()]); // CoverageComponent
1300        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
1301        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1302        case -188629045: /*guarantor*/ return this.guarantor == null ? new Base[0] : this.guarantor.toArray(new Base[this.guarantor.size()]); // GuarantorComponent
1303        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : new Base[] {this.partOf}; // Reference
1304        default: return super.getProperty(hash, name, checkValid);
1305        }
1306
1307      }
1308
1309      @Override
1310      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1311        switch (hash) {
1312        case -1618432855: // identifier
1313          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1314          return value;
1315        case -892481550: // status
1316          value = new AccountStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1317          this.status = (Enumeration) value; // Enumeration<AccountStatus>
1318          return value;
1319        case 3575610: // type
1320          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1321          return value;
1322        case 3373707: // name
1323          this.name = TypeConvertor.castToString(value); // StringType
1324          return value;
1325        case -1867885268: // subject
1326          this.getSubject().add(TypeConvertor.castToReference(value)); // Reference
1327          return value;
1328        case 2129104086: // servicePeriod
1329          this.servicePeriod = TypeConvertor.castToPeriod(value); // Period
1330          return value;
1331        case -351767064: // coverage
1332          this.getCoverage().add((CoverageComponent) value); // CoverageComponent
1333          return value;
1334        case 106164915: // owner
1335          this.owner = TypeConvertor.castToReference(value); // Reference
1336          return value;
1337        case -1724546052: // description
1338          this.description = TypeConvertor.castToString(value); // StringType
1339          return value;
1340        case -188629045: // guarantor
1341          this.getGuarantor().add((GuarantorComponent) value); // GuarantorComponent
1342          return value;
1343        case -995410646: // partOf
1344          this.partOf = TypeConvertor.castToReference(value); // Reference
1345          return value;
1346        default: return super.setProperty(hash, name, value);
1347        }
1348
1349      }
1350
1351      @Override
1352      public Base setProperty(String name, Base value) throws FHIRException {
1353        if (name.equals("identifier")) {
1354          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1355        } else if (name.equals("status")) {
1356          value = new AccountStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1357          this.status = (Enumeration) value; // Enumeration<AccountStatus>
1358        } else if (name.equals("type")) {
1359          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1360        } else if (name.equals("name")) {
1361          this.name = TypeConvertor.castToString(value); // StringType
1362        } else if (name.equals("subject")) {
1363          this.getSubject().add(TypeConvertor.castToReference(value));
1364        } else if (name.equals("servicePeriod")) {
1365          this.servicePeriod = TypeConvertor.castToPeriod(value); // Period
1366        } else if (name.equals("coverage")) {
1367          this.getCoverage().add((CoverageComponent) value);
1368        } else if (name.equals("owner")) {
1369          this.owner = TypeConvertor.castToReference(value); // Reference
1370        } else if (name.equals("description")) {
1371          this.description = TypeConvertor.castToString(value); // StringType
1372        } else if (name.equals("guarantor")) {
1373          this.getGuarantor().add((GuarantorComponent) value);
1374        } else if (name.equals("partOf")) {
1375          this.partOf = TypeConvertor.castToReference(value); // Reference
1376        } else
1377          return super.setProperty(name, value);
1378        return value;
1379      }
1380
1381      @Override
1382      public Base makeProperty(int hash, String name) throws FHIRException {
1383        switch (hash) {
1384        case -1618432855:  return addIdentifier(); 
1385        case -892481550:  return getStatusElement();
1386        case 3575610:  return getType();
1387        case 3373707:  return getNameElement();
1388        case -1867885268:  return addSubject(); 
1389        case 2129104086:  return getServicePeriod();
1390        case -351767064:  return addCoverage(); 
1391        case 106164915:  return getOwner();
1392        case -1724546052:  return getDescriptionElement();
1393        case -188629045:  return addGuarantor(); 
1394        case -995410646:  return getPartOf();
1395        default: return super.makeProperty(hash, name);
1396        }
1397
1398      }
1399
1400      @Override
1401      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1402        switch (hash) {
1403        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1404        case -892481550: /*status*/ return new String[] {"code"};
1405        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1406        case 3373707: /*name*/ return new String[] {"string"};
1407        case -1867885268: /*subject*/ return new String[] {"Reference"};
1408        case 2129104086: /*servicePeriod*/ return new String[] {"Period"};
1409        case -351767064: /*coverage*/ return new String[] {};
1410        case 106164915: /*owner*/ return new String[] {"Reference"};
1411        case -1724546052: /*description*/ return new String[] {"string"};
1412        case -188629045: /*guarantor*/ return new String[] {};
1413        case -995410646: /*partOf*/ return new String[] {"Reference"};
1414        default: return super.getTypesForProperty(hash, name);
1415        }
1416
1417      }
1418
1419      @Override
1420      public Base addChild(String name) throws FHIRException {
1421        if (name.equals("identifier")) {
1422          return addIdentifier();
1423        }
1424        else if (name.equals("status")) {
1425          throw new FHIRException("Cannot call addChild on a primitive type Account.status");
1426        }
1427        else if (name.equals("type")) {
1428          this.type = new CodeableConcept();
1429          return this.type;
1430        }
1431        else if (name.equals("name")) {
1432          throw new FHIRException("Cannot call addChild on a primitive type Account.name");
1433        }
1434        else if (name.equals("subject")) {
1435          return addSubject();
1436        }
1437        else if (name.equals("servicePeriod")) {
1438          this.servicePeriod = new Period();
1439          return this.servicePeriod;
1440        }
1441        else if (name.equals("coverage")) {
1442          return addCoverage();
1443        }
1444        else if (name.equals("owner")) {
1445          this.owner = new Reference();
1446          return this.owner;
1447        }
1448        else if (name.equals("description")) {
1449          throw new FHIRException("Cannot call addChild on a primitive type Account.description");
1450        }
1451        else if (name.equals("guarantor")) {
1452          return addGuarantor();
1453        }
1454        else if (name.equals("partOf")) {
1455          this.partOf = new Reference();
1456          return this.partOf;
1457        }
1458        else
1459          return super.addChild(name);
1460      }
1461
1462  public String fhirType() {
1463    return "Account";
1464
1465  }
1466
1467      public Account copy() {
1468        Account dst = new Account();
1469        copyValues(dst);
1470        return dst;
1471      }
1472
1473      public void copyValues(Account dst) {
1474        super.copyValues(dst);
1475        if (identifier != null) {
1476          dst.identifier = new ArrayList<Identifier>();
1477          for (Identifier i : identifier)
1478            dst.identifier.add(i.copy());
1479        };
1480        dst.status = status == null ? null : status.copy();
1481        dst.type = type == null ? null : type.copy();
1482        dst.name = name == null ? null : name.copy();
1483        if (subject != null) {
1484          dst.subject = new ArrayList<Reference>();
1485          for (Reference i : subject)
1486            dst.subject.add(i.copy());
1487        };
1488        dst.servicePeriod = servicePeriod == null ? null : servicePeriod.copy();
1489        if (coverage != null) {
1490          dst.coverage = new ArrayList<CoverageComponent>();
1491          for (CoverageComponent i : coverage)
1492            dst.coverage.add(i.copy());
1493        };
1494        dst.owner = owner == null ? null : owner.copy();
1495        dst.description = description == null ? null : description.copy();
1496        if (guarantor != null) {
1497          dst.guarantor = new ArrayList<GuarantorComponent>();
1498          for (GuarantorComponent i : guarantor)
1499            dst.guarantor.add(i.copy());
1500        };
1501        dst.partOf = partOf == null ? null : partOf.copy();
1502      }
1503
1504      protected Account typedCopy() {
1505        return copy();
1506      }
1507
1508      @Override
1509      public boolean equalsDeep(Base other_) {
1510        if (!super.equalsDeep(other_))
1511          return false;
1512        if (!(other_ instanceof Account))
1513          return false;
1514        Account o = (Account) other_;
1515        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
1516           && compareDeep(name, o.name, true) && compareDeep(subject, o.subject, true) && compareDeep(servicePeriod, o.servicePeriod, true)
1517           && compareDeep(coverage, o.coverage, true) && compareDeep(owner, o.owner, true) && compareDeep(description, o.description, true)
1518           && compareDeep(guarantor, o.guarantor, true) && compareDeep(partOf, o.partOf, true);
1519      }
1520
1521      @Override
1522      public boolean equalsShallow(Base other_) {
1523        if (!super.equalsShallow(other_))
1524          return false;
1525        if (!(other_ instanceof Account))
1526          return false;
1527        Account o = (Account) other_;
1528        return compareValues(status, o.status, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
1529          ;
1530      }
1531
1532      public boolean isEmpty() {
1533        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
1534          , name, subject, servicePeriod, coverage, owner, description, guarantor, partOf
1535          );
1536      }
1537
1538  @Override
1539  public ResourceType getResourceType() {
1540    return ResourceType.Account;
1541   }
1542
1543 /**
1544   * Search parameter: <b>identifier</b>
1545   * <p>
1546   * Description: <b>Account number</b><br>
1547   * Type: <b>token</b><br>
1548   * Path: <b>Account.identifier</b><br>
1549   * </p>
1550   */
1551  @SearchParamDefinition(name="identifier", path="Account.identifier", description="Account number", type="token" )
1552  public static final String SP_IDENTIFIER = "identifier";
1553 /**
1554   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1555   * <p>
1556   * Description: <b>Account number</b><br>
1557   * Type: <b>token</b><br>
1558   * Path: <b>Account.identifier</b><br>
1559   * </p>
1560   */
1561  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1562
1563 /**
1564   * Search parameter: <b>name</b>
1565   * <p>
1566   * Description: <b>Human-readable label</b><br>
1567   * Type: <b>string</b><br>
1568   * Path: <b>Account.name</b><br>
1569   * </p>
1570   */
1571  @SearchParamDefinition(name="name", path="Account.name", description="Human-readable label", type="string" )
1572  public static final String SP_NAME = "name";
1573 /**
1574   * <b>Fluent Client</b> search parameter constant for <b>name</b>
1575   * <p>
1576   * Description: <b>Human-readable label</b><br>
1577   * Type: <b>string</b><br>
1578   * Path: <b>Account.name</b><br>
1579   * </p>
1580   */
1581  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
1582
1583 /**
1584   * Search parameter: <b>owner</b>
1585   * <p>
1586   * Description: <b>Entity managing the Account</b><br>
1587   * Type: <b>reference</b><br>
1588   * Path: <b>Account.owner</b><br>
1589   * </p>
1590   */
1591  @SearchParamDefinition(name="owner", path="Account.owner", description="Entity managing the Account", type="reference", target={Organization.class } )
1592  public static final String SP_OWNER = "owner";
1593 /**
1594   * <b>Fluent Client</b> search parameter constant for <b>owner</b>
1595   * <p>
1596   * Description: <b>Entity managing the Account</b><br>
1597   * Type: <b>reference</b><br>
1598   * Path: <b>Account.owner</b><br>
1599   * </p>
1600   */
1601  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
1602
1603/**
1604   * Constant for fluent queries to be used to add include statements. Specifies
1605   * the path value of "<b>Account:owner</b>".
1606   */
1607  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Account:owner").toLocked();
1608
1609 /**
1610   * Search parameter: <b>patient</b>
1611   * <p>
1612   * Description: <b>The entity that caused the expenses</b><br>
1613   * Type: <b>reference</b><br>
1614   * Path: <b>Account.subject.where(resolve() is Patient)</b><br>
1615   * </p>
1616   */
1617  @SearchParamDefinition(name="patient", path="Account.subject.where(resolve() is Patient)", description="The entity that caused the expenses", type="reference", target={Patient.class } )
1618  public static final String SP_PATIENT = "patient";
1619 /**
1620   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1621   * <p>
1622   * Description: <b>The entity that caused the expenses</b><br>
1623   * Type: <b>reference</b><br>
1624   * Path: <b>Account.subject.where(resolve() is Patient)</b><br>
1625   * </p>
1626   */
1627  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1628
1629/**
1630   * Constant for fluent queries to be used to add include statements. Specifies
1631   * the path value of "<b>Account:patient</b>".
1632   */
1633  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Account:patient").toLocked();
1634
1635 /**
1636   * Search parameter: <b>period</b>
1637   * <p>
1638   * Description: <b>Transaction window</b><br>
1639   * Type: <b>date</b><br>
1640   * Path: <b>Account.servicePeriod</b><br>
1641   * </p>
1642   */
1643  @SearchParamDefinition(name="period", path="Account.servicePeriod", description="Transaction window", type="date" )
1644  public static final String SP_PERIOD = "period";
1645 /**
1646   * <b>Fluent Client</b> search parameter constant for <b>period</b>
1647   * <p>
1648   * Description: <b>Transaction window</b><br>
1649   * Type: <b>date</b><br>
1650   * Path: <b>Account.servicePeriod</b><br>
1651   * </p>
1652   */
1653  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
1654
1655 /**
1656   * Search parameter: <b>status</b>
1657   * <p>
1658   * Description: <b>active | inactive | entered-in-error | on-hold | unknown</b><br>
1659   * Type: <b>token</b><br>
1660   * Path: <b>Account.status</b><br>
1661   * </p>
1662   */
1663  @SearchParamDefinition(name="status", path="Account.status", description="active | inactive | entered-in-error | on-hold | unknown", type="token" )
1664  public static final String SP_STATUS = "status";
1665 /**
1666   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1667   * <p>
1668   * Description: <b>active | inactive | entered-in-error | on-hold | unknown</b><br>
1669   * Type: <b>token</b><br>
1670   * Path: <b>Account.status</b><br>
1671   * </p>
1672   */
1673  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1674
1675 /**
1676   * Search parameter: <b>subject</b>
1677   * <p>
1678   * Description: <b>The entity that caused the expenses</b><br>
1679   * Type: <b>reference</b><br>
1680   * Path: <b>Account.subject</b><br>
1681   * </p>
1682   */
1683  @SearchParamDefinition(name="subject", path="Account.subject", description="The entity that caused the expenses", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Device.class, HealthcareService.class, Location.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class } )
1684  public static final String SP_SUBJECT = "subject";
1685 /**
1686   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1687   * <p>
1688   * Description: <b>The entity that caused the expenses</b><br>
1689   * Type: <b>reference</b><br>
1690   * Path: <b>Account.subject</b><br>
1691   * </p>
1692   */
1693  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1694
1695/**
1696   * Constant for fluent queries to be used to add include statements. Specifies
1697   * the path value of "<b>Account:subject</b>".
1698   */
1699  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Account:subject").toLocked();
1700
1701 /**
1702   * Search parameter: <b>type</b>
1703   * <p>
1704   * Description: <b>E.g. patient, expense, depreciation</b><br>
1705   * Type: <b>token</b><br>
1706   * Path: <b>Account.type</b><br>
1707   * </p>
1708   */
1709  @SearchParamDefinition(name="type", path="Account.type", description="E.g. patient, expense, depreciation", type="token" )
1710  public static final String SP_TYPE = "type";
1711 /**
1712   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1713   * <p>
1714   * Description: <b>E.g. patient, expense, depreciation</b><br>
1715   * Type: <b>token</b><br>
1716   * Path: <b>Account.type</b><br>
1717   * </p>
1718   */
1719  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1720
1721
1722}