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