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