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