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