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