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