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