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