001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043/**
044 * A financial tool for tracking value accrued for a particular purpose.  In the healthcare field, used to track charges for a patient, cost centres, etc.
045 */
046@ResourceDef(name="Account", profile="http://hl7.org/fhir/Profile/Account")
047public class Account extends DomainResource {
048
049    public enum AccountStatus {
050        /**
051         * This account is active and may be used.
052         */
053        ACTIVE, 
054        /**
055         * This account is inactive and should not be used to track financial information.
056         */
057        INACTIVE, 
058        /**
059         * added to help the parsers
060         */
061        NULL;
062        public static AccountStatus fromCode(String codeString) throws FHIRException {
063            if (codeString == null || "".equals(codeString))
064                return null;
065        if ("active".equals(codeString))
066          return ACTIVE;
067        if ("inactive".equals(codeString))
068          return INACTIVE;
069        throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
070        }
071        public String toCode() {
072          switch (this) {
073            case ACTIVE: return "active";
074            case INACTIVE: return "inactive";
075            default: return "?";
076          }
077        }
078        public String getSystem() {
079          switch (this) {
080            case ACTIVE: return "http://hl7.org/fhir/account-status";
081            case INACTIVE: return "http://hl7.org/fhir/account-status";
082            default: return "?";
083          }
084        }
085        public String getDefinition() {
086          switch (this) {
087            case ACTIVE: return "This account is active and may be used.";
088            case INACTIVE: return "This account is inactive and should not be used to track financial information.";
089            default: return "?";
090          }
091        }
092        public String getDisplay() {
093          switch (this) {
094            case ACTIVE: return "Active";
095            case INACTIVE: return "Inactive";
096            default: return "?";
097          }
098        }
099    }
100
101  public static class AccountStatusEnumFactory implements EnumFactory<AccountStatus> {
102    public AccountStatus fromCode(String codeString) throws IllegalArgumentException {
103      if (codeString == null || "".equals(codeString))
104            if (codeString == null || "".equals(codeString))
105                return null;
106        if ("active".equals(codeString))
107          return AccountStatus.ACTIVE;
108        if ("inactive".equals(codeString))
109          return AccountStatus.INACTIVE;
110        throw new IllegalArgumentException("Unknown AccountStatus code '"+codeString+"'");
111        }
112        public Enumeration<AccountStatus> fromType(Base code) throws FHIRException {
113          if (code == null || code.isEmpty())
114            return null;
115          String codeString = ((PrimitiveType) code).asStringValue();
116          if (codeString == null || "".equals(codeString))
117            return null;
118        if ("active".equals(codeString))
119          return new Enumeration<AccountStatus>(this, AccountStatus.ACTIVE);
120        if ("inactive".equals(codeString))
121          return new Enumeration<AccountStatus>(this, AccountStatus.INACTIVE);
122        throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
123        }
124    public String toCode(AccountStatus code) {
125      if (code == AccountStatus.ACTIVE)
126        return "active";
127      if (code == AccountStatus.INACTIVE)
128        return "inactive";
129      return "?";
130      }
131    public String toSystem(AccountStatus code) {
132      return code.getSystem();
133      }
134    }
135
136    /**
137     * Unique identifier used to reference the account.  May or may not be intended for human use (e.g. credit card number).
138     */
139    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
140    @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)." )
141    protected List<Identifier> identifier;
142
143    /**
144     * Name used for the account when displaying it to humans in reports, etc.
145     */
146    @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
147    @Description(shortDefinition="Human-readable label", formalDefinition="Name used for the account when displaying it to humans in reports, etc." )
148    protected StringType name;
149
150    /**
151     * Categorizes the account for reporting and searching purposes.
152     */
153    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
154    @Description(shortDefinition="E.g. patient, expense, depreciation", formalDefinition="Categorizes the account for reporting and searching purposes." )
155    protected CodeableConcept type;
156
157    /**
158     * Indicates whether the account is presently used/useable or not.
159     */
160    @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
161    @Description(shortDefinition="active | inactive", formalDefinition="Indicates whether the account is presently used/useable or not." )
162    protected Enumeration<AccountStatus> status;
163
164    /**
165     * Indicates the period of time over which the account is allowed.
166     */
167    @Child(name = "activePeriod", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
168    @Description(shortDefinition="Valid from..to", formalDefinition="Indicates the period of time over which the account is allowed." )
169    protected Period activePeriod;
170
171    /**
172     * Identifies the currency to which transactions must be converted when crediting or debiting the account.
173     */
174    @Child(name = "currency", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
175    @Description(shortDefinition="Base currency in which balance is tracked", formalDefinition="Identifies the currency to which transactions must be converted when crediting or debiting the account." )
176    protected Coding currency;
177
178    /**
179     * Represents the sum of all credits less all debits associated with the account.  Might be positive, zero or negative.
180     */
181    @Child(name = "balance", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true)
182    @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." )
183    protected Money balance;
184
185    /**
186     * Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.
187     */
188    @Child(name = "coveragePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
189    @Description(shortDefinition="Transaction window", formalDefinition="Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc." )
190    protected Period coveragePeriod;
191
192    /**
193     * Identifies the patient, device, practitioner, location or other object the account is associated with.
194     */
195    @Child(name = "subject", type = {Patient.class, Device.class, Practitioner.class, Location.class, HealthcareService.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=true)
196    @Description(shortDefinition="What is account tied to?", formalDefinition="Identifies the patient, device, practitioner, location or other object the account is associated with." )
197    protected Reference subject;
198
199    /**
200     * The actual object that is the target of the reference (Identifies the patient, device, practitioner, location or other object the account is associated with.)
201     */
202    protected Resource subjectTarget;
203
204    /**
205     * Indicates the organization, department, etc. with responsibility for the account.
206     */
207    @Child(name = "owner", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
208    @Description(shortDefinition="Who is responsible?", formalDefinition="Indicates the organization, department, etc. with responsibility for the account." )
209    protected Reference owner;
210
211    /**
212     * The actual object that is the target of the reference (Indicates the organization, department, etc. with responsibility for the account.)
213     */
214    protected Organization ownerTarget;
215
216    /**
217     * Provides additional information about what the account tracks and how it is used.
218     */
219    @Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
220    @Description(shortDefinition="Explanation of purpose/use", formalDefinition="Provides additional information about what the account tracks and how it is used." )
221    protected StringType description;
222
223    private static final long serialVersionUID = -1926153194L;
224
225  /**
226   * Constructor
227   */
228    public Account() {
229      super();
230    }
231
232    /**
233     * @return {@link #identifier} (Unique identifier used to reference the account.  May or may not be intended for human use (e.g. credit card number).)
234     */
235    public List<Identifier> getIdentifier() { 
236      if (this.identifier == null)
237        this.identifier = new ArrayList<Identifier>();
238      return this.identifier;
239    }
240
241    public boolean hasIdentifier() { 
242      if (this.identifier == null)
243        return false;
244      for (Identifier item : this.identifier)
245        if (!item.isEmpty())
246          return true;
247      return false;
248    }
249
250    /**
251     * @return {@link #identifier} (Unique identifier used to reference the account.  May or may not be intended for human use (e.g. credit card number).)
252     */
253    // syntactic sugar
254    public Identifier addIdentifier() { //3
255      Identifier t = new Identifier();
256      if (this.identifier == null)
257        this.identifier = new ArrayList<Identifier>();
258      this.identifier.add(t);
259      return t;
260    }
261
262    // syntactic sugar
263    public Account addIdentifier(Identifier t) { //3
264      if (t == null)
265        return this;
266      if (this.identifier == null)
267        this.identifier = new ArrayList<Identifier>();
268      this.identifier.add(t);
269      return this;
270    }
271
272    /**
273     * @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
274     */
275    public StringType getNameElement() { 
276      if (this.name == null)
277        if (Configuration.errorOnAutoCreate())
278          throw new Error("Attempt to auto-create Account.name");
279        else if (Configuration.doAutoCreate())
280          this.name = new StringType(); // bb
281      return this.name;
282    }
283
284    public boolean hasNameElement() { 
285      return this.name != null && !this.name.isEmpty();
286    }
287
288    public boolean hasName() { 
289      return this.name != null && !this.name.isEmpty();
290    }
291
292    /**
293     * @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
294     */
295    public Account setNameElement(StringType value) { 
296      this.name = value;
297      return this;
298    }
299
300    /**
301     * @return Name used for the account when displaying it to humans in reports, etc.
302     */
303    public String getName() { 
304      return this.name == null ? null : this.name.getValue();
305    }
306
307    /**
308     * @param value Name used for the account when displaying it to humans in reports, etc.
309     */
310    public Account setName(String value) { 
311      if (Utilities.noString(value))
312        this.name = null;
313      else {
314        if (this.name == null)
315          this.name = new StringType();
316        this.name.setValue(value);
317      }
318      return this;
319    }
320
321    /**
322     * @return {@link #type} (Categorizes the account for reporting and searching purposes.)
323     */
324    public CodeableConcept getType() { 
325      if (this.type == null)
326        if (Configuration.errorOnAutoCreate())
327          throw new Error("Attempt to auto-create Account.type");
328        else if (Configuration.doAutoCreate())
329          this.type = new CodeableConcept(); // cc
330      return this.type;
331    }
332
333    public boolean hasType() { 
334      return this.type != null && !this.type.isEmpty();
335    }
336
337    /**
338     * @param value {@link #type} (Categorizes the account for reporting and searching purposes.)
339     */
340    public Account setType(CodeableConcept value) { 
341      this.type = value;
342      return this;
343    }
344
345    /**
346     * @return {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
347     */
348    public Enumeration<AccountStatus> getStatusElement() { 
349      if (this.status == null)
350        if (Configuration.errorOnAutoCreate())
351          throw new Error("Attempt to auto-create Account.status");
352        else if (Configuration.doAutoCreate())
353          this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory()); // bb
354      return this.status;
355    }
356
357    public boolean hasStatusElement() { 
358      return this.status != null && !this.status.isEmpty();
359    }
360
361    public boolean hasStatus() { 
362      return this.status != null && !this.status.isEmpty();
363    }
364
365    /**
366     * @param value {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
367     */
368    public Account setStatusElement(Enumeration<AccountStatus> value) { 
369      this.status = value;
370      return this;
371    }
372
373    /**
374     * @return Indicates whether the account is presently used/useable or not.
375     */
376    public AccountStatus getStatus() { 
377      return this.status == null ? null : this.status.getValue();
378    }
379
380    /**
381     * @param value Indicates whether the account is presently used/useable or not.
382     */
383    public Account setStatus(AccountStatus value) { 
384      if (value == null)
385        this.status = null;
386      else {
387        if (this.status == null)
388          this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory());
389        this.status.setValue(value);
390      }
391      return this;
392    }
393
394    /**
395     * @return {@link #activePeriod} (Indicates the period of time over which the account is allowed.)
396     */
397    public Period getActivePeriod() { 
398      if (this.activePeriod == null)
399        if (Configuration.errorOnAutoCreate())
400          throw new Error("Attempt to auto-create Account.activePeriod");
401        else if (Configuration.doAutoCreate())
402          this.activePeriod = new Period(); // cc
403      return this.activePeriod;
404    }
405
406    public boolean hasActivePeriod() { 
407      return this.activePeriod != null && !this.activePeriod.isEmpty();
408    }
409
410    /**
411     * @param value {@link #activePeriod} (Indicates the period of time over which the account is allowed.)
412     */
413    public Account setActivePeriod(Period value) { 
414      this.activePeriod = value;
415      return this;
416    }
417
418    /**
419     * @return {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.)
420     */
421    public Coding getCurrency() { 
422      if (this.currency == null)
423        if (Configuration.errorOnAutoCreate())
424          throw new Error("Attempt to auto-create Account.currency");
425        else if (Configuration.doAutoCreate())
426          this.currency = new Coding(); // cc
427      return this.currency;
428    }
429
430    public boolean hasCurrency() { 
431      return this.currency != null && !this.currency.isEmpty();
432    }
433
434    /**
435     * @param value {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.)
436     */
437    public Account setCurrency(Coding value) { 
438      this.currency = value;
439      return this;
440    }
441
442    /**
443     * @return {@link #balance} (Represents the sum of all credits less all debits associated with the account.  Might be positive, zero or negative.)
444     */
445    public Money getBalance() { 
446      if (this.balance == null)
447        if (Configuration.errorOnAutoCreate())
448          throw new Error("Attempt to auto-create Account.balance");
449        else if (Configuration.doAutoCreate())
450          this.balance = new Money(); // cc
451      return this.balance;
452    }
453
454    public boolean hasBalance() { 
455      return this.balance != null && !this.balance.isEmpty();
456    }
457
458    /**
459     * @param value {@link #balance} (Represents the sum of all credits less all debits associated with the account.  Might be positive, zero or negative.)
460     */
461    public Account setBalance(Money value) { 
462      this.balance = value;
463      return this;
464    }
465
466    /**
467     * @return {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
468     */
469    public Period getCoveragePeriod() { 
470      if (this.coveragePeriod == null)
471        if (Configuration.errorOnAutoCreate())
472          throw new Error("Attempt to auto-create Account.coveragePeriod");
473        else if (Configuration.doAutoCreate())
474          this.coveragePeriod = new Period(); // cc
475      return this.coveragePeriod;
476    }
477
478    public boolean hasCoveragePeriod() { 
479      return this.coveragePeriod != null && !this.coveragePeriod.isEmpty();
480    }
481
482    /**
483     * @param value {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
484     */
485    public Account setCoveragePeriod(Period value) { 
486      this.coveragePeriod = value;
487      return this;
488    }
489
490    /**
491     * @return {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.)
492     */
493    public Reference getSubject() { 
494      if (this.subject == null)
495        if (Configuration.errorOnAutoCreate())
496          throw new Error("Attempt to auto-create Account.subject");
497        else if (Configuration.doAutoCreate())
498          this.subject = new Reference(); // cc
499      return this.subject;
500    }
501
502    public boolean hasSubject() { 
503      return this.subject != null && !this.subject.isEmpty();
504    }
505
506    /**
507     * @param value {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.)
508     */
509    public Account setSubject(Reference value) { 
510      this.subject = value;
511      return this;
512    }
513
514    /**
515     * @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.)
516     */
517    public Resource getSubjectTarget() { 
518      return this.subjectTarget;
519    }
520
521    /**
522     * @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.)
523     */
524    public Account setSubjectTarget(Resource value) { 
525      this.subjectTarget = value;
526      return this;
527    }
528
529    /**
530     * @return {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.)
531     */
532    public Reference getOwner() { 
533      if (this.owner == null)
534        if (Configuration.errorOnAutoCreate())
535          throw new Error("Attempt to auto-create Account.owner");
536        else if (Configuration.doAutoCreate())
537          this.owner = new Reference(); // cc
538      return this.owner;
539    }
540
541    public boolean hasOwner() { 
542      return this.owner != null && !this.owner.isEmpty();
543    }
544
545    /**
546     * @param value {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.)
547     */
548    public Account setOwner(Reference value) { 
549      this.owner = value;
550      return this;
551    }
552
553    /**
554     * @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.)
555     */
556    public Organization getOwnerTarget() { 
557      if (this.ownerTarget == null)
558        if (Configuration.errorOnAutoCreate())
559          throw new Error("Attempt to auto-create Account.owner");
560        else if (Configuration.doAutoCreate())
561          this.ownerTarget = new Organization(); // aa
562      return this.ownerTarget;
563    }
564
565    /**
566     * @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.)
567     */
568    public Account setOwnerTarget(Organization value) { 
569      this.ownerTarget = value;
570      return this;
571    }
572
573    /**
574     * @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
575     */
576    public StringType getDescriptionElement() { 
577      if (this.description == null)
578        if (Configuration.errorOnAutoCreate())
579          throw new Error("Attempt to auto-create Account.description");
580        else if (Configuration.doAutoCreate())
581          this.description = new StringType(); // bb
582      return this.description;
583    }
584
585    public boolean hasDescriptionElement() { 
586      return this.description != null && !this.description.isEmpty();
587    }
588
589    public boolean hasDescription() { 
590      return this.description != null && !this.description.isEmpty();
591    }
592
593    /**
594     * @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
595     */
596    public Account setDescriptionElement(StringType value) { 
597      this.description = value;
598      return this;
599    }
600
601    /**
602     * @return Provides additional information about what the account tracks and how it is used.
603     */
604    public String getDescription() { 
605      return this.description == null ? null : this.description.getValue();
606    }
607
608    /**
609     * @param value Provides additional information about what the account tracks and how it is used.
610     */
611    public Account setDescription(String value) { 
612      if (Utilities.noString(value))
613        this.description = null;
614      else {
615        if (this.description == null)
616          this.description = new StringType();
617        this.description.setValue(value);
618      }
619      return this;
620    }
621
622      protected void listChildren(List<Property> childrenList) {
623        super.listChildren(childrenList);
624        childrenList.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));
625        childrenList.add(new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, java.lang.Integer.MAX_VALUE, name));
626        childrenList.add(new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, java.lang.Integer.MAX_VALUE, type));
627        childrenList.add(new Property("status", "code", "Indicates whether the account is presently used/useable or not.", 0, java.lang.Integer.MAX_VALUE, status));
628        childrenList.add(new Property("activePeriod", "Period", "Indicates the period of time over which the account is allowed.", 0, java.lang.Integer.MAX_VALUE, activePeriod));
629        childrenList.add(new Property("currency", "Coding", "Identifies the currency to which transactions must be converted when crediting or debiting the account.", 0, java.lang.Integer.MAX_VALUE, currency));
630        childrenList.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, java.lang.Integer.MAX_VALUE, balance));
631        childrenList.add(new Property("coveragePeriod", "Period", "Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.", 0, java.lang.Integer.MAX_VALUE, coveragePeriod));
632        childrenList.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, java.lang.Integer.MAX_VALUE, subject));
633        childrenList.add(new Property("owner", "Reference(Organization)", "Indicates the organization, department, etc. with responsibility for the account.", 0, java.lang.Integer.MAX_VALUE, owner));
634        childrenList.add(new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, java.lang.Integer.MAX_VALUE, description));
635      }
636
637      @Override
638      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
639        switch (hash) {
640        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
641        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
642        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
643        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AccountStatus>
644        case 1325532263: /*activePeriod*/ return this.activePeriod == null ? new Base[0] : new Base[] {this.activePeriod}; // Period
645        case 575402001: /*currency*/ return this.currency == null ? new Base[0] : new Base[] {this.currency}; // Coding
646        case -339185956: /*balance*/ return this.balance == null ? new Base[0] : new Base[] {this.balance}; // Money
647        case 1024117193: /*coveragePeriod*/ return this.coveragePeriod == null ? new Base[0] : new Base[] {this.coveragePeriod}; // Period
648        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
649        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
650        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
651        default: return super.getProperty(hash, name, checkValid);
652        }
653
654      }
655
656      @Override
657      public void setProperty(int hash, String name, Base value) throws FHIRException {
658        switch (hash) {
659        case -1618432855: // identifier
660          this.getIdentifier().add(castToIdentifier(value)); // Identifier
661          break;
662        case 3373707: // name
663          this.name = castToString(value); // StringType
664          break;
665        case 3575610: // type
666          this.type = castToCodeableConcept(value); // CodeableConcept
667          break;
668        case -892481550: // status
669          this.status = new AccountStatusEnumFactory().fromType(value); // Enumeration<AccountStatus>
670          break;
671        case 1325532263: // activePeriod
672          this.activePeriod = castToPeriod(value); // Period
673          break;
674        case 575402001: // currency
675          this.currency = castToCoding(value); // Coding
676          break;
677        case -339185956: // balance
678          this.balance = castToMoney(value); // Money
679          break;
680        case 1024117193: // coveragePeriod
681          this.coveragePeriod = castToPeriod(value); // Period
682          break;
683        case -1867885268: // subject
684          this.subject = castToReference(value); // Reference
685          break;
686        case 106164915: // owner
687          this.owner = castToReference(value); // Reference
688          break;
689        case -1724546052: // description
690          this.description = castToString(value); // StringType
691          break;
692        default: super.setProperty(hash, name, value);
693        }
694
695      }
696
697      @Override
698      public void setProperty(String name, Base value) throws FHIRException {
699        if (name.equals("identifier"))
700          this.getIdentifier().add(castToIdentifier(value));
701        else if (name.equals("name"))
702          this.name = castToString(value); // StringType
703        else if (name.equals("type"))
704          this.type = castToCodeableConcept(value); // CodeableConcept
705        else if (name.equals("status"))
706          this.status = new AccountStatusEnumFactory().fromType(value); // Enumeration<AccountStatus>
707        else if (name.equals("activePeriod"))
708          this.activePeriod = castToPeriod(value); // Period
709        else if (name.equals("currency"))
710          this.currency = castToCoding(value); // Coding
711        else if (name.equals("balance"))
712          this.balance = castToMoney(value); // Money
713        else if (name.equals("coveragePeriod"))
714          this.coveragePeriod = castToPeriod(value); // Period
715        else if (name.equals("subject"))
716          this.subject = castToReference(value); // Reference
717        else if (name.equals("owner"))
718          this.owner = castToReference(value); // Reference
719        else if (name.equals("description"))
720          this.description = castToString(value); // StringType
721        else
722          super.setProperty(name, value);
723      }
724
725      @Override
726      public Base makeProperty(int hash, String name) throws FHIRException {
727        switch (hash) {
728        case -1618432855:  return addIdentifier(); // Identifier
729        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
730        case 3575610:  return getType(); // CodeableConcept
731        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<AccountStatus>
732        case 1325532263:  return getActivePeriod(); // Period
733        case 575402001:  return getCurrency(); // Coding
734        case -339185956:  return getBalance(); // Money
735        case 1024117193:  return getCoveragePeriod(); // Period
736        case -1867885268:  return getSubject(); // Reference
737        case 106164915:  return getOwner(); // Reference
738        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
739        default: return super.makeProperty(hash, name);
740        }
741
742      }
743
744      @Override
745      public Base addChild(String name) throws FHIRException {
746        if (name.equals("identifier")) {
747          return addIdentifier();
748        }
749        else if (name.equals("name")) {
750          throw new FHIRException("Cannot call addChild on a primitive type Account.name");
751        }
752        else if (name.equals("type")) {
753          this.type = new CodeableConcept();
754          return this.type;
755        }
756        else if (name.equals("status")) {
757          throw new FHIRException("Cannot call addChild on a primitive type Account.status");
758        }
759        else if (name.equals("activePeriod")) {
760          this.activePeriod = new Period();
761          return this.activePeriod;
762        }
763        else if (name.equals("currency")) {
764          this.currency = new Coding();
765          return this.currency;
766        }
767        else if (name.equals("balance")) {
768          this.balance = new Money();
769          return this.balance;
770        }
771        else if (name.equals("coveragePeriod")) {
772          this.coveragePeriod = new Period();
773          return this.coveragePeriod;
774        }
775        else if (name.equals("subject")) {
776          this.subject = new Reference();
777          return this.subject;
778        }
779        else if (name.equals("owner")) {
780          this.owner = new Reference();
781          return this.owner;
782        }
783        else if (name.equals("description")) {
784          throw new FHIRException("Cannot call addChild on a primitive type Account.description");
785        }
786        else
787          return super.addChild(name);
788      }
789
790  public String fhirType() {
791    return "Account";
792
793  }
794
795      public Account copy() {
796        Account dst = new Account();
797        copyValues(dst);
798        if (identifier != null) {
799          dst.identifier = new ArrayList<Identifier>();
800          for (Identifier i : identifier)
801            dst.identifier.add(i.copy());
802        };
803        dst.name = name == null ? null : name.copy();
804        dst.type = type == null ? null : type.copy();
805        dst.status = status == null ? null : status.copy();
806        dst.activePeriod = activePeriod == null ? null : activePeriod.copy();
807        dst.currency = currency == null ? null : currency.copy();
808        dst.balance = balance == null ? null : balance.copy();
809        dst.coveragePeriod = coveragePeriod == null ? null : coveragePeriod.copy();
810        dst.subject = subject == null ? null : subject.copy();
811        dst.owner = owner == null ? null : owner.copy();
812        dst.description = description == null ? null : description.copy();
813        return dst;
814      }
815
816      protected Account typedCopy() {
817        return copy();
818      }
819
820      @Override
821      public boolean equalsDeep(Base other) {
822        if (!super.equalsDeep(other))
823          return false;
824        if (!(other instanceof Account))
825          return false;
826        Account o = (Account) other;
827        return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(type, o.type, true)
828           && compareDeep(status, o.status, true) && compareDeep(activePeriod, o.activePeriod, true) && compareDeep(currency, o.currency, true)
829           && compareDeep(balance, o.balance, true) && compareDeep(coveragePeriod, o.coveragePeriod, true)
830           && compareDeep(subject, o.subject, true) && compareDeep(owner, o.owner, true) && compareDeep(description, o.description, true)
831          ;
832      }
833
834      @Override
835      public boolean equalsShallow(Base other) {
836        if (!super.equalsShallow(other))
837          return false;
838        if (!(other instanceof Account))
839          return false;
840        Account o = (Account) other;
841        return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(description, o.description, true)
842          ;
843      }
844
845      public boolean isEmpty() {
846        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (name == null || name.isEmpty())
847           && (type == null || type.isEmpty()) && (status == null || status.isEmpty()) && (activePeriod == null || activePeriod.isEmpty())
848           && (currency == null || currency.isEmpty()) && (balance == null || balance.isEmpty()) && (coveragePeriod == null || coveragePeriod.isEmpty())
849           && (subject == null || subject.isEmpty()) && (owner == null || owner.isEmpty()) && (description == null || description.isEmpty())
850          ;
851      }
852
853  @Override
854  public ResourceType getResourceType() {
855    return ResourceType.Account;
856   }
857
858 /**
859   * Search parameter: <b>balance</b>
860   * <p>
861   * Description: <b>How much is in account?</b><br>
862   * Type: <b>quantity</b><br>
863   * Path: <b>Account.balance</b><br>
864   * </p>
865   */
866  @SearchParamDefinition(name="balance", path="Account.balance", description="How much is in account?", type="quantity" )
867  public static final String SP_BALANCE = "balance";
868 /**
869   * <b>Fluent Client</b> search parameter constant for <b>balance</b>
870   * <p>
871   * Description: <b>How much is in account?</b><br>
872   * Type: <b>quantity</b><br>
873   * Path: <b>Account.balance</b><br>
874   * </p>
875   */
876  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam BALANCE = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_BALANCE);
877
878 /**
879   * Search parameter: <b>patient</b>
880   * <p>
881   * Description: <b>What is account tied to?</b><br>
882   * Type: <b>reference</b><br>
883   * Path: <b>Account.subject</b><br>
884   * </p>
885   */
886  @SearchParamDefinition(name="patient", path="Account.subject", description="What is account tied to?", type="reference" )
887  public static final String SP_PATIENT = "patient";
888 /**
889   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
890   * <p>
891   * Description: <b>What is account tied to?</b><br>
892   * Type: <b>reference</b><br>
893   * Path: <b>Account.subject</b><br>
894   * </p>
895   */
896  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
897
898/**
899   * Constant for fluent queries to be used to add include statements. Specifies
900   * the path value of "<b>Account:patient</b>".
901   */
902  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Account:patient").toLocked();
903
904 /**
905   * Search parameter: <b>status</b>
906   * <p>
907   * Description: <b>active | inactive</b><br>
908   * Type: <b>token</b><br>
909   * Path: <b>Account.status</b><br>
910   * </p>
911   */
912  @SearchParamDefinition(name="status", path="Account.status", description="active | inactive", type="token" )
913  public static final String SP_STATUS = "status";
914 /**
915   * <b>Fluent Client</b> search parameter constant for <b>status</b>
916   * <p>
917   * Description: <b>active | inactive</b><br>
918   * Type: <b>token</b><br>
919   * Path: <b>Account.status</b><br>
920   * </p>
921   */
922  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
923
924 /**
925   * Search parameter: <b>subject</b>
926   * <p>
927   * Description: <b>What is account tied to?</b><br>
928   * Type: <b>reference</b><br>
929   * Path: <b>Account.subject</b><br>
930   * </p>
931   */
932  @SearchParamDefinition(name="subject", path="Account.subject", description="What is account tied to?", type="reference" )
933  public static final String SP_SUBJECT = "subject";
934 /**
935   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
936   * <p>
937   * Description: <b>What is account tied to?</b><br>
938   * Type: <b>reference</b><br>
939   * Path: <b>Account.subject</b><br>
940   * </p>
941   */
942  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
943
944/**
945   * Constant for fluent queries to be used to add include statements. Specifies
946   * the path value of "<b>Account:subject</b>".
947   */
948  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Account:subject").toLocked();
949
950 /**
951   * Search parameter: <b>name</b>
952   * <p>
953   * Description: <b>Human-readable label</b><br>
954   * Type: <b>string</b><br>
955   * Path: <b>Account.name</b><br>
956   * </p>
957   */
958  @SearchParamDefinition(name="name", path="Account.name", description="Human-readable label", type="string" )
959  public static final String SP_NAME = "name";
960 /**
961   * <b>Fluent Client</b> search parameter constant for <b>name</b>
962   * <p>
963   * Description: <b>Human-readable label</b><br>
964   * Type: <b>string</b><br>
965   * Path: <b>Account.name</b><br>
966   * </p>
967   */
968  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
969
970 /**
971   * Search parameter: <b>owner</b>
972   * <p>
973   * Description: <b>Who is responsible?</b><br>
974   * Type: <b>reference</b><br>
975   * Path: <b>Account.owner</b><br>
976   * </p>
977   */
978  @SearchParamDefinition(name="owner", path="Account.owner", description="Who is responsible?", type="reference" )
979  public static final String SP_OWNER = "owner";
980 /**
981   * <b>Fluent Client</b> search parameter constant for <b>owner</b>
982   * <p>
983   * Description: <b>Who is responsible?</b><br>
984   * Type: <b>reference</b><br>
985   * Path: <b>Account.owner</b><br>
986   * </p>
987   */
988  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
989
990/**
991   * Constant for fluent queries to be used to add include statements. Specifies
992   * the path value of "<b>Account:owner</b>".
993   */
994  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Account:owner").toLocked();
995
996 /**
997   * Search parameter: <b>period</b>
998   * <p>
999   * Description: <b>Transaction window</b><br>
1000   * Type: <b>date</b><br>
1001   * Path: <b>Account.coveragePeriod</b><br>
1002   * </p>
1003   */
1004  @SearchParamDefinition(name="period", path="Account.coveragePeriod", description="Transaction window", type="date" )
1005  public static final String SP_PERIOD = "period";
1006 /**
1007   * <b>Fluent Client</b> search parameter constant for <b>period</b>
1008   * <p>
1009   * Description: <b>Transaction window</b><br>
1010   * Type: <b>date</b><br>
1011   * Path: <b>Account.coveragePeriod</b><br>
1012   * </p>
1013   */
1014  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
1015
1016 /**
1017   * Search parameter: <b>type</b>
1018   * <p>
1019   * Description: <b>E.g. patient, expense, depreciation</b><br>
1020   * Type: <b>token</b><br>
1021   * Path: <b>Account.type</b><br>
1022   * </p>
1023   */
1024  @SearchParamDefinition(name="type", path="Account.type", description="E.g. patient, expense, depreciation", type="token" )
1025  public static final String SP_TYPE = "type";
1026 /**
1027   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1028   * <p>
1029   * Description: <b>E.g. patient, expense, depreciation</b><br>
1030   * Type: <b>token</b><br>
1031   * Path: <b>Account.type</b><br>
1032   * </p>
1033   */
1034  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1035
1036 /**
1037   * Search parameter: <b>identifier</b>
1038   * <p>
1039   * Description: <b>Account number</b><br>
1040   * Type: <b>token</b><br>
1041   * Path: <b>Account.identifier</b><br>
1042   * </p>
1043   */
1044  @SearchParamDefinition(name="identifier", path="Account.identifier", description="Account number", type="token" )
1045  public static final String SP_IDENTIFIER = "identifier";
1046 /**
1047   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1048   * <p>
1049   * Description: <b>Account number</b><br>
1050   * Type: <b>token</b><br>
1051   * Path: <b>Account.identifier</b><br>
1052   * </p>
1053   */
1054  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1055
1056
1057}
1058