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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import java.math.*;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.dstu3.model.Enumerations.*;
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.Block;
045import org.hl7.fhir.instance.model.api.*;
046import org.hl7.fhir.exceptions.FHIRException;
047import org.hl7.fhir.exceptions.FHIRFormatError;
048/**
049 * A formal agreement between parties regarding the conduct of business, exchange of information or other matters.
050 */
051@ResourceDef(name="Contract", profile="http://hl7.org/fhir/StructureDefinition/Contract")
052public class Contract extends DomainResource {
053
054    public enum ContractStatus {
055        /**
056         * Contract is augmented with additional information to correct errors in a predecessor or to updated values in a predecessor. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: revised; replaced.
057         */
058        AMENDED, 
059        /**
060         * Contract is augmented with additional information that was missing from a predecessor Contract. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: updated, replaced.
061         */
062        APPENDED, 
063        /**
064         * Contract is terminated due to failure of the Grantor and/or the Grantee to fulfil one or more contract provisions. Usage: Abnormal contract termination. Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed; aborted.
065         */
066        CANCELLED, 
067        /**
068         * Contract is pended to rectify failure of the Grantor or the Grantee to fulfil contract provision(s). E.g., Grantee complaint about Grantor's failure to comply with contract provisions. Usage: Contract pended. Precedence Order = 7.Comparable FHIR and v.3 status codes: on hold; pended; suspended.
069         */
070        DISPUTED, 
071        /**
072         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
073         */
074        ENTEREDINERROR, 
075        /**
076         * Contract execution pending; may be executed when either the Grantor or the Grantee accepts the contract provisions by signing. I.e., where either the Grantor or the Grantee has signed, but not both. E.g., when an insurance applicant signs the insurers application, which references the policy. Usage: Optional first step of contract execution activity.  May be skipped and contracting activity moves directly to executed state. Precedence Order = 3. Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended; active.
077         */
078        EXECUTABLE, 
079        /**
080         * Contract is activated for period stipulated when both the Grantor and Grantee have signed it. Usage: Required state for normal completion of contracting activity.  Precedence Order = 6. Comparable FHIR and v.3 status codes: accepted; completed.
081         */
082        EXECUTED, 
083        /**
084         * Contract execution is suspended while either or both the Grantor and Grantee propose and consider new or revised contract provisions. I.e., where the party which has not signed proposes changes to the terms.  E .g., a life insurer declines to agree to the signed application because the life insurer has evidence that the applicant, who asserted to being younger or a non-smoker to get a lower premium rate - but offers instead to agree to a higher premium based on the applicants actual age or smoking status. Usage: Optional contract activity between executable and executed state. Precedence Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.
085         */
086        NEGOTIABLE, 
087        /**
088         * Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract hard copy or electronic 'template','form' or 'application'. E.g., health insurance application; consent directive form. Usage: Beginning of contract negotiation, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes: requested; new.
089         */
090        OFFERED, 
091        /**
092         * Contract template is available as the basis for an application or offer by the Grantor or Grantee. E.g., health insurance policy; consent directive policy.  Usage: Required initial contract activity, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 1. Comparable FHIR and v.3 status codes: proposed; intended.
093         */
094        POLICY, 
095        /**
096         *  Execution of the Contract is not completed because either or both the Grantor and Grantee decline to accept some or all of the contract provisions. Usage: Optional contract activity between executable and abnormal termination. Precedence Order = 5. Comparable FHIR and v.3 status codes:  stopped; cancelled.
097         */
098        REJECTED, 
099        /**
100         * Beginning of a successor Contract at the termination of predecessor Contract lifecycle. Usage: Follows termination of a preceding Contract that has reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3 status codes: superseded.
101         */
102        RENEWED, 
103        /**
104         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
105         */
106        REVOKED, 
107        /**
108         * Contract is reactivated after being pended because of faulty execution. *E.g., competency of the signer(s), or where the policy is substantially different from and did not accompany the application/form so that the applicant could not compare them. Aka - ''reactivated''. Usage: Optional stage where a pended contract is reactivated. Precedence Order = 8. Comparable FHIR and v.3 status codes: reactivated.
109         */
110        RESOLVED, 
111        /**
112         * Contract reaches its expiry date. It may or may not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.
113         */
114        TERMINATED, 
115        /**
116         * added to help the parsers with the generic types
117         */
118        NULL;
119        public static ContractStatus fromCode(String codeString) throws FHIRException {
120            if (codeString == null || "".equals(codeString))
121                return null;
122        if ("amended".equals(codeString))
123          return AMENDED;
124        if ("appended".equals(codeString))
125          return APPENDED;
126        if ("cancelled".equals(codeString))
127          return CANCELLED;
128        if ("disputed".equals(codeString))
129          return DISPUTED;
130        if ("entered-in-error".equals(codeString))
131          return ENTEREDINERROR;
132        if ("executable".equals(codeString))
133          return EXECUTABLE;
134        if ("executed".equals(codeString))
135          return EXECUTED;
136        if ("negotiable".equals(codeString))
137          return NEGOTIABLE;
138        if ("offered".equals(codeString))
139          return OFFERED;
140        if ("policy".equals(codeString))
141          return POLICY;
142        if ("rejected".equals(codeString))
143          return REJECTED;
144        if ("renewed".equals(codeString))
145          return RENEWED;
146        if ("revoked".equals(codeString))
147          return REVOKED;
148        if ("resolved".equals(codeString))
149          return RESOLVED;
150        if ("terminated".equals(codeString))
151          return TERMINATED;
152        if (Configuration.isAcceptInvalidEnums())
153          return null;
154        else
155          throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
156        }
157        public String toCode() {
158          switch (this) {
159            case AMENDED: return "amended";
160            case APPENDED: return "appended";
161            case CANCELLED: return "cancelled";
162            case DISPUTED: return "disputed";
163            case ENTEREDINERROR: return "entered-in-error";
164            case EXECUTABLE: return "executable";
165            case EXECUTED: return "executed";
166            case NEGOTIABLE: return "negotiable";
167            case OFFERED: return "offered";
168            case POLICY: return "policy";
169            case REJECTED: return "rejected";
170            case RENEWED: return "renewed";
171            case REVOKED: return "revoked";
172            case RESOLVED: return "resolved";
173            case TERMINATED: return "terminated";
174            default: return "?";
175          }
176        }
177        public String getSystem() {
178          switch (this) {
179            case AMENDED: return "http://hl7.org/fhir/contract-status";
180            case APPENDED: return "http://hl7.org/fhir/contract-status";
181            case CANCELLED: return "http://hl7.org/fhir/contract-status";
182            case DISPUTED: return "http://hl7.org/fhir/contract-status";
183            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-status";
184            case EXECUTABLE: return "http://hl7.org/fhir/contract-status";
185            case EXECUTED: return "http://hl7.org/fhir/contract-status";
186            case NEGOTIABLE: return "http://hl7.org/fhir/contract-status";
187            case OFFERED: return "http://hl7.org/fhir/contract-status";
188            case POLICY: return "http://hl7.org/fhir/contract-status";
189            case REJECTED: return "http://hl7.org/fhir/contract-status";
190            case RENEWED: return "http://hl7.org/fhir/contract-status";
191            case REVOKED: return "http://hl7.org/fhir/contract-status";
192            case RESOLVED: return "http://hl7.org/fhir/contract-status";
193            case TERMINATED: return "http://hl7.org/fhir/contract-status";
194            default: return "?";
195          }
196        }
197        public String getDefinition() {
198          switch (this) {
199            case AMENDED: return "Contract is augmented with additional information to correct errors in a predecessor or to updated values in a predecessor. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: revised; replaced.";
200            case APPENDED: return "Contract is augmented with additional information that was missing from a predecessor Contract. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: updated, replaced.";
201            case CANCELLED: return "Contract is terminated due to failure of the Grantor and/or the Grantee to fulfil one or more contract provisions. Usage: Abnormal contract termination. Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed; aborted.";
202            case DISPUTED: return "Contract is pended to rectify failure of the Grantor or the Grantee to fulfil contract provision(s). E.g., Grantee complaint about Grantor's failure to comply with contract provisions. Usage: Contract pended. Precedence Order = 7.Comparable FHIR and v.3 status codes: on hold; pended; suspended.";
203            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
204            case EXECUTABLE: return "Contract execution pending; may be executed when either the Grantor or the Grantee accepts the contract provisions by signing. I.e., where either the Grantor or the Grantee has signed, but not both. E.g., when an insurance applicant signs the insurers application, which references the policy. Usage: Optional first step of contract execution activity.  May be skipped and contracting activity moves directly to executed state. Precedence Order = 3. Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended; active.";
205            case EXECUTED: return "Contract is activated for period stipulated when both the Grantor and Grantee have signed it. Usage: Required state for normal completion of contracting activity.  Precedence Order = 6. Comparable FHIR and v.3 status codes: accepted; completed.";
206            case NEGOTIABLE: return "Contract execution is suspended while either or both the Grantor and Grantee propose and consider new or revised contract provisions. I.e., where the party which has not signed proposes changes to the terms.  E .g., a life insurer declines to agree to the signed application because the life insurer has evidence that the applicant, who asserted to being younger or a non-smoker to get a lower premium rate - but offers instead to agree to a higher premium based on the applicants actual age or smoking status. Usage: Optional contract activity between executable and executed state. Precedence Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.";
207            case OFFERED: return "Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract hard copy or electronic 'template','form' or 'application'. E.g., health insurance application; consent directive form. Usage: Beginning of contract negotiation, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes: requested; new.";
208            case POLICY: return "Contract template is available as the basis for an application or offer by the Grantor or Grantee. E.g., health insurance policy; consent directive policy.  Usage: Required initial contract activity, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 1. Comparable FHIR and v.3 status codes: proposed; intended.";
209            case REJECTED: return " Execution of the Contract is not completed because either or both the Grantor and Grantee decline to accept some or all of the contract provisions. Usage: Optional contract activity between executable and abnormal termination. Precedence Order = 5. Comparable FHIR and v.3 status codes:  stopped; cancelled.";
210            case RENEWED: return "Beginning of a successor Contract at the termination of predecessor Contract lifecycle. Usage: Follows termination of a preceding Contract that has reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3 status codes: superseded.";
211            case REVOKED: return "A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.";
212            case RESOLVED: return "Contract is reactivated after being pended because of faulty execution. *E.g., competency of the signer(s), or where the policy is substantially different from and did not accompany the application/form so that the applicant could not compare them. Aka - ''reactivated''. Usage: Optional stage where a pended contract is reactivated. Precedence Order = 8. Comparable FHIR and v.3 status codes: reactivated.";
213            case TERMINATED: return "Contract reaches its expiry date. It may or may not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.";
214            default: return "?";
215          }
216        }
217        public String getDisplay() {
218          switch (this) {
219            case AMENDED: return "Amended";
220            case APPENDED: return "Appended";
221            case CANCELLED: return "Cancelled";
222            case DISPUTED: return "Disputed";
223            case ENTEREDINERROR: return "Entered in Error";
224            case EXECUTABLE: return "Executable";
225            case EXECUTED: return "Executed";
226            case NEGOTIABLE: return "Negotiable";
227            case OFFERED: return "Offered";
228            case POLICY: return "Policy";
229            case REJECTED: return "Rejected";
230            case RENEWED: return "Renewed";
231            case REVOKED: return "Revoked";
232            case RESOLVED: return "Resolved";
233            case TERMINATED: return "Terminated";
234            default: return "?";
235          }
236        }
237    }
238
239  public static class ContractStatusEnumFactory implements EnumFactory<ContractStatus> {
240    public ContractStatus fromCode(String codeString) throws IllegalArgumentException {
241      if (codeString == null || "".equals(codeString))
242            if (codeString == null || "".equals(codeString))
243                return null;
244        if ("amended".equals(codeString))
245          return ContractStatus.AMENDED;
246        if ("appended".equals(codeString))
247          return ContractStatus.APPENDED;
248        if ("cancelled".equals(codeString))
249          return ContractStatus.CANCELLED;
250        if ("disputed".equals(codeString))
251          return ContractStatus.DISPUTED;
252        if ("entered-in-error".equals(codeString))
253          return ContractStatus.ENTEREDINERROR;
254        if ("executable".equals(codeString))
255          return ContractStatus.EXECUTABLE;
256        if ("executed".equals(codeString))
257          return ContractStatus.EXECUTED;
258        if ("negotiable".equals(codeString))
259          return ContractStatus.NEGOTIABLE;
260        if ("offered".equals(codeString))
261          return ContractStatus.OFFERED;
262        if ("policy".equals(codeString))
263          return ContractStatus.POLICY;
264        if ("rejected".equals(codeString))
265          return ContractStatus.REJECTED;
266        if ("renewed".equals(codeString))
267          return ContractStatus.RENEWED;
268        if ("revoked".equals(codeString))
269          return ContractStatus.REVOKED;
270        if ("resolved".equals(codeString))
271          return ContractStatus.RESOLVED;
272        if ("terminated".equals(codeString))
273          return ContractStatus.TERMINATED;
274        throw new IllegalArgumentException("Unknown ContractStatus code '"+codeString+"'");
275        }
276        public Enumeration<ContractStatus> fromType(Base code) throws FHIRException {
277          if (code == null)
278            return null;
279          if (code.isEmpty())
280            return new Enumeration<ContractStatus>(this);
281          String codeString = ((PrimitiveType) code).asStringValue();
282          if (codeString == null || "".equals(codeString))
283            return null;
284        if ("amended".equals(codeString))
285          return new Enumeration<ContractStatus>(this, ContractStatus.AMENDED);
286        if ("appended".equals(codeString))
287          return new Enumeration<ContractStatus>(this, ContractStatus.APPENDED);
288        if ("cancelled".equals(codeString))
289          return new Enumeration<ContractStatus>(this, ContractStatus.CANCELLED);
290        if ("disputed".equals(codeString))
291          return new Enumeration<ContractStatus>(this, ContractStatus.DISPUTED);
292        if ("entered-in-error".equals(codeString))
293          return new Enumeration<ContractStatus>(this, ContractStatus.ENTEREDINERROR);
294        if ("executable".equals(codeString))
295          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTABLE);
296        if ("executed".equals(codeString))
297          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTED);
298        if ("negotiable".equals(codeString))
299          return new Enumeration<ContractStatus>(this, ContractStatus.NEGOTIABLE);
300        if ("offered".equals(codeString))
301          return new Enumeration<ContractStatus>(this, ContractStatus.OFFERED);
302        if ("policy".equals(codeString))
303          return new Enumeration<ContractStatus>(this, ContractStatus.POLICY);
304        if ("rejected".equals(codeString))
305          return new Enumeration<ContractStatus>(this, ContractStatus.REJECTED);
306        if ("renewed".equals(codeString))
307          return new Enumeration<ContractStatus>(this, ContractStatus.RENEWED);
308        if ("revoked".equals(codeString))
309          return new Enumeration<ContractStatus>(this, ContractStatus.REVOKED);
310        if ("resolved".equals(codeString))
311          return new Enumeration<ContractStatus>(this, ContractStatus.RESOLVED);
312        if ("terminated".equals(codeString))
313          return new Enumeration<ContractStatus>(this, ContractStatus.TERMINATED);
314        throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
315        }
316    public String toCode(ContractStatus code) {
317      if (code == ContractStatus.AMENDED)
318        return "amended";
319      if (code == ContractStatus.APPENDED)
320        return "appended";
321      if (code == ContractStatus.CANCELLED)
322        return "cancelled";
323      if (code == ContractStatus.DISPUTED)
324        return "disputed";
325      if (code == ContractStatus.ENTEREDINERROR)
326        return "entered-in-error";
327      if (code == ContractStatus.EXECUTABLE)
328        return "executable";
329      if (code == ContractStatus.EXECUTED)
330        return "executed";
331      if (code == ContractStatus.NEGOTIABLE)
332        return "negotiable";
333      if (code == ContractStatus.OFFERED)
334        return "offered";
335      if (code == ContractStatus.POLICY)
336        return "policy";
337      if (code == ContractStatus.REJECTED)
338        return "rejected";
339      if (code == ContractStatus.RENEWED)
340        return "renewed";
341      if (code == ContractStatus.REVOKED)
342        return "revoked";
343      if (code == ContractStatus.RESOLVED)
344        return "resolved";
345      if (code == ContractStatus.TERMINATED)
346        return "terminated";
347      return "?";
348      }
349    public String toSystem(ContractStatus code) {
350      return code.getSystem();
351      }
352    }
353
354    @Block()
355    public static class AgentComponent extends BackboneElement implements IBaseBackboneElement {
356        /**
357         * Who or what parties are assigned roles in this Contract.
358         */
359        @Child(name = "actor", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false)
360        @Description(shortDefinition="Contract Agent Type", formalDefinition="Who or what parties are assigned roles in this Contract." )
361        protected Reference actor;
362
363        /**
364         * The actual object that is the target of the reference (Who or what parties are assigned roles in this Contract.)
365         */
366        protected Resource actorTarget;
367
368        /**
369         * Role type of agent assigned roles in this Contract.
370         */
371        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
372        @Description(shortDefinition="Role type of the agent", formalDefinition="Role type of agent assigned roles in this Contract." )
373        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
374        protected List<CodeableConcept> role;
375
376        private static final long serialVersionUID = -454551165L;
377
378    /**
379     * Constructor
380     */
381      public AgentComponent() {
382        super();
383      }
384
385    /**
386     * Constructor
387     */
388      public AgentComponent(Reference actor) {
389        super();
390        this.actor = actor;
391      }
392
393        /**
394         * @return {@link #actor} (Who or what parties are assigned roles in this Contract.)
395         */
396        public Reference getActor() { 
397          if (this.actor == null)
398            if (Configuration.errorOnAutoCreate())
399              throw new Error("Attempt to auto-create AgentComponent.actor");
400            else if (Configuration.doAutoCreate())
401              this.actor = new Reference(); // cc
402          return this.actor;
403        }
404
405        public boolean hasActor() { 
406          return this.actor != null && !this.actor.isEmpty();
407        }
408
409        /**
410         * @param value {@link #actor} (Who or what parties are assigned roles in this Contract.)
411         */
412        public AgentComponent setActor(Reference value)  { 
413          this.actor = value;
414          return this;
415        }
416
417        /**
418         * @return {@link #actor} 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. (Who or what parties are assigned roles in this Contract.)
419         */
420        public Resource getActorTarget() { 
421          return this.actorTarget;
422        }
423
424        /**
425         * @param value {@link #actor} 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. (Who or what parties are assigned roles in this Contract.)
426         */
427        public AgentComponent setActorTarget(Resource value) { 
428          this.actorTarget = value;
429          return this;
430        }
431
432        /**
433         * @return {@link #role} (Role type of agent assigned roles in this Contract.)
434         */
435        public List<CodeableConcept> getRole() { 
436          if (this.role == null)
437            this.role = new ArrayList<CodeableConcept>();
438          return this.role;
439        }
440
441        /**
442         * @return Returns a reference to <code>this</code> for easy method chaining
443         */
444        public AgentComponent setRole(List<CodeableConcept> theRole) { 
445          this.role = theRole;
446          return this;
447        }
448
449        public boolean hasRole() { 
450          if (this.role == null)
451            return false;
452          for (CodeableConcept item : this.role)
453            if (!item.isEmpty())
454              return true;
455          return false;
456        }
457
458        public CodeableConcept addRole() { //3
459          CodeableConcept t = new CodeableConcept();
460          if (this.role == null)
461            this.role = new ArrayList<CodeableConcept>();
462          this.role.add(t);
463          return t;
464        }
465
466        public AgentComponent addRole(CodeableConcept t) { //3
467          if (t == null)
468            return this;
469          if (this.role == null)
470            this.role = new ArrayList<CodeableConcept>();
471          this.role.add(t);
472          return this;
473        }
474
475        /**
476         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist
477         */
478        public CodeableConcept getRoleFirstRep() { 
479          if (getRole().isEmpty()) {
480            addRole();
481          }
482          return getRole().get(0);
483        }
484
485        protected void listChildren(List<Property> children) {
486          super.listChildren(children);
487          children.add(new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "Who or what parties are assigned roles in this Contract.", 0, 1, actor));
488          children.add(new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, role));
489        }
490
491        @Override
492        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
493          switch (_hash) {
494          case 92645877: /*actor*/  return new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "Who or what parties are assigned roles in this Contract.", 0, 1, actor);
495          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, role);
496          default: return super.getNamedProperty(_hash, _name, _checkValid);
497          }
498
499        }
500
501      @Override
502      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
503        switch (hash) {
504        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
505        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
506        default: return super.getProperty(hash, name, checkValid);
507        }
508
509      }
510
511      @Override
512      public Base setProperty(int hash, String name, Base value) throws FHIRException {
513        switch (hash) {
514        case 92645877: // actor
515          this.actor = castToReference(value); // Reference
516          return value;
517        case 3506294: // role
518          this.getRole().add(castToCodeableConcept(value)); // CodeableConcept
519          return value;
520        default: return super.setProperty(hash, name, value);
521        }
522
523      }
524
525      @Override
526      public Base setProperty(String name, Base value) throws FHIRException {
527        if (name.equals("actor")) {
528          this.actor = castToReference(value); // Reference
529        } else if (name.equals("role")) {
530          this.getRole().add(castToCodeableConcept(value));
531        } else
532          return super.setProperty(name, value);
533        return value;
534      }
535
536      @Override
537      public Base makeProperty(int hash, String name) throws FHIRException {
538        switch (hash) {
539        case 92645877:  return getActor(); 
540        case 3506294:  return addRole(); 
541        default: return super.makeProperty(hash, name);
542        }
543
544      }
545
546      @Override
547      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
548        switch (hash) {
549        case 92645877: /*actor*/ return new String[] {"Reference"};
550        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
551        default: return super.getTypesForProperty(hash, name);
552        }
553
554      }
555
556      @Override
557      public Base addChild(String name) throws FHIRException {
558        if (name.equals("actor")) {
559          this.actor = new Reference();
560          return this.actor;
561        }
562        else if (name.equals("role")) {
563          return addRole();
564        }
565        else
566          return super.addChild(name);
567      }
568
569      public AgentComponent copy() {
570        AgentComponent dst = new AgentComponent();
571        copyValues(dst);
572        dst.actor = actor == null ? null : actor.copy();
573        if (role != null) {
574          dst.role = new ArrayList<CodeableConcept>();
575          for (CodeableConcept i : role)
576            dst.role.add(i.copy());
577        };
578        return dst;
579      }
580
581      @Override
582      public boolean equalsDeep(Base other_) {
583        if (!super.equalsDeep(other_))
584          return false;
585        if (!(other_ instanceof AgentComponent))
586          return false;
587        AgentComponent o = (AgentComponent) other_;
588        return compareDeep(actor, o.actor, true) && compareDeep(role, o.role, true);
589      }
590
591      @Override
592      public boolean equalsShallow(Base other_) {
593        if (!super.equalsShallow(other_))
594          return false;
595        if (!(other_ instanceof AgentComponent))
596          return false;
597        AgentComponent o = (AgentComponent) other_;
598        return true;
599      }
600
601      public boolean isEmpty() {
602        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actor, role);
603      }
604
605  public String fhirType() {
606    return "Contract.agent";
607
608  }
609
610  }
611
612    @Block()
613    public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
614        /**
615         * Role of this Contract signer, e.g. notary, grantee.
616         */
617        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
618        @Description(shortDefinition="Contract Signatory Role", formalDefinition="Role of this Contract signer, e.g. notary, grantee." )
619        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-signer-type")
620        protected Coding type;
621
622        /**
623         * Party which is a signator to this Contract.
624         */
625        @Child(name = "party", type = {Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
626        @Description(shortDefinition="Contract Signatory Party", formalDefinition="Party which is a signator to this Contract." )
627        protected Reference party;
628
629        /**
630         * The actual object that is the target of the reference (Party which is a signator to this Contract.)
631         */
632        protected Resource partyTarget;
633
634        /**
635         * Legally binding Contract DSIG signature contents in Base64.
636         */
637        @Child(name = "signature", type = {Signature.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
638        @Description(shortDefinition="Contract Documentation Signature", formalDefinition="Legally binding Contract DSIG signature contents in Base64." )
639        protected List<Signature> signature;
640
641        private static final long serialVersionUID = 1948139228L;
642
643    /**
644     * Constructor
645     */
646      public SignatoryComponent() {
647        super();
648      }
649
650    /**
651     * Constructor
652     */
653      public SignatoryComponent(Coding type, Reference party) {
654        super();
655        this.type = type;
656        this.party = party;
657      }
658
659        /**
660         * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
661         */
662        public Coding getType() { 
663          if (this.type == null)
664            if (Configuration.errorOnAutoCreate())
665              throw new Error("Attempt to auto-create SignatoryComponent.type");
666            else if (Configuration.doAutoCreate())
667              this.type = new Coding(); // cc
668          return this.type;
669        }
670
671        public boolean hasType() { 
672          return this.type != null && !this.type.isEmpty();
673        }
674
675        /**
676         * @param value {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
677         */
678        public SignatoryComponent setType(Coding value)  { 
679          this.type = value;
680          return this;
681        }
682
683        /**
684         * @return {@link #party} (Party which is a signator to this Contract.)
685         */
686        public Reference getParty() { 
687          if (this.party == null)
688            if (Configuration.errorOnAutoCreate())
689              throw new Error("Attempt to auto-create SignatoryComponent.party");
690            else if (Configuration.doAutoCreate())
691              this.party = new Reference(); // cc
692          return this.party;
693        }
694
695        public boolean hasParty() { 
696          return this.party != null && !this.party.isEmpty();
697        }
698
699        /**
700         * @param value {@link #party} (Party which is a signator to this Contract.)
701         */
702        public SignatoryComponent setParty(Reference value)  { 
703          this.party = value;
704          return this;
705        }
706
707        /**
708         * @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. (Party which is a signator to this Contract.)
709         */
710        public Resource getPartyTarget() { 
711          return this.partyTarget;
712        }
713
714        /**
715         * @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. (Party which is a signator to this Contract.)
716         */
717        public SignatoryComponent setPartyTarget(Resource value) { 
718          this.partyTarget = value;
719          return this;
720        }
721
722        /**
723         * @return {@link #signature} (Legally binding Contract DSIG signature contents in Base64.)
724         */
725        public List<Signature> getSignature() { 
726          if (this.signature == null)
727            this.signature = new ArrayList<Signature>();
728          return this.signature;
729        }
730
731        /**
732         * @return Returns a reference to <code>this</code> for easy method chaining
733         */
734        public SignatoryComponent setSignature(List<Signature> theSignature) { 
735          this.signature = theSignature;
736          return this;
737        }
738
739        public boolean hasSignature() { 
740          if (this.signature == null)
741            return false;
742          for (Signature item : this.signature)
743            if (!item.isEmpty())
744              return true;
745          return false;
746        }
747
748        public Signature addSignature() { //3
749          Signature t = new Signature();
750          if (this.signature == null)
751            this.signature = new ArrayList<Signature>();
752          this.signature.add(t);
753          return t;
754        }
755
756        public SignatoryComponent addSignature(Signature t) { //3
757          if (t == null)
758            return this;
759          if (this.signature == null)
760            this.signature = new ArrayList<Signature>();
761          this.signature.add(t);
762          return this;
763        }
764
765        /**
766         * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist
767         */
768        public Signature getSignatureFirstRep() { 
769          if (getSignature().isEmpty()) {
770            addSignature();
771          }
772          return getSignature().get(0);
773        }
774
775        protected void listChildren(List<Property> children) {
776          super.listChildren(children);
777          children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
778          children.add(new Property("party", "Reference(Organization|Patient|Practitioner|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party));
779          children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature));
780        }
781
782        @Override
783        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
784          switch (_hash) {
785          case 3575610: /*type*/  return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type);
786          case 106437350: /*party*/  return new Property("party", "Reference(Organization|Patient|Practitioner|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party);
787          case 1073584312: /*signature*/  return new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
788          default: return super.getNamedProperty(_hash, _name, _checkValid);
789          }
790
791        }
792
793      @Override
794      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
795        switch (hash) {
796        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
797        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
798        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
799        default: return super.getProperty(hash, name, checkValid);
800        }
801
802      }
803
804      @Override
805      public Base setProperty(int hash, String name, Base value) throws FHIRException {
806        switch (hash) {
807        case 3575610: // type
808          this.type = castToCoding(value); // Coding
809          return value;
810        case 106437350: // party
811          this.party = castToReference(value); // Reference
812          return value;
813        case 1073584312: // signature
814          this.getSignature().add(castToSignature(value)); // Signature
815          return value;
816        default: return super.setProperty(hash, name, value);
817        }
818
819      }
820
821      @Override
822      public Base setProperty(String name, Base value) throws FHIRException {
823        if (name.equals("type")) {
824          this.type = castToCoding(value); // Coding
825        } else if (name.equals("party")) {
826          this.party = castToReference(value); // Reference
827        } else if (name.equals("signature")) {
828          this.getSignature().add(castToSignature(value));
829        } else
830          return super.setProperty(name, value);
831        return value;
832      }
833
834      @Override
835      public Base makeProperty(int hash, String name) throws FHIRException {
836        switch (hash) {
837        case 3575610:  return getType(); 
838        case 106437350:  return getParty(); 
839        case 1073584312:  return addSignature(); 
840        default: return super.makeProperty(hash, name);
841        }
842
843      }
844
845      @Override
846      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
847        switch (hash) {
848        case 3575610: /*type*/ return new String[] {"Coding"};
849        case 106437350: /*party*/ return new String[] {"Reference"};
850        case 1073584312: /*signature*/ return new String[] {"Signature"};
851        default: return super.getTypesForProperty(hash, name);
852        }
853
854      }
855
856      @Override
857      public Base addChild(String name) throws FHIRException {
858        if (name.equals("type")) {
859          this.type = new Coding();
860          return this.type;
861        }
862        else if (name.equals("party")) {
863          this.party = new Reference();
864          return this.party;
865        }
866        else if (name.equals("signature")) {
867          return addSignature();
868        }
869        else
870          return super.addChild(name);
871      }
872
873      public SignatoryComponent copy() {
874        SignatoryComponent dst = new SignatoryComponent();
875        copyValues(dst);
876        dst.type = type == null ? null : type.copy();
877        dst.party = party == null ? null : party.copy();
878        if (signature != null) {
879          dst.signature = new ArrayList<Signature>();
880          for (Signature i : signature)
881            dst.signature.add(i.copy());
882        };
883        return dst;
884      }
885
886      @Override
887      public boolean equalsDeep(Base other_) {
888        if (!super.equalsDeep(other_))
889          return false;
890        if (!(other_ instanceof SignatoryComponent))
891          return false;
892        SignatoryComponent o = (SignatoryComponent) other_;
893        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true) && compareDeep(signature, o.signature, true)
894          ;
895      }
896
897      @Override
898      public boolean equalsShallow(Base other_) {
899        if (!super.equalsShallow(other_))
900          return false;
901        if (!(other_ instanceof SignatoryComponent))
902          return false;
903        SignatoryComponent o = (SignatoryComponent) other_;
904        return true;
905      }
906
907      public boolean isEmpty() {
908        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
909      }
910
911  public String fhirType() {
912    return "Contract.signer";
913
914  }
915
916  }
917
918    @Block()
919    public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
920        /**
921         * Specific type of Contract Valued Item that may be priced.
922         */
923        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
924        @Description(shortDefinition="Contract Valued Item Type", formalDefinition="Specific type of Contract Valued Item that may be priced." )
925        protected Type entity;
926
927        /**
928         * Identifies a Contract Valued Item instance.
929         */
930        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
931        @Description(shortDefinition="Contract Valued Item Number", formalDefinition="Identifies a Contract Valued Item instance." )
932        protected Identifier identifier;
933
934        /**
935         * Indicates the time during which this Contract ValuedItem information is effective.
936         */
937        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
938        @Description(shortDefinition="Contract Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract ValuedItem information is effective." )
939        protected DateTimeType effectiveTime;
940
941        /**
942         * Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.
943         */
944        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
945        @Description(shortDefinition="Count of Contract Valued Items", formalDefinition="Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances." )
946        protected SimpleQuantity quantity;
947
948        /**
949         * A Contract Valued Item unit valuation measure.
950         */
951        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
952        @Description(shortDefinition="Contract Valued Item fee, charge, or cost", formalDefinition="A Contract Valued Item unit valuation measure." )
953        protected Money unitPrice;
954
955        /**
956         * A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
957         */
958        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
959        @Description(shortDefinition="Contract Valued Item Price Scaling Factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
960        protected DecimalType factor;
961
962        /**
963         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
964         */
965        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
966        @Description(shortDefinition="Contract Valued Item Difficulty Scaling Factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point." )
967        protected DecimalType points;
968
969        /**
970         * Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
971         */
972        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
973        @Description(shortDefinition="Total Contract Valued Item Value", formalDefinition="Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
974        protected Money net;
975
976        private static final long serialVersionUID = 1782449516L;
977
978    /**
979     * Constructor
980     */
981      public ValuedItemComponent() {
982        super();
983      }
984
985        /**
986         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
987         */
988        public Type getEntity() { 
989          return this.entity;
990        }
991
992        /**
993         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
994         */
995        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
996          if (this.entity == null)
997            return null;
998          if (!(this.entity instanceof CodeableConcept))
999            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
1000          return (CodeableConcept) this.entity;
1001        }
1002
1003        public boolean hasEntityCodeableConcept() { 
1004          return this != null && this.entity instanceof CodeableConcept;
1005        }
1006
1007        /**
1008         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
1009         */
1010        public Reference getEntityReference() throws FHIRException { 
1011          if (this.entity == null)
1012            return null;
1013          if (!(this.entity instanceof Reference))
1014            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
1015          return (Reference) this.entity;
1016        }
1017
1018        public boolean hasEntityReference() { 
1019          return this != null && this.entity instanceof Reference;
1020        }
1021
1022        public boolean hasEntity() { 
1023          return this.entity != null && !this.entity.isEmpty();
1024        }
1025
1026        /**
1027         * @param value {@link #entity} (Specific type of Contract Valued Item that may be priced.)
1028         */
1029        public ValuedItemComponent setEntity(Type value) throws FHIRFormatError { 
1030          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1031            throw new FHIRFormatError("Not the right type for Contract.valuedItem.entity[x]: "+value.fhirType());
1032          this.entity = value;
1033          return this;
1034        }
1035
1036        /**
1037         * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
1038         */
1039        public Identifier getIdentifier() { 
1040          if (this.identifier == null)
1041            if (Configuration.errorOnAutoCreate())
1042              throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
1043            else if (Configuration.doAutoCreate())
1044              this.identifier = new Identifier(); // cc
1045          return this.identifier;
1046        }
1047
1048        public boolean hasIdentifier() { 
1049          return this.identifier != null && !this.identifier.isEmpty();
1050        }
1051
1052        /**
1053         * @param value {@link #identifier} (Identifies a Contract Valued Item instance.)
1054         */
1055        public ValuedItemComponent setIdentifier(Identifier value)  { 
1056          this.identifier = value;
1057          return this;
1058        }
1059
1060        /**
1061         * @return {@link #effectiveTime} (Indicates the time during which this Contract ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
1062         */
1063        public DateTimeType getEffectiveTimeElement() { 
1064          if (this.effectiveTime == null)
1065            if (Configuration.errorOnAutoCreate())
1066              throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
1067            else if (Configuration.doAutoCreate())
1068              this.effectiveTime = new DateTimeType(); // bb
1069          return this.effectiveTime;
1070        }
1071
1072        public boolean hasEffectiveTimeElement() { 
1073          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
1074        }
1075
1076        public boolean hasEffectiveTime() { 
1077          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
1078        }
1079
1080        /**
1081         * @param value {@link #effectiveTime} (Indicates the time during which this Contract ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
1082         */
1083        public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
1084          this.effectiveTime = value;
1085          return this;
1086        }
1087
1088        /**
1089         * @return Indicates the time during which this Contract ValuedItem information is effective.
1090         */
1091        public Date getEffectiveTime() { 
1092          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
1093        }
1094
1095        /**
1096         * @param value Indicates the time during which this Contract ValuedItem information is effective.
1097         */
1098        public ValuedItemComponent setEffectiveTime(Date value) { 
1099          if (value == null)
1100            this.effectiveTime = null;
1101          else {
1102            if (this.effectiveTime == null)
1103              this.effectiveTime = new DateTimeType();
1104            this.effectiveTime.setValue(value);
1105          }
1106          return this;
1107        }
1108
1109        /**
1110         * @return {@link #quantity} (Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.)
1111         */
1112        public SimpleQuantity getQuantity() { 
1113          if (this.quantity == null)
1114            if (Configuration.errorOnAutoCreate())
1115              throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
1116            else if (Configuration.doAutoCreate())
1117              this.quantity = new SimpleQuantity(); // cc
1118          return this.quantity;
1119        }
1120
1121        public boolean hasQuantity() { 
1122          return this.quantity != null && !this.quantity.isEmpty();
1123        }
1124
1125        /**
1126         * @param value {@link #quantity} (Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.)
1127         */
1128        public ValuedItemComponent setQuantity(SimpleQuantity value)  { 
1129          this.quantity = value;
1130          return this;
1131        }
1132
1133        /**
1134         * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
1135         */
1136        public Money getUnitPrice() { 
1137          if (this.unitPrice == null)
1138            if (Configuration.errorOnAutoCreate())
1139              throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
1140            else if (Configuration.doAutoCreate())
1141              this.unitPrice = new Money(); // cc
1142          return this.unitPrice;
1143        }
1144
1145        public boolean hasUnitPrice() { 
1146          return this.unitPrice != null && !this.unitPrice.isEmpty();
1147        }
1148
1149        /**
1150         * @param value {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
1151         */
1152        public ValuedItemComponent setUnitPrice(Money value)  { 
1153          this.unitPrice = value;
1154          return this;
1155        }
1156
1157        /**
1158         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
1159         */
1160        public DecimalType getFactorElement() { 
1161          if (this.factor == null)
1162            if (Configuration.errorOnAutoCreate())
1163              throw new Error("Attempt to auto-create ValuedItemComponent.factor");
1164            else if (Configuration.doAutoCreate())
1165              this.factor = new DecimalType(); // bb
1166          return this.factor;
1167        }
1168
1169        public boolean hasFactorElement() { 
1170          return this.factor != null && !this.factor.isEmpty();
1171        }
1172
1173        public boolean hasFactor() { 
1174          return this.factor != null && !this.factor.isEmpty();
1175        }
1176
1177        /**
1178         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
1179         */
1180        public ValuedItemComponent setFactorElement(DecimalType value) { 
1181          this.factor = value;
1182          return this;
1183        }
1184
1185        /**
1186         * @return A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1187         */
1188        public BigDecimal getFactor() { 
1189          return this.factor == null ? null : this.factor.getValue();
1190        }
1191
1192        /**
1193         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1194         */
1195        public ValuedItemComponent setFactor(BigDecimal value) { 
1196          if (value == null)
1197            this.factor = null;
1198          else {
1199            if (this.factor == null)
1200              this.factor = new DecimalType();
1201            this.factor.setValue(value);
1202          }
1203          return this;
1204        }
1205
1206        /**
1207         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1208         */
1209        public ValuedItemComponent setFactor(long value) { 
1210              this.factor = new DecimalType();
1211            this.factor.setValue(value);
1212          return this;
1213        }
1214
1215        /**
1216         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1217         */
1218        public ValuedItemComponent setFactor(double value) { 
1219              this.factor = new DecimalType();
1220            this.factor.setValue(value);
1221          return this;
1222        }
1223
1224        /**
1225         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
1226         */
1227        public DecimalType getPointsElement() { 
1228          if (this.points == null)
1229            if (Configuration.errorOnAutoCreate())
1230              throw new Error("Attempt to auto-create ValuedItemComponent.points");
1231            else if (Configuration.doAutoCreate())
1232              this.points = new DecimalType(); // bb
1233          return this.points;
1234        }
1235
1236        public boolean hasPointsElement() { 
1237          return this.points != null && !this.points.isEmpty();
1238        }
1239
1240        public boolean hasPoints() { 
1241          return this.points != null && !this.points.isEmpty();
1242        }
1243
1244        /**
1245         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
1246         */
1247        public ValuedItemComponent setPointsElement(DecimalType value) { 
1248          this.points = value;
1249          return this;
1250        }
1251
1252        /**
1253         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1254         */
1255        public BigDecimal getPoints() { 
1256          return this.points == null ? null : this.points.getValue();
1257        }
1258
1259        /**
1260         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1261         */
1262        public ValuedItemComponent setPoints(BigDecimal value) { 
1263          if (value == null)
1264            this.points = null;
1265          else {
1266            if (this.points == null)
1267              this.points = new DecimalType();
1268            this.points.setValue(value);
1269          }
1270          return this;
1271        }
1272
1273        /**
1274         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1275         */
1276        public ValuedItemComponent setPoints(long value) { 
1277              this.points = new DecimalType();
1278            this.points.setValue(value);
1279          return this;
1280        }
1281
1282        /**
1283         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1284         */
1285        public ValuedItemComponent setPoints(double value) { 
1286              this.points = new DecimalType();
1287            this.points.setValue(value);
1288          return this;
1289        }
1290
1291        /**
1292         * @return {@link #net} (Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
1293         */
1294        public Money getNet() { 
1295          if (this.net == null)
1296            if (Configuration.errorOnAutoCreate())
1297              throw new Error("Attempt to auto-create ValuedItemComponent.net");
1298            else if (Configuration.doAutoCreate())
1299              this.net = new Money(); // cc
1300          return this.net;
1301        }
1302
1303        public boolean hasNet() { 
1304          return this.net != null && !this.net.isEmpty();
1305        }
1306
1307        /**
1308         * @param value {@link #net} (Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
1309         */
1310        public ValuedItemComponent setNet(Money value)  { 
1311          this.net = value;
1312          return this;
1313        }
1314
1315        protected void listChildren(List<Property> children) {
1316          super.listChildren(children);
1317          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
1318          children.add(new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
1319          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
1320          children.add(new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.", 0, 1, quantity));
1321          children.add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
1322          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
1323          children.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.", 0, 1, points));
1324          children.add(new Property("net", "Money", "Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
1325        }
1326
1327        @Override
1328        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1329          switch (_hash) {
1330          case -740568643: /*entity[x]*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1331          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1332          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1333          case -356635992: /*entityReference*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1334          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier);
1335          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
1336          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.", 0, 1, quantity);
1337          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice);
1338          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
1339          case -982754077: /*points*/  return new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.", 0, 1, points);
1340          case 108957: /*net*/  return new Property("net", "Money", "Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
1341          default: return super.getNamedProperty(_hash, _name, _checkValid);
1342          }
1343
1344        }
1345
1346      @Override
1347      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1348        switch (hash) {
1349        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // Type
1350        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1351        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
1352        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
1353        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
1354        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
1355        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
1356        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
1357        default: return super.getProperty(hash, name, checkValid);
1358        }
1359
1360      }
1361
1362      @Override
1363      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1364        switch (hash) {
1365        case -1298275357: // entity
1366          this.entity = castToType(value); // Type
1367          return value;
1368        case -1618432855: // identifier
1369          this.identifier = castToIdentifier(value); // Identifier
1370          return value;
1371        case -929905388: // effectiveTime
1372          this.effectiveTime = castToDateTime(value); // DateTimeType
1373          return value;
1374        case -1285004149: // quantity
1375          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1376          return value;
1377        case -486196699: // unitPrice
1378          this.unitPrice = castToMoney(value); // Money
1379          return value;
1380        case -1282148017: // factor
1381          this.factor = castToDecimal(value); // DecimalType
1382          return value;
1383        case -982754077: // points
1384          this.points = castToDecimal(value); // DecimalType
1385          return value;
1386        case 108957: // net
1387          this.net = castToMoney(value); // Money
1388          return value;
1389        default: return super.setProperty(hash, name, value);
1390        }
1391
1392      }
1393
1394      @Override
1395      public Base setProperty(String name, Base value) throws FHIRException {
1396        if (name.equals("entity[x]")) {
1397          this.entity = castToType(value); // Type
1398        } else if (name.equals("identifier")) {
1399          this.identifier = castToIdentifier(value); // Identifier
1400        } else if (name.equals("effectiveTime")) {
1401          this.effectiveTime = castToDateTime(value); // DateTimeType
1402        } else if (name.equals("quantity")) {
1403          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1404        } else if (name.equals("unitPrice")) {
1405          this.unitPrice = castToMoney(value); // Money
1406        } else if (name.equals("factor")) {
1407          this.factor = castToDecimal(value); // DecimalType
1408        } else if (name.equals("points")) {
1409          this.points = castToDecimal(value); // DecimalType
1410        } else if (name.equals("net")) {
1411          this.net = castToMoney(value); // Money
1412        } else
1413          return super.setProperty(name, value);
1414        return value;
1415      }
1416
1417      @Override
1418      public Base makeProperty(int hash, String name) throws FHIRException {
1419        switch (hash) {
1420        case -740568643:  return getEntity(); 
1421        case -1298275357:  return getEntity(); 
1422        case -1618432855:  return getIdentifier(); 
1423        case -929905388:  return getEffectiveTimeElement();
1424        case -1285004149:  return getQuantity(); 
1425        case -486196699:  return getUnitPrice(); 
1426        case -1282148017:  return getFactorElement();
1427        case -982754077:  return getPointsElement();
1428        case 108957:  return getNet(); 
1429        default: return super.makeProperty(hash, name);
1430        }
1431
1432      }
1433
1434      @Override
1435      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1436        switch (hash) {
1437        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
1438        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1439        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
1440        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
1441        case -486196699: /*unitPrice*/ return new String[] {"Money"};
1442        case -1282148017: /*factor*/ return new String[] {"decimal"};
1443        case -982754077: /*points*/ return new String[] {"decimal"};
1444        case 108957: /*net*/ return new String[] {"Money"};
1445        default: return super.getTypesForProperty(hash, name);
1446        }
1447
1448      }
1449
1450      @Override
1451      public Base addChild(String name) throws FHIRException {
1452        if (name.equals("entityCodeableConcept")) {
1453          this.entity = new CodeableConcept();
1454          return this.entity;
1455        }
1456        else if (name.equals("entityReference")) {
1457          this.entity = new Reference();
1458          return this.entity;
1459        }
1460        else if (name.equals("identifier")) {
1461          this.identifier = new Identifier();
1462          return this.identifier;
1463        }
1464        else if (name.equals("effectiveTime")) {
1465          throw new FHIRException("Cannot call addChild on a primitive type Contract.effectiveTime");
1466        }
1467        else if (name.equals("quantity")) {
1468          this.quantity = new SimpleQuantity();
1469          return this.quantity;
1470        }
1471        else if (name.equals("unitPrice")) {
1472          this.unitPrice = new Money();
1473          return this.unitPrice;
1474        }
1475        else if (name.equals("factor")) {
1476          throw new FHIRException("Cannot call addChild on a primitive type Contract.factor");
1477        }
1478        else if (name.equals("points")) {
1479          throw new FHIRException("Cannot call addChild on a primitive type Contract.points");
1480        }
1481        else if (name.equals("net")) {
1482          this.net = new Money();
1483          return this.net;
1484        }
1485        else
1486          return super.addChild(name);
1487      }
1488
1489      public ValuedItemComponent copy() {
1490        ValuedItemComponent dst = new ValuedItemComponent();
1491        copyValues(dst);
1492        dst.entity = entity == null ? null : entity.copy();
1493        dst.identifier = identifier == null ? null : identifier.copy();
1494        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
1495        dst.quantity = quantity == null ? null : quantity.copy();
1496        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
1497        dst.factor = factor == null ? null : factor.copy();
1498        dst.points = points == null ? null : points.copy();
1499        dst.net = net == null ? null : net.copy();
1500        return dst;
1501      }
1502
1503      @Override
1504      public boolean equalsDeep(Base other_) {
1505        if (!super.equalsDeep(other_))
1506          return false;
1507        if (!(other_ instanceof ValuedItemComponent))
1508          return false;
1509        ValuedItemComponent o = (ValuedItemComponent) other_;
1510        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
1511           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
1512           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true);
1513      }
1514
1515      @Override
1516      public boolean equalsShallow(Base other_) {
1517        if (!super.equalsShallow(other_))
1518          return false;
1519        if (!(other_ instanceof ValuedItemComponent))
1520          return false;
1521        ValuedItemComponent o = (ValuedItemComponent) other_;
1522        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
1523           && compareValues(points, o.points, true);
1524      }
1525
1526      public boolean isEmpty() {
1527        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
1528          , quantity, unitPrice, factor, points, net);
1529      }
1530
1531  public String fhirType() {
1532    return "Contract.valuedItem";
1533
1534  }
1535
1536  }
1537
1538    @Block()
1539    public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1540        /**
1541         * Unique identifier for this particular Contract Provision.
1542         */
1543        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1544        @Description(shortDefinition="Contract Term Number", formalDefinition="Unique identifier for this particular Contract Provision." )
1545        protected Identifier identifier;
1546
1547        /**
1548         * When this Contract Provision was issued.
1549         */
1550        @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1551        @Description(shortDefinition="Contract Term Issue Date Time", formalDefinition="When this Contract Provision was issued." )
1552        protected DateTimeType issued;
1553
1554        /**
1555         * Relevant time or time-period when this Contract Provision is applicable.
1556         */
1557        @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
1558        @Description(shortDefinition="Contract Term Effective Time", formalDefinition="Relevant time or time-period when this Contract Provision is applicable." )
1559        protected Period applies;
1560
1561        /**
1562         * Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.
1563         */
1564        @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1565        @Description(shortDefinition="Contract Term Type or Form", formalDefinition="Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit." )
1566        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
1567        protected CodeableConcept type;
1568
1569        /**
1570         * Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.
1571         */
1572        @Child(name = "subType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1573        @Description(shortDefinition="Contract Term Type specific classification", formalDefinition="Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment." )
1574        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-subtype")
1575        protected CodeableConcept subType;
1576
1577        /**
1578         * The matter of concern in the context of this provision of the agrement.
1579         */
1580        @Child(name = "topic", type = {Reference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1581        @Description(shortDefinition="Context of the Contract term", formalDefinition="The matter of concern in the context of this provision of the agrement." )
1582        protected List<Reference> topic;
1583        /**
1584         * The actual objects that are the target of the reference (The matter of concern in the context of this provision of the agrement.)
1585         */
1586        protected List<Resource> topicTarget;
1587
1588
1589        /**
1590         * Action stipulated by this Contract Provision.
1591         */
1592        @Child(name = "action", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1593        @Description(shortDefinition="Contract Term Activity", formalDefinition="Action stipulated by this Contract Provision." )
1594        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
1595        protected List<CodeableConcept> action;
1596
1597        /**
1598         * Reason or purpose for the action stipulated by this Contract Provision.
1599         */
1600        @Child(name = "actionReason", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1601        @Description(shortDefinition="Purpose for the Contract Term Action", formalDefinition="Reason or purpose for the action stipulated by this Contract Provision." )
1602        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-PurposeOfUse")
1603        protected List<CodeableConcept> actionReason;
1604
1605        /**
1606         * A set of security labels that define which terms are controlled by this condition.
1607         */
1608        @Child(name = "securityLabel", type = {Coding.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1609        @Description(shortDefinition="Security Labels that define affected terms", formalDefinition="A set of security labels that define which terms are controlled by this condition." )
1610        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
1611        protected List<Coding> securityLabel;
1612
1613        /**
1614         * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
1615         */
1616        @Child(name = "agent", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1617        @Description(shortDefinition="Contract Term Agent List", formalDefinition="An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place." )
1618        protected List<TermAgentComponent> agent;
1619
1620        /**
1621         * Human readable form of this Contract Provision.
1622         */
1623        @Child(name = "text", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
1624        @Description(shortDefinition="Human readable Contract term text", formalDefinition="Human readable form of this Contract Provision." )
1625        protected StringType text;
1626
1627        /**
1628         * Contract Provision Valued Item List.
1629         */
1630        @Child(name = "valuedItem", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1631        @Description(shortDefinition="Contract Term Valued Item List", formalDefinition="Contract Provision Valued Item List." )
1632        protected List<TermValuedItemComponent> valuedItem;
1633
1634        /**
1635         * Nested group of Contract Provisions.
1636         */
1637        @Child(name = "group", type = {TermComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1638        @Description(shortDefinition="Nested Contract Term Group", formalDefinition="Nested group of Contract Provisions." )
1639        protected List<TermComponent> group;
1640
1641        private static final long serialVersionUID = 812661371L;
1642
1643    /**
1644     * Constructor
1645     */
1646      public TermComponent() {
1647        super();
1648      }
1649
1650        /**
1651         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
1652         */
1653        public Identifier getIdentifier() { 
1654          if (this.identifier == null)
1655            if (Configuration.errorOnAutoCreate())
1656              throw new Error("Attempt to auto-create TermComponent.identifier");
1657            else if (Configuration.doAutoCreate())
1658              this.identifier = new Identifier(); // cc
1659          return this.identifier;
1660        }
1661
1662        public boolean hasIdentifier() { 
1663          return this.identifier != null && !this.identifier.isEmpty();
1664        }
1665
1666        /**
1667         * @param value {@link #identifier} (Unique identifier for this particular Contract Provision.)
1668         */
1669        public TermComponent setIdentifier(Identifier value)  { 
1670          this.identifier = value;
1671          return this;
1672        }
1673
1674        /**
1675         * @return {@link #issued} (When this Contract Provision was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
1676         */
1677        public DateTimeType getIssuedElement() { 
1678          if (this.issued == null)
1679            if (Configuration.errorOnAutoCreate())
1680              throw new Error("Attempt to auto-create TermComponent.issued");
1681            else if (Configuration.doAutoCreate())
1682              this.issued = new DateTimeType(); // bb
1683          return this.issued;
1684        }
1685
1686        public boolean hasIssuedElement() { 
1687          return this.issued != null && !this.issued.isEmpty();
1688        }
1689
1690        public boolean hasIssued() { 
1691          return this.issued != null && !this.issued.isEmpty();
1692        }
1693
1694        /**
1695         * @param value {@link #issued} (When this Contract Provision was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
1696         */
1697        public TermComponent setIssuedElement(DateTimeType value) { 
1698          this.issued = value;
1699          return this;
1700        }
1701
1702        /**
1703         * @return When this Contract Provision was issued.
1704         */
1705        public Date getIssued() { 
1706          return this.issued == null ? null : this.issued.getValue();
1707        }
1708
1709        /**
1710         * @param value When this Contract Provision was issued.
1711         */
1712        public TermComponent setIssued(Date value) { 
1713          if (value == null)
1714            this.issued = null;
1715          else {
1716            if (this.issued == null)
1717              this.issued = new DateTimeType();
1718            this.issued.setValue(value);
1719          }
1720          return this;
1721        }
1722
1723        /**
1724         * @return {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1725         */
1726        public Period getApplies() { 
1727          if (this.applies == null)
1728            if (Configuration.errorOnAutoCreate())
1729              throw new Error("Attempt to auto-create TermComponent.applies");
1730            else if (Configuration.doAutoCreate())
1731              this.applies = new Period(); // cc
1732          return this.applies;
1733        }
1734
1735        public boolean hasApplies() { 
1736          return this.applies != null && !this.applies.isEmpty();
1737        }
1738
1739        /**
1740         * @param value {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1741         */
1742        public TermComponent setApplies(Period value)  { 
1743          this.applies = value;
1744          return this;
1745        }
1746
1747        /**
1748         * @return {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
1749         */
1750        public CodeableConcept getType() { 
1751          if (this.type == null)
1752            if (Configuration.errorOnAutoCreate())
1753              throw new Error("Attempt to auto-create TermComponent.type");
1754            else if (Configuration.doAutoCreate())
1755              this.type = new CodeableConcept(); // cc
1756          return this.type;
1757        }
1758
1759        public boolean hasType() { 
1760          return this.type != null && !this.type.isEmpty();
1761        }
1762
1763        /**
1764         * @param value {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
1765         */
1766        public TermComponent setType(CodeableConcept value)  { 
1767          this.type = value;
1768          return this;
1769        }
1770
1771        /**
1772         * @return {@link #subType} (Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.)
1773         */
1774        public CodeableConcept getSubType() { 
1775          if (this.subType == null)
1776            if (Configuration.errorOnAutoCreate())
1777              throw new Error("Attempt to auto-create TermComponent.subType");
1778            else if (Configuration.doAutoCreate())
1779              this.subType = new CodeableConcept(); // cc
1780          return this.subType;
1781        }
1782
1783        public boolean hasSubType() { 
1784          return this.subType != null && !this.subType.isEmpty();
1785        }
1786
1787        /**
1788         * @param value {@link #subType} (Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.)
1789         */
1790        public TermComponent setSubType(CodeableConcept value)  { 
1791          this.subType = value;
1792          return this;
1793        }
1794
1795        /**
1796         * @return {@link #topic} (The matter of concern in the context of this provision of the agrement.)
1797         */
1798        public List<Reference> getTopic() { 
1799          if (this.topic == null)
1800            this.topic = new ArrayList<Reference>();
1801          return this.topic;
1802        }
1803
1804        /**
1805         * @return Returns a reference to <code>this</code> for easy method chaining
1806         */
1807        public TermComponent setTopic(List<Reference> theTopic) { 
1808          this.topic = theTopic;
1809          return this;
1810        }
1811
1812        public boolean hasTopic() { 
1813          if (this.topic == null)
1814            return false;
1815          for (Reference item : this.topic)
1816            if (!item.isEmpty())
1817              return true;
1818          return false;
1819        }
1820
1821        public Reference addTopic() { //3
1822          Reference t = new Reference();
1823          if (this.topic == null)
1824            this.topic = new ArrayList<Reference>();
1825          this.topic.add(t);
1826          return t;
1827        }
1828
1829        public TermComponent addTopic(Reference t) { //3
1830          if (t == null)
1831            return this;
1832          if (this.topic == null)
1833            this.topic = new ArrayList<Reference>();
1834          this.topic.add(t);
1835          return this;
1836        }
1837
1838        /**
1839         * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist
1840         */
1841        public Reference getTopicFirstRep() { 
1842          if (getTopic().isEmpty()) {
1843            addTopic();
1844          }
1845          return getTopic().get(0);
1846        }
1847
1848        /**
1849         * @deprecated Use Reference#setResource(IBaseResource) instead
1850         */
1851        @Deprecated
1852        public List<Resource> getTopicTarget() { 
1853          if (this.topicTarget == null)
1854            this.topicTarget = new ArrayList<Resource>();
1855          return this.topicTarget;
1856        }
1857
1858        /**
1859         * @return {@link #action} (Action stipulated by this Contract Provision.)
1860         */
1861        public List<CodeableConcept> getAction() { 
1862          if (this.action == null)
1863            this.action = new ArrayList<CodeableConcept>();
1864          return this.action;
1865        }
1866
1867        /**
1868         * @return Returns a reference to <code>this</code> for easy method chaining
1869         */
1870        public TermComponent setAction(List<CodeableConcept> theAction) { 
1871          this.action = theAction;
1872          return this;
1873        }
1874
1875        public boolean hasAction() { 
1876          if (this.action == null)
1877            return false;
1878          for (CodeableConcept item : this.action)
1879            if (!item.isEmpty())
1880              return true;
1881          return false;
1882        }
1883
1884        public CodeableConcept addAction() { //3
1885          CodeableConcept t = new CodeableConcept();
1886          if (this.action == null)
1887            this.action = new ArrayList<CodeableConcept>();
1888          this.action.add(t);
1889          return t;
1890        }
1891
1892        public TermComponent addAction(CodeableConcept t) { //3
1893          if (t == null)
1894            return this;
1895          if (this.action == null)
1896            this.action = new ArrayList<CodeableConcept>();
1897          this.action.add(t);
1898          return this;
1899        }
1900
1901        /**
1902         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
1903         */
1904        public CodeableConcept getActionFirstRep() { 
1905          if (getAction().isEmpty()) {
1906            addAction();
1907          }
1908          return getAction().get(0);
1909        }
1910
1911        /**
1912         * @return {@link #actionReason} (Reason or purpose for the action stipulated by this Contract Provision.)
1913         */
1914        public List<CodeableConcept> getActionReason() { 
1915          if (this.actionReason == null)
1916            this.actionReason = new ArrayList<CodeableConcept>();
1917          return this.actionReason;
1918        }
1919
1920        /**
1921         * @return Returns a reference to <code>this</code> for easy method chaining
1922         */
1923        public TermComponent setActionReason(List<CodeableConcept> theActionReason) { 
1924          this.actionReason = theActionReason;
1925          return this;
1926        }
1927
1928        public boolean hasActionReason() { 
1929          if (this.actionReason == null)
1930            return false;
1931          for (CodeableConcept item : this.actionReason)
1932            if (!item.isEmpty())
1933              return true;
1934          return false;
1935        }
1936
1937        public CodeableConcept addActionReason() { //3
1938          CodeableConcept t = new CodeableConcept();
1939          if (this.actionReason == null)
1940            this.actionReason = new ArrayList<CodeableConcept>();
1941          this.actionReason.add(t);
1942          return t;
1943        }
1944
1945        public TermComponent addActionReason(CodeableConcept t) { //3
1946          if (t == null)
1947            return this;
1948          if (this.actionReason == null)
1949            this.actionReason = new ArrayList<CodeableConcept>();
1950          this.actionReason.add(t);
1951          return this;
1952        }
1953
1954        /**
1955         * @return The first repetition of repeating field {@link #actionReason}, creating it if it does not already exist
1956         */
1957        public CodeableConcept getActionReasonFirstRep() { 
1958          if (getActionReason().isEmpty()) {
1959            addActionReason();
1960          }
1961          return getActionReason().get(0);
1962        }
1963
1964        /**
1965         * @return {@link #securityLabel} (A set of security labels that define which terms are controlled by this condition.)
1966         */
1967        public List<Coding> getSecurityLabel() { 
1968          if (this.securityLabel == null)
1969            this.securityLabel = new ArrayList<Coding>();
1970          return this.securityLabel;
1971        }
1972
1973        /**
1974         * @return Returns a reference to <code>this</code> for easy method chaining
1975         */
1976        public TermComponent setSecurityLabel(List<Coding> theSecurityLabel) { 
1977          this.securityLabel = theSecurityLabel;
1978          return this;
1979        }
1980
1981        public boolean hasSecurityLabel() { 
1982          if (this.securityLabel == null)
1983            return false;
1984          for (Coding item : this.securityLabel)
1985            if (!item.isEmpty())
1986              return true;
1987          return false;
1988        }
1989
1990        public Coding addSecurityLabel() { //3
1991          Coding t = new Coding();
1992          if (this.securityLabel == null)
1993            this.securityLabel = new ArrayList<Coding>();
1994          this.securityLabel.add(t);
1995          return t;
1996        }
1997
1998        public TermComponent addSecurityLabel(Coding t) { //3
1999          if (t == null)
2000            return this;
2001          if (this.securityLabel == null)
2002            this.securityLabel = new ArrayList<Coding>();
2003          this.securityLabel.add(t);
2004          return this;
2005        }
2006
2007        /**
2008         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist
2009         */
2010        public Coding getSecurityLabelFirstRep() { 
2011          if (getSecurityLabel().isEmpty()) {
2012            addSecurityLabel();
2013          }
2014          return getSecurityLabel().get(0);
2015        }
2016
2017        /**
2018         * @return {@link #agent} (An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.)
2019         */
2020        public List<TermAgentComponent> getAgent() { 
2021          if (this.agent == null)
2022            this.agent = new ArrayList<TermAgentComponent>();
2023          return this.agent;
2024        }
2025
2026        /**
2027         * @return Returns a reference to <code>this</code> for easy method chaining
2028         */
2029        public TermComponent setAgent(List<TermAgentComponent> theAgent) { 
2030          this.agent = theAgent;
2031          return this;
2032        }
2033
2034        public boolean hasAgent() { 
2035          if (this.agent == null)
2036            return false;
2037          for (TermAgentComponent item : this.agent)
2038            if (!item.isEmpty())
2039              return true;
2040          return false;
2041        }
2042
2043        public TermAgentComponent addAgent() { //3
2044          TermAgentComponent t = new TermAgentComponent();
2045          if (this.agent == null)
2046            this.agent = new ArrayList<TermAgentComponent>();
2047          this.agent.add(t);
2048          return t;
2049        }
2050
2051        public TermComponent addAgent(TermAgentComponent t) { //3
2052          if (t == null)
2053            return this;
2054          if (this.agent == null)
2055            this.agent = new ArrayList<TermAgentComponent>();
2056          this.agent.add(t);
2057          return this;
2058        }
2059
2060        /**
2061         * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist
2062         */
2063        public TermAgentComponent getAgentFirstRep() { 
2064          if (getAgent().isEmpty()) {
2065            addAgent();
2066          }
2067          return getAgent().get(0);
2068        }
2069
2070        /**
2071         * @return {@link #text} (Human readable form of this Contract Provision.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2072         */
2073        public StringType getTextElement() { 
2074          if (this.text == null)
2075            if (Configuration.errorOnAutoCreate())
2076              throw new Error("Attempt to auto-create TermComponent.text");
2077            else if (Configuration.doAutoCreate())
2078              this.text = new StringType(); // bb
2079          return this.text;
2080        }
2081
2082        public boolean hasTextElement() { 
2083          return this.text != null && !this.text.isEmpty();
2084        }
2085
2086        public boolean hasText() { 
2087          return this.text != null && !this.text.isEmpty();
2088        }
2089
2090        /**
2091         * @param value {@link #text} (Human readable form of this Contract Provision.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2092         */
2093        public TermComponent setTextElement(StringType value) { 
2094          this.text = value;
2095          return this;
2096        }
2097
2098        /**
2099         * @return Human readable form of this Contract Provision.
2100         */
2101        public String getText() { 
2102          return this.text == null ? null : this.text.getValue();
2103        }
2104
2105        /**
2106         * @param value Human readable form of this Contract Provision.
2107         */
2108        public TermComponent setText(String value) { 
2109          if (Utilities.noString(value))
2110            this.text = null;
2111          else {
2112            if (this.text == null)
2113              this.text = new StringType();
2114            this.text.setValue(value);
2115          }
2116          return this;
2117        }
2118
2119        /**
2120         * @return {@link #valuedItem} (Contract Provision Valued Item List.)
2121         */
2122        public List<TermValuedItemComponent> getValuedItem() { 
2123          if (this.valuedItem == null)
2124            this.valuedItem = new ArrayList<TermValuedItemComponent>();
2125          return this.valuedItem;
2126        }
2127
2128        /**
2129         * @return Returns a reference to <code>this</code> for easy method chaining
2130         */
2131        public TermComponent setValuedItem(List<TermValuedItemComponent> theValuedItem) { 
2132          this.valuedItem = theValuedItem;
2133          return this;
2134        }
2135
2136        public boolean hasValuedItem() { 
2137          if (this.valuedItem == null)
2138            return false;
2139          for (TermValuedItemComponent item : this.valuedItem)
2140            if (!item.isEmpty())
2141              return true;
2142          return false;
2143        }
2144
2145        public TermValuedItemComponent addValuedItem() { //3
2146          TermValuedItemComponent t = new TermValuedItemComponent();
2147          if (this.valuedItem == null)
2148            this.valuedItem = new ArrayList<TermValuedItemComponent>();
2149          this.valuedItem.add(t);
2150          return t;
2151        }
2152
2153        public TermComponent addValuedItem(TermValuedItemComponent t) { //3
2154          if (t == null)
2155            return this;
2156          if (this.valuedItem == null)
2157            this.valuedItem = new ArrayList<TermValuedItemComponent>();
2158          this.valuedItem.add(t);
2159          return this;
2160        }
2161
2162        /**
2163         * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist
2164         */
2165        public TermValuedItemComponent getValuedItemFirstRep() { 
2166          if (getValuedItem().isEmpty()) {
2167            addValuedItem();
2168          }
2169          return getValuedItem().get(0);
2170        }
2171
2172        /**
2173         * @return {@link #group} (Nested group of Contract Provisions.)
2174         */
2175        public List<TermComponent> getGroup() { 
2176          if (this.group == null)
2177            this.group = new ArrayList<TermComponent>();
2178          return this.group;
2179        }
2180
2181        /**
2182         * @return Returns a reference to <code>this</code> for easy method chaining
2183         */
2184        public TermComponent setGroup(List<TermComponent> theGroup) { 
2185          this.group = theGroup;
2186          return this;
2187        }
2188
2189        public boolean hasGroup() { 
2190          if (this.group == null)
2191            return false;
2192          for (TermComponent item : this.group)
2193            if (!item.isEmpty())
2194              return true;
2195          return false;
2196        }
2197
2198        public TermComponent addGroup() { //3
2199          TermComponent t = new TermComponent();
2200          if (this.group == null)
2201            this.group = new ArrayList<TermComponent>();
2202          this.group.add(t);
2203          return t;
2204        }
2205
2206        public TermComponent addGroup(TermComponent t) { //3
2207          if (t == null)
2208            return this;
2209          if (this.group == null)
2210            this.group = new ArrayList<TermComponent>();
2211          this.group.add(t);
2212          return this;
2213        }
2214
2215        /**
2216         * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
2217         */
2218        public TermComponent getGroupFirstRep() { 
2219          if (getGroup().isEmpty()) {
2220            addGroup();
2221          }
2222          return getGroup().get(0);
2223        }
2224
2225        protected void listChildren(List<Property> children) {
2226          super.listChildren(children);
2227          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier));
2228          children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
2229          children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
2230          children.add(new Property("type", "CodeableConcept", "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.", 0, 1, type));
2231          children.add(new Property("subType", "CodeableConcept", "Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.", 0, 1, subType));
2232          children.add(new Property("topic", "Reference(Any)", "The matter of concern in the context of this provision of the agrement.", 0, java.lang.Integer.MAX_VALUE, topic));
2233          children.add(new Property("action", "CodeableConcept", "Action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, action));
2234          children.add(new Property("actionReason", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, actionReason));
2235          children.add(new Property("securityLabel", "Coding", "A set of security labels that define which terms are controlled by this condition.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
2236          children.add(new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent));
2237          children.add(new Property("text", "string", "Human readable form of this Contract Provision.", 0, 1, text));
2238          children.add(new Property("valuedItem", "", "Contract Provision Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
2239          children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group));
2240        }
2241
2242        @Override
2243        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2244          switch (_hash) {
2245          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
2246          case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued);
2247          case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
2248          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.", 0, 1, type);
2249          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.", 0, 1, subType);
2250          case 110546223: /*topic*/  return new Property("topic", "Reference(Any)", "The matter of concern in the context of this provision of the agrement.", 0, java.lang.Integer.MAX_VALUE, topic);
2251          case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "Action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, action);
2252          case 1465121818: /*actionReason*/  return new Property("actionReason", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, actionReason);
2253          case -722296940: /*securityLabel*/  return new Property("securityLabel", "Coding", "A set of security labels that define which terms are controlled by this condition.", 0, java.lang.Integer.MAX_VALUE, securityLabel);
2254          case 92750597: /*agent*/  return new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent);
2255          case 3556653: /*text*/  return new Property("text", "string", "Human readable form of this Contract Provision.", 0, 1, text);
2256          case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Provision Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
2257          case 98629247: /*group*/  return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group);
2258          default: return super.getNamedProperty(_hash, _name, _checkValid);
2259          }
2260
2261        }
2262
2263      @Override
2264      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2265        switch (hash) {
2266        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2267        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
2268        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
2269        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2270        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
2271        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : this.topic.toArray(new Base[this.topic.size()]); // Reference
2272        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // CodeableConcept
2273        case 1465121818: /*actionReason*/ return this.actionReason == null ? new Base[0] : this.actionReason.toArray(new Base[this.actionReason.size()]); // CodeableConcept
2274        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // Coding
2275        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // TermAgentComponent
2276        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
2277        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // TermValuedItemComponent
2278        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
2279        default: return super.getProperty(hash, name, checkValid);
2280        }
2281
2282      }
2283
2284      @Override
2285      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2286        switch (hash) {
2287        case -1618432855: // identifier
2288          this.identifier = castToIdentifier(value); // Identifier
2289          return value;
2290        case -1179159893: // issued
2291          this.issued = castToDateTime(value); // DateTimeType
2292          return value;
2293        case -793235316: // applies
2294          this.applies = castToPeriod(value); // Period
2295          return value;
2296        case 3575610: // type
2297          this.type = castToCodeableConcept(value); // CodeableConcept
2298          return value;
2299        case -1868521062: // subType
2300          this.subType = castToCodeableConcept(value); // CodeableConcept
2301          return value;
2302        case 110546223: // topic
2303          this.getTopic().add(castToReference(value)); // Reference
2304          return value;
2305        case -1422950858: // action
2306          this.getAction().add(castToCodeableConcept(value)); // CodeableConcept
2307          return value;
2308        case 1465121818: // actionReason
2309          this.getActionReason().add(castToCodeableConcept(value)); // CodeableConcept
2310          return value;
2311        case -722296940: // securityLabel
2312          this.getSecurityLabel().add(castToCoding(value)); // Coding
2313          return value;
2314        case 92750597: // agent
2315          this.getAgent().add((TermAgentComponent) value); // TermAgentComponent
2316          return value;
2317        case 3556653: // text
2318          this.text = castToString(value); // StringType
2319          return value;
2320        case 2046675654: // valuedItem
2321          this.getValuedItem().add((TermValuedItemComponent) value); // TermValuedItemComponent
2322          return value;
2323        case 98629247: // group
2324          this.getGroup().add((TermComponent) value); // TermComponent
2325          return value;
2326        default: return super.setProperty(hash, name, value);
2327        }
2328
2329      }
2330
2331      @Override
2332      public Base setProperty(String name, Base value) throws FHIRException {
2333        if (name.equals("identifier")) {
2334          this.identifier = castToIdentifier(value); // Identifier
2335        } else if (name.equals("issued")) {
2336          this.issued = castToDateTime(value); // DateTimeType
2337        } else if (name.equals("applies")) {
2338          this.applies = castToPeriod(value); // Period
2339        } else if (name.equals("type")) {
2340          this.type = castToCodeableConcept(value); // CodeableConcept
2341        } else if (name.equals("subType")) {
2342          this.subType = castToCodeableConcept(value); // CodeableConcept
2343        } else if (name.equals("topic")) {
2344          this.getTopic().add(castToReference(value));
2345        } else if (name.equals("action")) {
2346          this.getAction().add(castToCodeableConcept(value));
2347        } else if (name.equals("actionReason")) {
2348          this.getActionReason().add(castToCodeableConcept(value));
2349        } else if (name.equals("securityLabel")) {
2350          this.getSecurityLabel().add(castToCoding(value));
2351        } else if (name.equals("agent")) {
2352          this.getAgent().add((TermAgentComponent) value);
2353        } else if (name.equals("text")) {
2354          this.text = castToString(value); // StringType
2355        } else if (name.equals("valuedItem")) {
2356          this.getValuedItem().add((TermValuedItemComponent) value);
2357        } else if (name.equals("group")) {
2358          this.getGroup().add((TermComponent) value);
2359        } else
2360          return super.setProperty(name, value);
2361        return value;
2362      }
2363
2364      @Override
2365      public Base makeProperty(int hash, String name) throws FHIRException {
2366        switch (hash) {
2367        case -1618432855:  return getIdentifier(); 
2368        case -1179159893:  return getIssuedElement();
2369        case -793235316:  return getApplies(); 
2370        case 3575610:  return getType(); 
2371        case -1868521062:  return getSubType(); 
2372        case 110546223:  return addTopic(); 
2373        case -1422950858:  return addAction(); 
2374        case 1465121818:  return addActionReason(); 
2375        case -722296940:  return addSecurityLabel(); 
2376        case 92750597:  return addAgent(); 
2377        case 3556653:  return getTextElement();
2378        case 2046675654:  return addValuedItem(); 
2379        case 98629247:  return addGroup(); 
2380        default: return super.makeProperty(hash, name);
2381        }
2382
2383      }
2384
2385      @Override
2386      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2387        switch (hash) {
2388        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2389        case -1179159893: /*issued*/ return new String[] {"dateTime"};
2390        case -793235316: /*applies*/ return new String[] {"Period"};
2391        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2392        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
2393        case 110546223: /*topic*/ return new String[] {"Reference"};
2394        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
2395        case 1465121818: /*actionReason*/ return new String[] {"CodeableConcept"};
2396        case -722296940: /*securityLabel*/ return new String[] {"Coding"};
2397        case 92750597: /*agent*/ return new String[] {};
2398        case 3556653: /*text*/ return new String[] {"string"};
2399        case 2046675654: /*valuedItem*/ return new String[] {};
2400        case 98629247: /*group*/ return new String[] {"@Contract.term"};
2401        default: return super.getTypesForProperty(hash, name);
2402        }
2403
2404      }
2405
2406      @Override
2407      public Base addChild(String name) throws FHIRException {
2408        if (name.equals("identifier")) {
2409          this.identifier = new Identifier();
2410          return this.identifier;
2411        }
2412        else if (name.equals("issued")) {
2413          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
2414        }
2415        else if (name.equals("applies")) {
2416          this.applies = new Period();
2417          return this.applies;
2418        }
2419        else if (name.equals("type")) {
2420          this.type = new CodeableConcept();
2421          return this.type;
2422        }
2423        else if (name.equals("subType")) {
2424          this.subType = new CodeableConcept();
2425          return this.subType;
2426        }
2427        else if (name.equals("topic")) {
2428          return addTopic();
2429        }
2430        else if (name.equals("action")) {
2431          return addAction();
2432        }
2433        else if (name.equals("actionReason")) {
2434          return addActionReason();
2435        }
2436        else if (name.equals("securityLabel")) {
2437          return addSecurityLabel();
2438        }
2439        else if (name.equals("agent")) {
2440          return addAgent();
2441        }
2442        else if (name.equals("text")) {
2443          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
2444        }
2445        else if (name.equals("valuedItem")) {
2446          return addValuedItem();
2447        }
2448        else if (name.equals("group")) {
2449          return addGroup();
2450        }
2451        else
2452          return super.addChild(name);
2453      }
2454
2455      public TermComponent copy() {
2456        TermComponent dst = new TermComponent();
2457        copyValues(dst);
2458        dst.identifier = identifier == null ? null : identifier.copy();
2459        dst.issued = issued == null ? null : issued.copy();
2460        dst.applies = applies == null ? null : applies.copy();
2461        dst.type = type == null ? null : type.copy();
2462        dst.subType = subType == null ? null : subType.copy();
2463        if (topic != null) {
2464          dst.topic = new ArrayList<Reference>();
2465          for (Reference i : topic)
2466            dst.topic.add(i.copy());
2467        };
2468        if (action != null) {
2469          dst.action = new ArrayList<CodeableConcept>();
2470          for (CodeableConcept i : action)
2471            dst.action.add(i.copy());
2472        };
2473        if (actionReason != null) {
2474          dst.actionReason = new ArrayList<CodeableConcept>();
2475          for (CodeableConcept i : actionReason)
2476            dst.actionReason.add(i.copy());
2477        };
2478        if (securityLabel != null) {
2479          dst.securityLabel = new ArrayList<Coding>();
2480          for (Coding i : securityLabel)
2481            dst.securityLabel.add(i.copy());
2482        };
2483        if (agent != null) {
2484          dst.agent = new ArrayList<TermAgentComponent>();
2485          for (TermAgentComponent i : agent)
2486            dst.agent.add(i.copy());
2487        };
2488        dst.text = text == null ? null : text.copy();
2489        if (valuedItem != null) {
2490          dst.valuedItem = new ArrayList<TermValuedItemComponent>();
2491          for (TermValuedItemComponent i : valuedItem)
2492            dst.valuedItem.add(i.copy());
2493        };
2494        if (group != null) {
2495          dst.group = new ArrayList<TermComponent>();
2496          for (TermComponent i : group)
2497            dst.group.add(i.copy());
2498        };
2499        return dst;
2500      }
2501
2502      @Override
2503      public boolean equalsDeep(Base other_) {
2504        if (!super.equalsDeep(other_))
2505          return false;
2506        if (!(other_ instanceof TermComponent))
2507          return false;
2508        TermComponent o = (TermComponent) other_;
2509        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
2510           && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(topic, o.topic, true)
2511           && compareDeep(action, o.action, true) && compareDeep(actionReason, o.actionReason, true) && compareDeep(securityLabel, o.securityLabel, true)
2512           && compareDeep(agent, o.agent, true) && compareDeep(text, o.text, true) && compareDeep(valuedItem, o.valuedItem, true)
2513           && compareDeep(group, o.group, true);
2514      }
2515
2516      @Override
2517      public boolean equalsShallow(Base other_) {
2518        if (!super.equalsShallow(other_))
2519          return false;
2520        if (!(other_ instanceof TermComponent))
2521          return false;
2522        TermComponent o = (TermComponent) other_;
2523        return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2524      }
2525
2526      public boolean isEmpty() {
2527        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies
2528          , type, subType, topic, action, actionReason, securityLabel, agent, text, valuedItem
2529          , group);
2530      }
2531
2532  public String fhirType() {
2533    return "Contract.term";
2534
2535  }
2536
2537  }
2538
2539    @Block()
2540    public static class TermAgentComponent extends BackboneElement implements IBaseBackboneElement {
2541        /**
2542         * The agent assigned a role in this Contract Provision.
2543         */
2544        @Child(name = "actor", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false)
2545        @Description(shortDefinition="Contract Term Agent Subject", formalDefinition="The agent assigned a role in this Contract Provision." )
2546        protected Reference actor;
2547
2548        /**
2549         * The actual object that is the target of the reference (The agent assigned a role in this Contract Provision.)
2550         */
2551        protected Resource actorTarget;
2552
2553        /**
2554         * Role played by the agent assigned this role in the execution of this Contract Provision.
2555         */
2556        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2557        @Description(shortDefinition="Type of the Contract Term Agent", formalDefinition="Role played by the agent assigned this role in the execution of this Contract Provision." )
2558        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
2559        protected List<CodeableConcept> role;
2560
2561        private static final long serialVersionUID = -454551165L;
2562
2563    /**
2564     * Constructor
2565     */
2566      public TermAgentComponent() {
2567        super();
2568      }
2569
2570    /**
2571     * Constructor
2572     */
2573      public TermAgentComponent(Reference actor) {
2574        super();
2575        this.actor = actor;
2576      }
2577
2578        /**
2579         * @return {@link #actor} (The agent assigned a role in this Contract Provision.)
2580         */
2581        public Reference getActor() { 
2582          if (this.actor == null)
2583            if (Configuration.errorOnAutoCreate())
2584              throw new Error("Attempt to auto-create TermAgentComponent.actor");
2585            else if (Configuration.doAutoCreate())
2586              this.actor = new Reference(); // cc
2587          return this.actor;
2588        }
2589
2590        public boolean hasActor() { 
2591          return this.actor != null && !this.actor.isEmpty();
2592        }
2593
2594        /**
2595         * @param value {@link #actor} (The agent assigned a role in this Contract Provision.)
2596         */
2597        public TermAgentComponent setActor(Reference value)  { 
2598          this.actor = value;
2599          return this;
2600        }
2601
2602        /**
2603         * @return {@link #actor} 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 agent assigned a role in this Contract Provision.)
2604         */
2605        public Resource getActorTarget() { 
2606          return this.actorTarget;
2607        }
2608
2609        /**
2610         * @param value {@link #actor} 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 agent assigned a role in this Contract Provision.)
2611         */
2612        public TermAgentComponent setActorTarget(Resource value) { 
2613          this.actorTarget = value;
2614          return this;
2615        }
2616
2617        /**
2618         * @return {@link #role} (Role played by the agent assigned this role in the execution of this Contract Provision.)
2619         */
2620        public List<CodeableConcept> getRole() { 
2621          if (this.role == null)
2622            this.role = new ArrayList<CodeableConcept>();
2623          return this.role;
2624        }
2625
2626        /**
2627         * @return Returns a reference to <code>this</code> for easy method chaining
2628         */
2629        public TermAgentComponent setRole(List<CodeableConcept> theRole) { 
2630          this.role = theRole;
2631          return this;
2632        }
2633
2634        public boolean hasRole() { 
2635          if (this.role == null)
2636            return false;
2637          for (CodeableConcept item : this.role)
2638            if (!item.isEmpty())
2639              return true;
2640          return false;
2641        }
2642
2643        public CodeableConcept addRole() { //3
2644          CodeableConcept t = new CodeableConcept();
2645          if (this.role == null)
2646            this.role = new ArrayList<CodeableConcept>();
2647          this.role.add(t);
2648          return t;
2649        }
2650
2651        public TermAgentComponent addRole(CodeableConcept t) { //3
2652          if (t == null)
2653            return this;
2654          if (this.role == null)
2655            this.role = new ArrayList<CodeableConcept>();
2656          this.role.add(t);
2657          return this;
2658        }
2659
2660        /**
2661         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist
2662         */
2663        public CodeableConcept getRoleFirstRep() { 
2664          if (getRole().isEmpty()) {
2665            addRole();
2666          }
2667          return getRole().get(0);
2668        }
2669
2670        protected void listChildren(List<Property> children) {
2671          super.listChildren(children);
2672          children.add(new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "The agent assigned a role in this Contract Provision.", 0, 1, actor));
2673          children.add(new Property("role", "CodeableConcept", "Role played by the agent assigned this role in the execution of this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, role));
2674        }
2675
2676        @Override
2677        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2678          switch (_hash) {
2679          case 92645877: /*actor*/  return new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "The agent assigned a role in this Contract Provision.", 0, 1, actor);
2680          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role played by the agent assigned this role in the execution of this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, role);
2681          default: return super.getNamedProperty(_hash, _name, _checkValid);
2682          }
2683
2684        }
2685
2686      @Override
2687      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2688        switch (hash) {
2689        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
2690        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
2691        default: return super.getProperty(hash, name, checkValid);
2692        }
2693
2694      }
2695
2696      @Override
2697      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2698        switch (hash) {
2699        case 92645877: // actor
2700          this.actor = castToReference(value); // Reference
2701          return value;
2702        case 3506294: // role
2703          this.getRole().add(castToCodeableConcept(value)); // CodeableConcept
2704          return value;
2705        default: return super.setProperty(hash, name, value);
2706        }
2707
2708      }
2709
2710      @Override
2711      public Base setProperty(String name, Base value) throws FHIRException {
2712        if (name.equals("actor")) {
2713          this.actor = castToReference(value); // Reference
2714        } else if (name.equals("role")) {
2715          this.getRole().add(castToCodeableConcept(value));
2716        } else
2717          return super.setProperty(name, value);
2718        return value;
2719      }
2720
2721      @Override
2722      public Base makeProperty(int hash, String name) throws FHIRException {
2723        switch (hash) {
2724        case 92645877:  return getActor(); 
2725        case 3506294:  return addRole(); 
2726        default: return super.makeProperty(hash, name);
2727        }
2728
2729      }
2730
2731      @Override
2732      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2733        switch (hash) {
2734        case 92645877: /*actor*/ return new String[] {"Reference"};
2735        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
2736        default: return super.getTypesForProperty(hash, name);
2737        }
2738
2739      }
2740
2741      @Override
2742      public Base addChild(String name) throws FHIRException {
2743        if (name.equals("actor")) {
2744          this.actor = new Reference();
2745          return this.actor;
2746        }
2747        else if (name.equals("role")) {
2748          return addRole();
2749        }
2750        else
2751          return super.addChild(name);
2752      }
2753
2754      public TermAgentComponent copy() {
2755        TermAgentComponent dst = new TermAgentComponent();
2756        copyValues(dst);
2757        dst.actor = actor == null ? null : actor.copy();
2758        if (role != null) {
2759          dst.role = new ArrayList<CodeableConcept>();
2760          for (CodeableConcept i : role)
2761            dst.role.add(i.copy());
2762        };
2763        return dst;
2764      }
2765
2766      @Override
2767      public boolean equalsDeep(Base other_) {
2768        if (!super.equalsDeep(other_))
2769          return false;
2770        if (!(other_ instanceof TermAgentComponent))
2771          return false;
2772        TermAgentComponent o = (TermAgentComponent) other_;
2773        return compareDeep(actor, o.actor, true) && compareDeep(role, o.role, true);
2774      }
2775
2776      @Override
2777      public boolean equalsShallow(Base other_) {
2778        if (!super.equalsShallow(other_))
2779          return false;
2780        if (!(other_ instanceof TermAgentComponent))
2781          return false;
2782        TermAgentComponent o = (TermAgentComponent) other_;
2783        return true;
2784      }
2785
2786      public boolean isEmpty() {
2787        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actor, role);
2788      }
2789
2790  public String fhirType() {
2791    return "Contract.term.agent";
2792
2793  }
2794
2795  }
2796
2797    @Block()
2798    public static class TermValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
2799        /**
2800         * Specific type of Contract Provision Valued Item that may be priced.
2801         */
2802        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
2803        @Description(shortDefinition="Contract Term Valued Item Type", formalDefinition="Specific type of Contract Provision Valued Item that may be priced." )
2804        protected Type entity;
2805
2806        /**
2807         * Identifies a Contract Provision Valued Item instance.
2808         */
2809        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
2810        @Description(shortDefinition="Contract Term Valued Item Number", formalDefinition="Identifies a Contract Provision Valued Item instance." )
2811        protected Identifier identifier;
2812
2813        /**
2814         * Indicates the time during which this Contract Term ValuedItem information is effective.
2815         */
2816        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2817        @Description(shortDefinition="Contract Term Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract Term ValuedItem information is effective." )
2818        protected DateTimeType effectiveTime;
2819
2820        /**
2821         * Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.
2822         */
2823        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
2824        @Description(shortDefinition="Contract Term Valued Item Count", formalDefinition="Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances." )
2825        protected SimpleQuantity quantity;
2826
2827        /**
2828         * A Contract Provision Valued Item unit valuation measure.
2829         */
2830        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
2831        @Description(shortDefinition="Contract Term Valued Item fee, charge, or cost", formalDefinition="A Contract Provision Valued Item unit valuation measure." )
2832        protected Money unitPrice;
2833
2834        /**
2835         * A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2836         */
2837        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2838        @Description(shortDefinition="Contract Term Valued Item Price Scaling Factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
2839        protected DecimalType factor;
2840
2841        /**
2842         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
2843         */
2844        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
2845        @Description(shortDefinition="Contract Term Valued Item Difficulty Scaling Factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point." )
2846        protected DecimalType points;
2847
2848        /**
2849         * Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
2850         */
2851        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
2852        @Description(shortDefinition="Total Contract Term Valued Item Value", formalDefinition="Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
2853        protected Money net;
2854
2855        private static final long serialVersionUID = 1782449516L;
2856
2857    /**
2858     * Constructor
2859     */
2860      public TermValuedItemComponent() {
2861        super();
2862      }
2863
2864        /**
2865         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2866         */
2867        public Type getEntity() { 
2868          return this.entity;
2869        }
2870
2871        /**
2872         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2873         */
2874        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
2875          if (this.entity == null)
2876            return null;
2877          if (!(this.entity instanceof CodeableConcept))
2878            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
2879          return (CodeableConcept) this.entity;
2880        }
2881
2882        public boolean hasEntityCodeableConcept() { 
2883          return this != null && this.entity instanceof CodeableConcept;
2884        }
2885
2886        /**
2887         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2888         */
2889        public Reference getEntityReference() throws FHIRException { 
2890          if (this.entity == null)
2891            return null;
2892          if (!(this.entity instanceof Reference))
2893            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
2894          return (Reference) this.entity;
2895        }
2896
2897        public boolean hasEntityReference() { 
2898          return this != null && this.entity instanceof Reference;
2899        }
2900
2901        public boolean hasEntity() { 
2902          return this.entity != null && !this.entity.isEmpty();
2903        }
2904
2905        /**
2906         * @param value {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2907         */
2908        public TermValuedItemComponent setEntity(Type value) throws FHIRFormatError { 
2909          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2910            throw new FHIRFormatError("Not the right type for Contract.term.valuedItem.entity[x]: "+value.fhirType());
2911          this.entity = value;
2912          return this;
2913        }
2914
2915        /**
2916         * @return {@link #identifier} (Identifies a Contract Provision Valued Item instance.)
2917         */
2918        public Identifier getIdentifier() { 
2919          if (this.identifier == null)
2920            if (Configuration.errorOnAutoCreate())
2921              throw new Error("Attempt to auto-create TermValuedItemComponent.identifier");
2922            else if (Configuration.doAutoCreate())
2923              this.identifier = new Identifier(); // cc
2924          return this.identifier;
2925        }
2926
2927        public boolean hasIdentifier() { 
2928          return this.identifier != null && !this.identifier.isEmpty();
2929        }
2930
2931        /**
2932         * @param value {@link #identifier} (Identifies a Contract Provision Valued Item instance.)
2933         */
2934        public TermValuedItemComponent setIdentifier(Identifier value)  { 
2935          this.identifier = value;
2936          return this;
2937        }
2938
2939        /**
2940         * @return {@link #effectiveTime} (Indicates the time during which this Contract Term ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
2941         */
2942        public DateTimeType getEffectiveTimeElement() { 
2943          if (this.effectiveTime == null)
2944            if (Configuration.errorOnAutoCreate())
2945              throw new Error("Attempt to auto-create TermValuedItemComponent.effectiveTime");
2946            else if (Configuration.doAutoCreate())
2947              this.effectiveTime = new DateTimeType(); // bb
2948          return this.effectiveTime;
2949        }
2950
2951        public boolean hasEffectiveTimeElement() { 
2952          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
2953        }
2954
2955        public boolean hasEffectiveTime() { 
2956          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
2957        }
2958
2959        /**
2960         * @param value {@link #effectiveTime} (Indicates the time during which this Contract Term ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
2961         */
2962        public TermValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
2963          this.effectiveTime = value;
2964          return this;
2965        }
2966
2967        /**
2968         * @return Indicates the time during which this Contract Term ValuedItem information is effective.
2969         */
2970        public Date getEffectiveTime() { 
2971          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
2972        }
2973
2974        /**
2975         * @param value Indicates the time during which this Contract Term ValuedItem information is effective.
2976         */
2977        public TermValuedItemComponent setEffectiveTime(Date value) { 
2978          if (value == null)
2979            this.effectiveTime = null;
2980          else {
2981            if (this.effectiveTime == null)
2982              this.effectiveTime = new DateTimeType();
2983            this.effectiveTime.setValue(value);
2984          }
2985          return this;
2986        }
2987
2988        /**
2989         * @return {@link #quantity} (Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.)
2990         */
2991        public SimpleQuantity getQuantity() { 
2992          if (this.quantity == null)
2993            if (Configuration.errorOnAutoCreate())
2994              throw new Error("Attempt to auto-create TermValuedItemComponent.quantity");
2995            else if (Configuration.doAutoCreate())
2996              this.quantity = new SimpleQuantity(); // cc
2997          return this.quantity;
2998        }
2999
3000        public boolean hasQuantity() { 
3001          return this.quantity != null && !this.quantity.isEmpty();
3002        }
3003
3004        /**
3005         * @param value {@link #quantity} (Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.)
3006         */
3007        public TermValuedItemComponent setQuantity(SimpleQuantity value)  { 
3008          this.quantity = value;
3009          return this;
3010        }
3011
3012        /**
3013         * @return {@link #unitPrice} (A Contract Provision Valued Item unit valuation measure.)
3014         */
3015        public Money getUnitPrice() { 
3016          if (this.unitPrice == null)
3017            if (Configuration.errorOnAutoCreate())
3018              throw new Error("Attempt to auto-create TermValuedItemComponent.unitPrice");
3019            else if (Configuration.doAutoCreate())
3020              this.unitPrice = new Money(); // cc
3021          return this.unitPrice;
3022        }
3023
3024        public boolean hasUnitPrice() { 
3025          return this.unitPrice != null && !this.unitPrice.isEmpty();
3026        }
3027
3028        /**
3029         * @param value {@link #unitPrice} (A Contract Provision Valued Item unit valuation measure.)
3030         */
3031        public TermValuedItemComponent setUnitPrice(Money value)  { 
3032          this.unitPrice = value;
3033          return this;
3034        }
3035
3036        /**
3037         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3038         */
3039        public DecimalType getFactorElement() { 
3040          if (this.factor == null)
3041            if (Configuration.errorOnAutoCreate())
3042              throw new Error("Attempt to auto-create TermValuedItemComponent.factor");
3043            else if (Configuration.doAutoCreate())
3044              this.factor = new DecimalType(); // bb
3045          return this.factor;
3046        }
3047
3048        public boolean hasFactorElement() { 
3049          return this.factor != null && !this.factor.isEmpty();
3050        }
3051
3052        public boolean hasFactor() { 
3053          return this.factor != null && !this.factor.isEmpty();
3054        }
3055
3056        /**
3057         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3058         */
3059        public TermValuedItemComponent setFactorElement(DecimalType value) { 
3060          this.factor = value;
3061          return this;
3062        }
3063
3064        /**
3065         * @return A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3066         */
3067        public BigDecimal getFactor() { 
3068          return this.factor == null ? null : this.factor.getValue();
3069        }
3070
3071        /**
3072         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3073         */
3074        public TermValuedItemComponent setFactor(BigDecimal value) { 
3075          if (value == null)
3076            this.factor = null;
3077          else {
3078            if (this.factor == null)
3079              this.factor = new DecimalType();
3080            this.factor.setValue(value);
3081          }
3082          return this;
3083        }
3084
3085        /**
3086         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3087         */
3088        public TermValuedItemComponent setFactor(long value) { 
3089              this.factor = new DecimalType();
3090            this.factor.setValue(value);
3091          return this;
3092        }
3093
3094        /**
3095         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3096         */
3097        public TermValuedItemComponent setFactor(double value) { 
3098              this.factor = new DecimalType();
3099            this.factor.setValue(value);
3100          return this;
3101        }
3102
3103        /**
3104         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3105         */
3106        public DecimalType getPointsElement() { 
3107          if (this.points == null)
3108            if (Configuration.errorOnAutoCreate())
3109              throw new Error("Attempt to auto-create TermValuedItemComponent.points");
3110            else if (Configuration.doAutoCreate())
3111              this.points = new DecimalType(); // bb
3112          return this.points;
3113        }
3114
3115        public boolean hasPointsElement() { 
3116          return this.points != null && !this.points.isEmpty();
3117        }
3118
3119        public boolean hasPoints() { 
3120          return this.points != null && !this.points.isEmpty();
3121        }
3122
3123        /**
3124         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3125         */
3126        public TermValuedItemComponent setPointsElement(DecimalType value) { 
3127          this.points = value;
3128          return this;
3129        }
3130
3131        /**
3132         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3133         */
3134        public BigDecimal getPoints() { 
3135          return this.points == null ? null : this.points.getValue();
3136        }
3137
3138        /**
3139         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3140         */
3141        public TermValuedItemComponent setPoints(BigDecimal value) { 
3142          if (value == null)
3143            this.points = null;
3144          else {
3145            if (this.points == null)
3146              this.points = new DecimalType();
3147            this.points.setValue(value);
3148          }
3149          return this;
3150        }
3151
3152        /**
3153         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3154         */
3155        public TermValuedItemComponent setPoints(long value) { 
3156              this.points = new DecimalType();
3157            this.points.setValue(value);
3158          return this;
3159        }
3160
3161        /**
3162         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3163         */
3164        public TermValuedItemComponent setPoints(double value) { 
3165              this.points = new DecimalType();
3166            this.points.setValue(value);
3167          return this;
3168        }
3169
3170        /**
3171         * @return {@link #net} (Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3172         */
3173        public Money getNet() { 
3174          if (this.net == null)
3175            if (Configuration.errorOnAutoCreate())
3176              throw new Error("Attempt to auto-create TermValuedItemComponent.net");
3177            else if (Configuration.doAutoCreate())
3178              this.net = new Money(); // cc
3179          return this.net;
3180        }
3181
3182        public boolean hasNet() { 
3183          return this.net != null && !this.net.isEmpty();
3184        }
3185
3186        /**
3187         * @param value {@link #net} (Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3188         */
3189        public TermValuedItemComponent setNet(Money value)  { 
3190          this.net = value;
3191          return this;
3192        }
3193
3194        protected void listChildren(List<Property> children) {
3195          super.listChildren(children);
3196          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity));
3197          children.add(new Property("identifier", "Identifier", "Identifies a Contract Provision Valued Item instance.", 0, 1, identifier));
3198          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract Term ValuedItem information is effective.", 0, 1, effectiveTime));
3199          children.add(new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.", 0, 1, quantity));
3200          children.add(new Property("unitPrice", "Money", "A Contract Provision Valued Item unit valuation measure.", 0, 1, unitPrice));
3201          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
3202          children.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.", 0, 1, points));
3203          children.add(new Property("net", "Money", "Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
3204        }
3205
3206        @Override
3207        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3208          switch (_hash) {
3209          case -740568643: /*entity[x]*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3210          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3211          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3212          case -356635992: /*entityReference*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3213          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Provision Valued Item instance.", 0, 1, identifier);
3214          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract Term ValuedItem information is effective.", 0, 1, effectiveTime);
3215          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.", 0, 1, quantity);
3216          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Provision Valued Item unit valuation measure.", 0, 1, unitPrice);
3217          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
3218          case -982754077: /*points*/  return new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.", 0, 1, points);
3219          case 108957: /*net*/  return new Property("net", "Money", "Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
3220          default: return super.getNamedProperty(_hash, _name, _checkValid);
3221          }
3222
3223        }
3224
3225      @Override
3226      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3227        switch (hash) {
3228        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // Type
3229        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3230        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
3231        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
3232        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
3233        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
3234        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
3235        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
3236        default: return super.getProperty(hash, name, checkValid);
3237        }
3238
3239      }
3240
3241      @Override
3242      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3243        switch (hash) {
3244        case -1298275357: // entity
3245          this.entity = castToType(value); // Type
3246          return value;
3247        case -1618432855: // identifier
3248          this.identifier = castToIdentifier(value); // Identifier
3249          return value;
3250        case -929905388: // effectiveTime
3251          this.effectiveTime = castToDateTime(value); // DateTimeType
3252          return value;
3253        case -1285004149: // quantity
3254          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
3255          return value;
3256        case -486196699: // unitPrice
3257          this.unitPrice = castToMoney(value); // Money
3258          return value;
3259        case -1282148017: // factor
3260          this.factor = castToDecimal(value); // DecimalType
3261          return value;
3262        case -982754077: // points
3263          this.points = castToDecimal(value); // DecimalType
3264          return value;
3265        case 108957: // net
3266          this.net = castToMoney(value); // Money
3267          return value;
3268        default: return super.setProperty(hash, name, value);
3269        }
3270
3271      }
3272
3273      @Override
3274      public Base setProperty(String name, Base value) throws FHIRException {
3275        if (name.equals("entity[x]")) {
3276          this.entity = castToType(value); // Type
3277        } else if (name.equals("identifier")) {
3278          this.identifier = castToIdentifier(value); // Identifier
3279        } else if (name.equals("effectiveTime")) {
3280          this.effectiveTime = castToDateTime(value); // DateTimeType
3281        } else if (name.equals("quantity")) {
3282          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
3283        } else if (name.equals("unitPrice")) {
3284          this.unitPrice = castToMoney(value); // Money
3285        } else if (name.equals("factor")) {
3286          this.factor = castToDecimal(value); // DecimalType
3287        } else if (name.equals("points")) {
3288          this.points = castToDecimal(value); // DecimalType
3289        } else if (name.equals("net")) {
3290          this.net = castToMoney(value); // Money
3291        } else
3292          return super.setProperty(name, value);
3293        return value;
3294      }
3295
3296      @Override
3297      public Base makeProperty(int hash, String name) throws FHIRException {
3298        switch (hash) {
3299        case -740568643:  return getEntity(); 
3300        case -1298275357:  return getEntity(); 
3301        case -1618432855:  return getIdentifier(); 
3302        case -929905388:  return getEffectiveTimeElement();
3303        case -1285004149:  return getQuantity(); 
3304        case -486196699:  return getUnitPrice(); 
3305        case -1282148017:  return getFactorElement();
3306        case -982754077:  return getPointsElement();
3307        case 108957:  return getNet(); 
3308        default: return super.makeProperty(hash, name);
3309        }
3310
3311      }
3312
3313      @Override
3314      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3315        switch (hash) {
3316        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
3317        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3318        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
3319        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
3320        case -486196699: /*unitPrice*/ return new String[] {"Money"};
3321        case -1282148017: /*factor*/ return new String[] {"decimal"};
3322        case -982754077: /*points*/ return new String[] {"decimal"};
3323        case 108957: /*net*/ return new String[] {"Money"};
3324        default: return super.getTypesForProperty(hash, name);
3325        }
3326
3327      }
3328
3329      @Override
3330      public Base addChild(String name) throws FHIRException {
3331        if (name.equals("entityCodeableConcept")) {
3332          this.entity = new CodeableConcept();
3333          return this.entity;
3334        }
3335        else if (name.equals("entityReference")) {
3336          this.entity = new Reference();
3337          return this.entity;
3338        }
3339        else if (name.equals("identifier")) {
3340          this.identifier = new Identifier();
3341          return this.identifier;
3342        }
3343        else if (name.equals("effectiveTime")) {
3344          throw new FHIRException("Cannot call addChild on a primitive type Contract.effectiveTime");
3345        }
3346        else if (name.equals("quantity")) {
3347          this.quantity = new SimpleQuantity();
3348          return this.quantity;
3349        }
3350        else if (name.equals("unitPrice")) {
3351          this.unitPrice = new Money();
3352          return this.unitPrice;
3353        }
3354        else if (name.equals("factor")) {
3355          throw new FHIRException("Cannot call addChild on a primitive type Contract.factor");
3356        }
3357        else if (name.equals("points")) {
3358          throw new FHIRException("Cannot call addChild on a primitive type Contract.points");
3359        }
3360        else if (name.equals("net")) {
3361          this.net = new Money();
3362          return this.net;
3363        }
3364        else
3365          return super.addChild(name);
3366      }
3367
3368      public TermValuedItemComponent copy() {
3369        TermValuedItemComponent dst = new TermValuedItemComponent();
3370        copyValues(dst);
3371        dst.entity = entity == null ? null : entity.copy();
3372        dst.identifier = identifier == null ? null : identifier.copy();
3373        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
3374        dst.quantity = quantity == null ? null : quantity.copy();
3375        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
3376        dst.factor = factor == null ? null : factor.copy();
3377        dst.points = points == null ? null : points.copy();
3378        dst.net = net == null ? null : net.copy();
3379        return dst;
3380      }
3381
3382      @Override
3383      public boolean equalsDeep(Base other_) {
3384        if (!super.equalsDeep(other_))
3385          return false;
3386        if (!(other_ instanceof TermValuedItemComponent))
3387          return false;
3388        TermValuedItemComponent o = (TermValuedItemComponent) other_;
3389        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
3390           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
3391           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true);
3392      }
3393
3394      @Override
3395      public boolean equalsShallow(Base other_) {
3396        if (!super.equalsShallow(other_))
3397          return false;
3398        if (!(other_ instanceof TermValuedItemComponent))
3399          return false;
3400        TermValuedItemComponent o = (TermValuedItemComponent) other_;
3401        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
3402           && compareValues(points, o.points, true);
3403      }
3404
3405      public boolean isEmpty() {
3406        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
3407          , quantity, unitPrice, factor, points, net);
3408      }
3409
3410  public String fhirType() {
3411    return "Contract.term.valuedItem";
3412
3413  }
3414
3415  }
3416
3417    @Block()
3418    public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
3419        /**
3420         * Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
3421         */
3422        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
3423        @Description(shortDefinition="Easily comprehended representation of this Contract", formalDefinition="Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability." )
3424        protected Type content;
3425
3426        private static final long serialVersionUID = -1763459053L;
3427
3428    /**
3429     * Constructor
3430     */
3431      public FriendlyLanguageComponent() {
3432        super();
3433      }
3434
3435    /**
3436     * Constructor
3437     */
3438      public FriendlyLanguageComponent(Type content) {
3439        super();
3440        this.content = content;
3441      }
3442
3443        /**
3444         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3445         */
3446        public Type getContent() { 
3447          return this.content;
3448        }
3449
3450        /**
3451         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3452         */
3453        public Attachment getContentAttachment() throws FHIRException { 
3454          if (this.content == null)
3455            return null;
3456          if (!(this.content instanceof Attachment))
3457            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
3458          return (Attachment) this.content;
3459        }
3460
3461        public boolean hasContentAttachment() { 
3462          return this != null && this.content instanceof Attachment;
3463        }
3464
3465        /**
3466         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3467         */
3468        public Reference getContentReference() throws FHIRException { 
3469          if (this.content == null)
3470            return null;
3471          if (!(this.content instanceof Reference))
3472            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
3473          return (Reference) this.content;
3474        }
3475
3476        public boolean hasContentReference() { 
3477          return this != null && this.content instanceof Reference;
3478        }
3479
3480        public boolean hasContent() { 
3481          return this.content != null && !this.content.isEmpty();
3482        }
3483
3484        /**
3485         * @param value {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3486         */
3487        public FriendlyLanguageComponent setContent(Type value) throws FHIRFormatError { 
3488          if (value != null && !(value instanceof Attachment || value instanceof Reference))
3489            throw new FHIRFormatError("Not the right type for Contract.friendly.content[x]: "+value.fhirType());
3490          this.content = value;
3491          return this;
3492        }
3493
3494        protected void listChildren(List<Property> children) {
3495          super.listChildren(children);
3496          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content));
3497        }
3498
3499        @Override
3500        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3501          switch (_hash) {
3502          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3503          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3504          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3505          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3506          default: return super.getNamedProperty(_hash, _name, _checkValid);
3507          }
3508
3509        }
3510
3511      @Override
3512      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3513        switch (hash) {
3514        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
3515        default: return super.getProperty(hash, name, checkValid);
3516        }
3517
3518      }
3519
3520      @Override
3521      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3522        switch (hash) {
3523        case 951530617: // content
3524          this.content = castToType(value); // Type
3525          return value;
3526        default: return super.setProperty(hash, name, value);
3527        }
3528
3529      }
3530
3531      @Override
3532      public Base setProperty(String name, Base value) throws FHIRException {
3533        if (name.equals("content[x]")) {
3534          this.content = castToType(value); // Type
3535        } else
3536          return super.setProperty(name, value);
3537        return value;
3538      }
3539
3540      @Override
3541      public Base makeProperty(int hash, String name) throws FHIRException {
3542        switch (hash) {
3543        case 264548711:  return getContent(); 
3544        case 951530617:  return getContent(); 
3545        default: return super.makeProperty(hash, name);
3546        }
3547
3548      }
3549
3550      @Override
3551      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3552        switch (hash) {
3553        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
3554        default: return super.getTypesForProperty(hash, name);
3555        }
3556
3557      }
3558
3559      @Override
3560      public Base addChild(String name) throws FHIRException {
3561        if (name.equals("contentAttachment")) {
3562          this.content = new Attachment();
3563          return this.content;
3564        }
3565        else if (name.equals("contentReference")) {
3566          this.content = new Reference();
3567          return this.content;
3568        }
3569        else
3570          return super.addChild(name);
3571      }
3572
3573      public FriendlyLanguageComponent copy() {
3574        FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
3575        copyValues(dst);
3576        dst.content = content == null ? null : content.copy();
3577        return dst;
3578      }
3579
3580      @Override
3581      public boolean equalsDeep(Base other_) {
3582        if (!super.equalsDeep(other_))
3583          return false;
3584        if (!(other_ instanceof FriendlyLanguageComponent))
3585          return false;
3586        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
3587        return compareDeep(content, o.content, true);
3588      }
3589
3590      @Override
3591      public boolean equalsShallow(Base other_) {
3592        if (!super.equalsShallow(other_))
3593          return false;
3594        if (!(other_ instanceof FriendlyLanguageComponent))
3595          return false;
3596        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
3597        return true;
3598      }
3599
3600      public boolean isEmpty() {
3601        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
3602      }
3603
3604  public String fhirType() {
3605    return "Contract.friendly";
3606
3607  }
3608
3609  }
3610
3611    @Block()
3612    public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
3613        /**
3614         * Contract legal text in human renderable form.
3615         */
3616        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
3617        @Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
3618        protected Type content;
3619
3620        private static final long serialVersionUID = -1763459053L;
3621
3622    /**
3623     * Constructor
3624     */
3625      public LegalLanguageComponent() {
3626        super();
3627      }
3628
3629    /**
3630     * Constructor
3631     */
3632      public LegalLanguageComponent(Type content) {
3633        super();
3634        this.content = content;
3635      }
3636
3637        /**
3638         * @return {@link #content} (Contract legal text in human renderable form.)
3639         */
3640        public Type getContent() { 
3641          return this.content;
3642        }
3643
3644        /**
3645         * @return {@link #content} (Contract legal text in human renderable form.)
3646         */
3647        public Attachment getContentAttachment() throws FHIRException { 
3648          if (this.content == null)
3649            return null;
3650          if (!(this.content instanceof Attachment))
3651            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
3652          return (Attachment) this.content;
3653        }
3654
3655        public boolean hasContentAttachment() { 
3656          return this != null && this.content instanceof Attachment;
3657        }
3658
3659        /**
3660         * @return {@link #content} (Contract legal text in human renderable form.)
3661         */
3662        public Reference getContentReference() throws FHIRException { 
3663          if (this.content == null)
3664            return null;
3665          if (!(this.content instanceof Reference))
3666            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
3667          return (Reference) this.content;
3668        }
3669
3670        public boolean hasContentReference() { 
3671          return this != null && this.content instanceof Reference;
3672        }
3673
3674        public boolean hasContent() { 
3675          return this.content != null && !this.content.isEmpty();
3676        }
3677
3678        /**
3679         * @param value {@link #content} (Contract legal text in human renderable form.)
3680         */
3681        public LegalLanguageComponent setContent(Type value) throws FHIRFormatError { 
3682          if (value != null && !(value instanceof Attachment || value instanceof Reference))
3683            throw new FHIRFormatError("Not the right type for Contract.legal.content[x]: "+value.fhirType());
3684          this.content = value;
3685          return this;
3686        }
3687
3688        protected void listChildren(List<Property> children) {
3689          super.listChildren(children);
3690          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content));
3691        }
3692
3693        @Override
3694        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3695          switch (_hash) {
3696          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3697          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3698          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3699          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3700          default: return super.getNamedProperty(_hash, _name, _checkValid);
3701          }
3702
3703        }
3704
3705      @Override
3706      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3707        switch (hash) {
3708        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
3709        default: return super.getProperty(hash, name, checkValid);
3710        }
3711
3712      }
3713
3714      @Override
3715      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3716        switch (hash) {
3717        case 951530617: // content
3718          this.content = castToType(value); // Type
3719          return value;
3720        default: return super.setProperty(hash, name, value);
3721        }
3722
3723      }
3724
3725      @Override
3726      public Base setProperty(String name, Base value) throws FHIRException {
3727        if (name.equals("content[x]")) {
3728          this.content = castToType(value); // Type
3729        } else
3730          return super.setProperty(name, value);
3731        return value;
3732      }
3733
3734      @Override
3735      public Base makeProperty(int hash, String name) throws FHIRException {
3736        switch (hash) {
3737        case 264548711:  return getContent(); 
3738        case 951530617:  return getContent(); 
3739        default: return super.makeProperty(hash, name);
3740        }
3741
3742      }
3743
3744      @Override
3745      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3746        switch (hash) {
3747        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
3748        default: return super.getTypesForProperty(hash, name);
3749        }
3750
3751      }
3752
3753      @Override
3754      public Base addChild(String name) throws FHIRException {
3755        if (name.equals("contentAttachment")) {
3756          this.content = new Attachment();
3757          return this.content;
3758        }
3759        else if (name.equals("contentReference")) {
3760          this.content = new Reference();
3761          return this.content;
3762        }
3763        else
3764          return super.addChild(name);
3765      }
3766
3767      public LegalLanguageComponent copy() {
3768        LegalLanguageComponent dst = new LegalLanguageComponent();
3769        copyValues(dst);
3770        dst.content = content == null ? null : content.copy();
3771        return dst;
3772      }
3773
3774      @Override
3775      public boolean equalsDeep(Base other_) {
3776        if (!super.equalsDeep(other_))
3777          return false;
3778        if (!(other_ instanceof LegalLanguageComponent))
3779          return false;
3780        LegalLanguageComponent o = (LegalLanguageComponent) other_;
3781        return compareDeep(content, o.content, true);
3782      }
3783
3784      @Override
3785      public boolean equalsShallow(Base other_) {
3786        if (!super.equalsShallow(other_))
3787          return false;
3788        if (!(other_ instanceof LegalLanguageComponent))
3789          return false;
3790        LegalLanguageComponent o = (LegalLanguageComponent) other_;
3791        return true;
3792      }
3793
3794      public boolean isEmpty() {
3795        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
3796      }
3797
3798  public String fhirType() {
3799    return "Contract.legal";
3800
3801  }
3802
3803  }
3804
3805    @Block()
3806    public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
3807        /**
3808         * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).
3809         */
3810        @Child(name = "content", type = {Attachment.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
3811        @Description(shortDefinition="Computable Contract Rules", formalDefinition="Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal)." )
3812        protected Type content;
3813
3814        private static final long serialVersionUID = -1763459053L;
3815
3816    /**
3817     * Constructor
3818     */
3819      public ComputableLanguageComponent() {
3820        super();
3821      }
3822
3823    /**
3824     * Constructor
3825     */
3826      public ComputableLanguageComponent(Type content) {
3827        super();
3828        this.content = content;
3829      }
3830
3831        /**
3832         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3833         */
3834        public Type getContent() { 
3835          return this.content;
3836        }
3837
3838        /**
3839         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3840         */
3841        public Attachment getContentAttachment() throws FHIRException { 
3842          if (this.content == null)
3843            return null;
3844          if (!(this.content instanceof Attachment))
3845            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
3846          return (Attachment) this.content;
3847        }
3848
3849        public boolean hasContentAttachment() { 
3850          return this != null && this.content instanceof Attachment;
3851        }
3852
3853        /**
3854         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3855         */
3856        public Reference getContentReference() throws FHIRException { 
3857          if (this.content == null)
3858            return null;
3859          if (!(this.content instanceof Reference))
3860            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
3861          return (Reference) this.content;
3862        }
3863
3864        public boolean hasContentReference() { 
3865          return this != null && this.content instanceof Reference;
3866        }
3867
3868        public boolean hasContent() { 
3869          return this.content != null && !this.content.isEmpty();
3870        }
3871
3872        /**
3873         * @param value {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3874         */
3875        public ComputableLanguageComponent setContent(Type value) throws FHIRFormatError { 
3876          if (value != null && !(value instanceof Attachment || value instanceof Reference))
3877            throw new FHIRFormatError("Not the right type for Contract.rule.content[x]: "+value.fhirType());
3878          this.content = value;
3879          return this;
3880        }
3881
3882        protected void listChildren(List<Property> children) {
3883          super.listChildren(children);
3884          children.add(new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content));
3885        }
3886
3887        @Override
3888        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3889          switch (_hash) {
3890          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3891          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3892          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3893          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3894          default: return super.getNamedProperty(_hash, _name, _checkValid);
3895          }
3896
3897        }
3898
3899      @Override
3900      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3901        switch (hash) {
3902        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
3903        default: return super.getProperty(hash, name, checkValid);
3904        }
3905
3906      }
3907
3908      @Override
3909      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3910        switch (hash) {
3911        case 951530617: // content
3912          this.content = castToType(value); // Type
3913          return value;
3914        default: return super.setProperty(hash, name, value);
3915        }
3916
3917      }
3918
3919      @Override
3920      public Base setProperty(String name, Base value) throws FHIRException {
3921        if (name.equals("content[x]")) {
3922          this.content = castToType(value); // Type
3923        } else
3924          return super.setProperty(name, value);
3925        return value;
3926      }
3927
3928      @Override
3929      public Base makeProperty(int hash, String name) throws FHIRException {
3930        switch (hash) {
3931        case 264548711:  return getContent(); 
3932        case 951530617:  return getContent(); 
3933        default: return super.makeProperty(hash, name);
3934        }
3935
3936      }
3937
3938      @Override
3939      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3940        switch (hash) {
3941        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
3942        default: return super.getTypesForProperty(hash, name);
3943        }
3944
3945      }
3946
3947      @Override
3948      public Base addChild(String name) throws FHIRException {
3949        if (name.equals("contentAttachment")) {
3950          this.content = new Attachment();
3951          return this.content;
3952        }
3953        else if (name.equals("contentReference")) {
3954          this.content = new Reference();
3955          return this.content;
3956        }
3957        else
3958          return super.addChild(name);
3959      }
3960
3961      public ComputableLanguageComponent copy() {
3962        ComputableLanguageComponent dst = new ComputableLanguageComponent();
3963        copyValues(dst);
3964        dst.content = content == null ? null : content.copy();
3965        return dst;
3966      }
3967
3968      @Override
3969      public boolean equalsDeep(Base other_) {
3970        if (!super.equalsDeep(other_))
3971          return false;
3972        if (!(other_ instanceof ComputableLanguageComponent))
3973          return false;
3974        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
3975        return compareDeep(content, o.content, true);
3976      }
3977
3978      @Override
3979      public boolean equalsShallow(Base other_) {
3980        if (!super.equalsShallow(other_))
3981          return false;
3982        if (!(other_ instanceof ComputableLanguageComponent))
3983          return false;
3984        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
3985        return true;
3986      }
3987
3988      public boolean isEmpty() {
3989        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
3990      }
3991
3992  public String fhirType() {
3993    return "Contract.rule";
3994
3995  }
3996
3997  }
3998
3999    /**
4000     * Unique identifier for this Contract.
4001     */
4002    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
4003    @Description(shortDefinition="Contract number", formalDefinition="Unique identifier for this Contract." )
4004    protected Identifier identifier;
4005
4006    /**
4007     * The status of the resource instance.
4008     */
4009    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
4010    @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated", formalDefinition="The status of the resource instance." )
4011    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-status")
4012    protected Enumeration<ContractStatus> status;
4013
4014    /**
4015     * When this  Contract was issued.
4016     */
4017    @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4018    @Description(shortDefinition="When this Contract was issued", formalDefinition="When this  Contract was issued." )
4019    protected DateTimeType issued;
4020
4021    /**
4022     * Relevant time or time-period when this Contract is applicable.
4023     */
4024    @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
4025    @Description(shortDefinition="Effective time", formalDefinition="Relevant time or time-period when this Contract is applicable." )
4026    protected Period applies;
4027
4028    /**
4029     * The target entity impacted by or of interest to parties to the agreement.
4030     */
4031    @Child(name = "subject", type = {Reference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4032    @Description(shortDefinition="Contract Target Entity", formalDefinition="The target entity impacted by or of interest to parties to the agreement." )
4033    protected List<Reference> subject;
4034    /**
4035     * The actual objects that are the target of the reference (The target entity impacted by or of interest to parties to the agreement.)
4036     */
4037    protected List<Resource> subjectTarget;
4038
4039
4040    /**
4041     * The matter of concern in the context of this agreement.
4042     */
4043    @Child(name = "topic", type = {Reference.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4044    @Description(shortDefinition="Context of the Contract", formalDefinition="The matter of concern in the context of this agreement." )
4045    protected List<Reference> topic;
4046    /**
4047     * The actual objects that are the target of the reference (The matter of concern in the context of this agreement.)
4048     */
4049    protected List<Resource> topicTarget;
4050
4051
4052    /**
4053     * A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.
4054     */
4055    @Child(name = "authority", type = {Organization.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4056    @Description(shortDefinition="Authority under which this Contract has standing", formalDefinition="A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies." )
4057    protected List<Reference> authority;
4058    /**
4059     * The actual objects that are the target of the reference (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
4060     */
4061    protected List<Organization> authorityTarget;
4062
4063
4064    /**
4065     * Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.
4066     */
4067    @Child(name = "domain", type = {Location.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4068    @Description(shortDefinition="Domain in which this Contract applies", formalDefinition="Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources." )
4069    protected List<Reference> domain;
4070    /**
4071     * The actual objects that are the target of the reference (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
4072     */
4073    protected List<Location> domainTarget;
4074
4075
4076    /**
4077     * Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.
4078     */
4079    @Child(name = "type", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
4080    @Description(shortDefinition="Type or form", formalDefinition="Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc." )
4081    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-type")
4082    protected CodeableConcept type;
4083
4084    /**
4085     * More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.
4086     */
4087    @Child(name = "subType", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4088    @Description(shortDefinition="Subtype within the context of type", formalDefinition="More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent." )
4089    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-subtype")
4090    protected List<CodeableConcept> subType;
4091
4092    /**
4093     * Action stipulated by this Contract.
4094     */
4095    @Child(name = "action", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4096    @Description(shortDefinition="Action stipulated by this Contract", formalDefinition="Action stipulated by this Contract." )
4097    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
4098    protected List<CodeableConcept> action;
4099
4100    /**
4101     * Reason for action stipulated by this Contract.
4102     */
4103    @Child(name = "actionReason", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4104    @Description(shortDefinition="Rationale for the stiplulated action", formalDefinition="Reason for action stipulated by this Contract." )
4105    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-PurposeOfUse")
4106    protected List<CodeableConcept> actionReason;
4107
4108    /**
4109     * The type of decision made by a grantor with respect to an offer made by a grantee.
4110     */
4111    @Child(name = "decisionType", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
4112    @Description(shortDefinition="Decision by Grantor", formalDefinition="The type of decision made by a grantor with respect to an offer made by a grantee." )
4113    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActConsentDirective")
4114    protected CodeableConcept decisionType;
4115
4116    /**
4117     * The minimal content derived from the basal information source at a specific stage in its lifecycle.
4118     */
4119    @Child(name = "contentDerivative", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
4120    @Description(shortDefinition="Content derived from the basal information", formalDefinition="The minimal content derived from the basal information source at a specific stage in its lifecycle." )
4121    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-content-derivative")
4122    protected CodeableConcept contentDerivative;
4123
4124    /**
4125     * A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.
4126     */
4127    @Child(name = "securityLabel", type = {Coding.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4128    @Description(shortDefinition="Security Labels that define affected resources", formalDefinition="A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels." )
4129    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
4130    protected List<Coding> securityLabel;
4131
4132    /**
4133     * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
4134     */
4135    @Child(name = "agent", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4136    @Description(shortDefinition="Entity being ascribed responsibility", formalDefinition="An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place." )
4137    protected List<AgentComponent> agent;
4138
4139    /**
4140     * Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.
4141     */
4142    @Child(name = "signer", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4143    @Description(shortDefinition="Contract Signatory", formalDefinition="Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness." )
4144    protected List<SignatoryComponent> signer;
4145
4146    /**
4147     * Contract Valued Item List.
4148     */
4149    @Child(name = "valuedItem", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4150    @Description(shortDefinition="Contract Valued Item List", formalDefinition="Contract Valued Item List." )
4151    protected List<ValuedItemComponent> valuedItem;
4152
4153    /**
4154     * One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.
4155     */
4156    @Child(name = "term", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4157    @Description(shortDefinition="Contract Term List", formalDefinition="One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups." )
4158    protected List<TermComponent> term;
4159
4160    /**
4161     * Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.
4162     */
4163    @Child(name = "binding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=19, min=0, max=1, modifier=false, summary=false)
4164    @Description(shortDefinition="Binding Contract", formalDefinition="Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract." )
4165    protected Type binding;
4166
4167    /**
4168     * The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.
4169     */
4170    @Child(name = "friendly", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4171    @Description(shortDefinition="Contract Friendly Language", formalDefinition="The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement." )
4172    protected List<FriendlyLanguageComponent> friendly;
4173
4174    /**
4175     * List of Legal expressions or representations of this Contract.
4176     */
4177    @Child(name = "legal", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4178    @Description(shortDefinition="Contract Legal Language", formalDefinition="List of Legal expressions or representations of this Contract." )
4179    protected List<LegalLanguageComponent> legal;
4180
4181    /**
4182     * List of Computable Policy Rule Language Representations of this Contract.
4183     */
4184    @Child(name = "rule", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4185    @Description(shortDefinition="Computable Contract Language", formalDefinition="List of Computable Policy Rule Language Representations of this Contract." )
4186    protected List<ComputableLanguageComponent> rule;
4187
4188    private static final long serialVersionUID = -254555038L;
4189
4190  /**
4191   * Constructor
4192   */
4193    public Contract() {
4194      super();
4195    }
4196
4197    /**
4198     * @return {@link #identifier} (Unique identifier for this Contract.)
4199     */
4200    public Identifier getIdentifier() { 
4201      if (this.identifier == null)
4202        if (Configuration.errorOnAutoCreate())
4203          throw new Error("Attempt to auto-create Contract.identifier");
4204        else if (Configuration.doAutoCreate())
4205          this.identifier = new Identifier(); // cc
4206      return this.identifier;
4207    }
4208
4209    public boolean hasIdentifier() { 
4210      return this.identifier != null && !this.identifier.isEmpty();
4211    }
4212
4213    /**
4214     * @param value {@link #identifier} (Unique identifier for this Contract.)
4215     */
4216    public Contract setIdentifier(Identifier value)  { 
4217      this.identifier = value;
4218      return this;
4219    }
4220
4221    /**
4222     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4223     */
4224    public Enumeration<ContractStatus> getStatusElement() { 
4225      if (this.status == null)
4226        if (Configuration.errorOnAutoCreate())
4227          throw new Error("Attempt to auto-create Contract.status");
4228        else if (Configuration.doAutoCreate())
4229          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory()); // bb
4230      return this.status;
4231    }
4232
4233    public boolean hasStatusElement() { 
4234      return this.status != null && !this.status.isEmpty();
4235    }
4236
4237    public boolean hasStatus() { 
4238      return this.status != null && !this.status.isEmpty();
4239    }
4240
4241    /**
4242     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4243     */
4244    public Contract setStatusElement(Enumeration<ContractStatus> value) { 
4245      this.status = value;
4246      return this;
4247    }
4248
4249    /**
4250     * @return The status of the resource instance.
4251     */
4252    public ContractStatus getStatus() { 
4253      return this.status == null ? null : this.status.getValue();
4254    }
4255
4256    /**
4257     * @param value The status of the resource instance.
4258     */
4259    public Contract setStatus(ContractStatus value) { 
4260      if (value == null)
4261        this.status = null;
4262      else {
4263        if (this.status == null)
4264          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory());
4265        this.status.setValue(value);
4266      }
4267      return this;
4268    }
4269
4270    /**
4271     * @return {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
4272     */
4273    public DateTimeType getIssuedElement() { 
4274      if (this.issued == null)
4275        if (Configuration.errorOnAutoCreate())
4276          throw new Error("Attempt to auto-create Contract.issued");
4277        else if (Configuration.doAutoCreate())
4278          this.issued = new DateTimeType(); // bb
4279      return this.issued;
4280    }
4281
4282    public boolean hasIssuedElement() { 
4283      return this.issued != null && !this.issued.isEmpty();
4284    }
4285
4286    public boolean hasIssued() { 
4287      return this.issued != null && !this.issued.isEmpty();
4288    }
4289
4290    /**
4291     * @param value {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
4292     */
4293    public Contract setIssuedElement(DateTimeType value) { 
4294      this.issued = value;
4295      return this;
4296    }
4297
4298    /**
4299     * @return When this  Contract was issued.
4300     */
4301    public Date getIssued() { 
4302      return this.issued == null ? null : this.issued.getValue();
4303    }
4304
4305    /**
4306     * @param value When this  Contract was issued.
4307     */
4308    public Contract setIssued(Date value) { 
4309      if (value == null)
4310        this.issued = null;
4311      else {
4312        if (this.issued == null)
4313          this.issued = new DateTimeType();
4314        this.issued.setValue(value);
4315      }
4316      return this;
4317    }
4318
4319    /**
4320     * @return {@link #applies} (Relevant time or time-period when this Contract is applicable.)
4321     */
4322    public Period getApplies() { 
4323      if (this.applies == null)
4324        if (Configuration.errorOnAutoCreate())
4325          throw new Error("Attempt to auto-create Contract.applies");
4326        else if (Configuration.doAutoCreate())
4327          this.applies = new Period(); // cc
4328      return this.applies;
4329    }
4330
4331    public boolean hasApplies() { 
4332      return this.applies != null && !this.applies.isEmpty();
4333    }
4334
4335    /**
4336     * @param value {@link #applies} (Relevant time or time-period when this Contract is applicable.)
4337     */
4338    public Contract setApplies(Period value)  { 
4339      this.applies = value;
4340      return this;
4341    }
4342
4343    /**
4344     * @return {@link #subject} (The target entity impacted by or of interest to parties to the agreement.)
4345     */
4346    public List<Reference> getSubject() { 
4347      if (this.subject == null)
4348        this.subject = new ArrayList<Reference>();
4349      return this.subject;
4350    }
4351
4352    /**
4353     * @return Returns a reference to <code>this</code> for easy method chaining
4354     */
4355    public Contract setSubject(List<Reference> theSubject) { 
4356      this.subject = theSubject;
4357      return this;
4358    }
4359
4360    public boolean hasSubject() { 
4361      if (this.subject == null)
4362        return false;
4363      for (Reference item : this.subject)
4364        if (!item.isEmpty())
4365          return true;
4366      return false;
4367    }
4368
4369    public Reference addSubject() { //3
4370      Reference t = new Reference();
4371      if (this.subject == null)
4372        this.subject = new ArrayList<Reference>();
4373      this.subject.add(t);
4374      return t;
4375    }
4376
4377    public Contract addSubject(Reference t) { //3
4378      if (t == null)
4379        return this;
4380      if (this.subject == null)
4381        this.subject = new ArrayList<Reference>();
4382      this.subject.add(t);
4383      return this;
4384    }
4385
4386    /**
4387     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
4388     */
4389    public Reference getSubjectFirstRep() { 
4390      if (getSubject().isEmpty()) {
4391        addSubject();
4392      }
4393      return getSubject().get(0);
4394    }
4395
4396    /**
4397     * @deprecated Use Reference#setResource(IBaseResource) instead
4398     */
4399    @Deprecated
4400    public List<Resource> getSubjectTarget() { 
4401      if (this.subjectTarget == null)
4402        this.subjectTarget = new ArrayList<Resource>();
4403      return this.subjectTarget;
4404    }
4405
4406    /**
4407     * @return {@link #topic} (The matter of concern in the context of this agreement.)
4408     */
4409    public List<Reference> getTopic() { 
4410      if (this.topic == null)
4411        this.topic = new ArrayList<Reference>();
4412      return this.topic;
4413    }
4414
4415    /**
4416     * @return Returns a reference to <code>this</code> for easy method chaining
4417     */
4418    public Contract setTopic(List<Reference> theTopic) { 
4419      this.topic = theTopic;
4420      return this;
4421    }
4422
4423    public boolean hasTopic() { 
4424      if (this.topic == null)
4425        return false;
4426      for (Reference item : this.topic)
4427        if (!item.isEmpty())
4428          return true;
4429      return false;
4430    }
4431
4432    public Reference addTopic() { //3
4433      Reference t = new Reference();
4434      if (this.topic == null)
4435        this.topic = new ArrayList<Reference>();
4436      this.topic.add(t);
4437      return t;
4438    }
4439
4440    public Contract addTopic(Reference t) { //3
4441      if (t == null)
4442        return this;
4443      if (this.topic == null)
4444        this.topic = new ArrayList<Reference>();
4445      this.topic.add(t);
4446      return this;
4447    }
4448
4449    /**
4450     * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist
4451     */
4452    public Reference getTopicFirstRep() { 
4453      if (getTopic().isEmpty()) {
4454        addTopic();
4455      }
4456      return getTopic().get(0);
4457    }
4458
4459    /**
4460     * @deprecated Use Reference#setResource(IBaseResource) instead
4461     */
4462    @Deprecated
4463    public List<Resource> getTopicTarget() { 
4464      if (this.topicTarget == null)
4465        this.topicTarget = new ArrayList<Resource>();
4466      return this.topicTarget;
4467    }
4468
4469    /**
4470     * @return {@link #authority} (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
4471     */
4472    public List<Reference> getAuthority() { 
4473      if (this.authority == null)
4474        this.authority = new ArrayList<Reference>();
4475      return this.authority;
4476    }
4477
4478    /**
4479     * @return Returns a reference to <code>this</code> for easy method chaining
4480     */
4481    public Contract setAuthority(List<Reference> theAuthority) { 
4482      this.authority = theAuthority;
4483      return this;
4484    }
4485
4486    public boolean hasAuthority() { 
4487      if (this.authority == null)
4488        return false;
4489      for (Reference item : this.authority)
4490        if (!item.isEmpty())
4491          return true;
4492      return false;
4493    }
4494
4495    public Reference addAuthority() { //3
4496      Reference t = new Reference();
4497      if (this.authority == null)
4498        this.authority = new ArrayList<Reference>();
4499      this.authority.add(t);
4500      return t;
4501    }
4502
4503    public Contract addAuthority(Reference t) { //3
4504      if (t == null)
4505        return this;
4506      if (this.authority == null)
4507        this.authority = new ArrayList<Reference>();
4508      this.authority.add(t);
4509      return this;
4510    }
4511
4512    /**
4513     * @return The first repetition of repeating field {@link #authority}, creating it if it does not already exist
4514     */
4515    public Reference getAuthorityFirstRep() { 
4516      if (getAuthority().isEmpty()) {
4517        addAuthority();
4518      }
4519      return getAuthority().get(0);
4520    }
4521
4522    /**
4523     * @deprecated Use Reference#setResource(IBaseResource) instead
4524     */
4525    @Deprecated
4526    public List<Organization> getAuthorityTarget() { 
4527      if (this.authorityTarget == null)
4528        this.authorityTarget = new ArrayList<Organization>();
4529      return this.authorityTarget;
4530    }
4531
4532    /**
4533     * @deprecated Use Reference#setResource(IBaseResource) instead
4534     */
4535    @Deprecated
4536    public Organization addAuthorityTarget() { 
4537      Organization r = new Organization();
4538      if (this.authorityTarget == null)
4539        this.authorityTarget = new ArrayList<Organization>();
4540      this.authorityTarget.add(r);
4541      return r;
4542    }
4543
4544    /**
4545     * @return {@link #domain} (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
4546     */
4547    public List<Reference> getDomain() { 
4548      if (this.domain == null)
4549        this.domain = new ArrayList<Reference>();
4550      return this.domain;
4551    }
4552
4553    /**
4554     * @return Returns a reference to <code>this</code> for easy method chaining
4555     */
4556    public Contract setDomain(List<Reference> theDomain) { 
4557      this.domain = theDomain;
4558      return this;
4559    }
4560
4561    public boolean hasDomain() { 
4562      if (this.domain == null)
4563        return false;
4564      for (Reference item : this.domain)
4565        if (!item.isEmpty())
4566          return true;
4567      return false;
4568    }
4569
4570    public Reference addDomain() { //3
4571      Reference t = new Reference();
4572      if (this.domain == null)
4573        this.domain = new ArrayList<Reference>();
4574      this.domain.add(t);
4575      return t;
4576    }
4577
4578    public Contract addDomain(Reference t) { //3
4579      if (t == null)
4580        return this;
4581      if (this.domain == null)
4582        this.domain = new ArrayList<Reference>();
4583      this.domain.add(t);
4584      return this;
4585    }
4586
4587    /**
4588     * @return The first repetition of repeating field {@link #domain}, creating it if it does not already exist
4589     */
4590    public Reference getDomainFirstRep() { 
4591      if (getDomain().isEmpty()) {
4592        addDomain();
4593      }
4594      return getDomain().get(0);
4595    }
4596
4597    /**
4598     * @deprecated Use Reference#setResource(IBaseResource) instead
4599     */
4600    @Deprecated
4601    public List<Location> getDomainTarget() { 
4602      if (this.domainTarget == null)
4603        this.domainTarget = new ArrayList<Location>();
4604      return this.domainTarget;
4605    }
4606
4607    /**
4608     * @deprecated Use Reference#setResource(IBaseResource) instead
4609     */
4610    @Deprecated
4611    public Location addDomainTarget() { 
4612      Location r = new Location();
4613      if (this.domainTarget == null)
4614        this.domainTarget = new ArrayList<Location>();
4615      this.domainTarget.add(r);
4616      return r;
4617    }
4618
4619    /**
4620     * @return {@link #type} (Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.)
4621     */
4622    public CodeableConcept getType() { 
4623      if (this.type == null)
4624        if (Configuration.errorOnAutoCreate())
4625          throw new Error("Attempt to auto-create Contract.type");
4626        else if (Configuration.doAutoCreate())
4627          this.type = new CodeableConcept(); // cc
4628      return this.type;
4629    }
4630
4631    public boolean hasType() { 
4632      return this.type != null && !this.type.isEmpty();
4633    }
4634
4635    /**
4636     * @param value {@link #type} (Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.)
4637     */
4638    public Contract setType(CodeableConcept value)  { 
4639      this.type = value;
4640      return this;
4641    }
4642
4643    /**
4644     * @return {@link #subType} (More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.)
4645     */
4646    public List<CodeableConcept> getSubType() { 
4647      if (this.subType == null)
4648        this.subType = new ArrayList<CodeableConcept>();
4649      return this.subType;
4650    }
4651
4652    /**
4653     * @return Returns a reference to <code>this</code> for easy method chaining
4654     */
4655    public Contract setSubType(List<CodeableConcept> theSubType) { 
4656      this.subType = theSubType;
4657      return this;
4658    }
4659
4660    public boolean hasSubType() { 
4661      if (this.subType == null)
4662        return false;
4663      for (CodeableConcept item : this.subType)
4664        if (!item.isEmpty())
4665          return true;
4666      return false;
4667    }
4668
4669    public CodeableConcept addSubType() { //3
4670      CodeableConcept t = new CodeableConcept();
4671      if (this.subType == null)
4672        this.subType = new ArrayList<CodeableConcept>();
4673      this.subType.add(t);
4674      return t;
4675    }
4676
4677    public Contract addSubType(CodeableConcept t) { //3
4678      if (t == null)
4679        return this;
4680      if (this.subType == null)
4681        this.subType = new ArrayList<CodeableConcept>();
4682      this.subType.add(t);
4683      return this;
4684    }
4685
4686    /**
4687     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
4688     */
4689    public CodeableConcept getSubTypeFirstRep() { 
4690      if (getSubType().isEmpty()) {
4691        addSubType();
4692      }
4693      return getSubType().get(0);
4694    }
4695
4696    /**
4697     * @return {@link #action} (Action stipulated by this Contract.)
4698     */
4699    public List<CodeableConcept> getAction() { 
4700      if (this.action == null)
4701        this.action = new ArrayList<CodeableConcept>();
4702      return this.action;
4703    }
4704
4705    /**
4706     * @return Returns a reference to <code>this</code> for easy method chaining
4707     */
4708    public Contract setAction(List<CodeableConcept> theAction) { 
4709      this.action = theAction;
4710      return this;
4711    }
4712
4713    public boolean hasAction() { 
4714      if (this.action == null)
4715        return false;
4716      for (CodeableConcept item : this.action)
4717        if (!item.isEmpty())
4718          return true;
4719      return false;
4720    }
4721
4722    public CodeableConcept addAction() { //3
4723      CodeableConcept t = new CodeableConcept();
4724      if (this.action == null)
4725        this.action = new ArrayList<CodeableConcept>();
4726      this.action.add(t);
4727      return t;
4728    }
4729
4730    public Contract addAction(CodeableConcept t) { //3
4731      if (t == null)
4732        return this;
4733      if (this.action == null)
4734        this.action = new ArrayList<CodeableConcept>();
4735      this.action.add(t);
4736      return this;
4737    }
4738
4739    /**
4740     * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
4741     */
4742    public CodeableConcept getActionFirstRep() { 
4743      if (getAction().isEmpty()) {
4744        addAction();
4745      }
4746      return getAction().get(0);
4747    }
4748
4749    /**
4750     * @return {@link #actionReason} (Reason for action stipulated by this Contract.)
4751     */
4752    public List<CodeableConcept> getActionReason() { 
4753      if (this.actionReason == null)
4754        this.actionReason = new ArrayList<CodeableConcept>();
4755      return this.actionReason;
4756    }
4757
4758    /**
4759     * @return Returns a reference to <code>this</code> for easy method chaining
4760     */
4761    public Contract setActionReason(List<CodeableConcept> theActionReason) { 
4762      this.actionReason = theActionReason;
4763      return this;
4764    }
4765
4766    public boolean hasActionReason() { 
4767      if (this.actionReason == null)
4768        return false;
4769      for (CodeableConcept item : this.actionReason)
4770        if (!item.isEmpty())
4771          return true;
4772      return false;
4773    }
4774
4775    public CodeableConcept addActionReason() { //3
4776      CodeableConcept t = new CodeableConcept();
4777      if (this.actionReason == null)
4778        this.actionReason = new ArrayList<CodeableConcept>();
4779      this.actionReason.add(t);
4780      return t;
4781    }
4782
4783    public Contract addActionReason(CodeableConcept t) { //3
4784      if (t == null)
4785        return this;
4786      if (this.actionReason == null)
4787        this.actionReason = new ArrayList<CodeableConcept>();
4788      this.actionReason.add(t);
4789      return this;
4790    }
4791
4792    /**
4793     * @return The first repetition of repeating field {@link #actionReason}, creating it if it does not already exist
4794     */
4795    public CodeableConcept getActionReasonFirstRep() { 
4796      if (getActionReason().isEmpty()) {
4797        addActionReason();
4798      }
4799      return getActionReason().get(0);
4800    }
4801
4802    /**
4803     * @return {@link #decisionType} (The type of decision made by a grantor with respect to an offer made by a grantee.)
4804     */
4805    public CodeableConcept getDecisionType() { 
4806      if (this.decisionType == null)
4807        if (Configuration.errorOnAutoCreate())
4808          throw new Error("Attempt to auto-create Contract.decisionType");
4809        else if (Configuration.doAutoCreate())
4810          this.decisionType = new CodeableConcept(); // cc
4811      return this.decisionType;
4812    }
4813
4814    public boolean hasDecisionType() { 
4815      return this.decisionType != null && !this.decisionType.isEmpty();
4816    }
4817
4818    /**
4819     * @param value {@link #decisionType} (The type of decision made by a grantor with respect to an offer made by a grantee.)
4820     */
4821    public Contract setDecisionType(CodeableConcept value)  { 
4822      this.decisionType = value;
4823      return this;
4824    }
4825
4826    /**
4827     * @return {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
4828     */
4829    public CodeableConcept getContentDerivative() { 
4830      if (this.contentDerivative == null)
4831        if (Configuration.errorOnAutoCreate())
4832          throw new Error("Attempt to auto-create Contract.contentDerivative");
4833        else if (Configuration.doAutoCreate())
4834          this.contentDerivative = new CodeableConcept(); // cc
4835      return this.contentDerivative;
4836    }
4837
4838    public boolean hasContentDerivative() { 
4839      return this.contentDerivative != null && !this.contentDerivative.isEmpty();
4840    }
4841
4842    /**
4843     * @param value {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
4844     */
4845    public Contract setContentDerivative(CodeableConcept value)  { 
4846      this.contentDerivative = value;
4847      return this;
4848    }
4849
4850    /**
4851     * @return {@link #securityLabel} (A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.)
4852     */
4853    public List<Coding> getSecurityLabel() { 
4854      if (this.securityLabel == null)
4855        this.securityLabel = new ArrayList<Coding>();
4856      return this.securityLabel;
4857    }
4858
4859    /**
4860     * @return Returns a reference to <code>this</code> for easy method chaining
4861     */
4862    public Contract setSecurityLabel(List<Coding> theSecurityLabel) { 
4863      this.securityLabel = theSecurityLabel;
4864      return this;
4865    }
4866
4867    public boolean hasSecurityLabel() { 
4868      if (this.securityLabel == null)
4869        return false;
4870      for (Coding item : this.securityLabel)
4871        if (!item.isEmpty())
4872          return true;
4873      return false;
4874    }
4875
4876    public Coding addSecurityLabel() { //3
4877      Coding t = new Coding();
4878      if (this.securityLabel == null)
4879        this.securityLabel = new ArrayList<Coding>();
4880      this.securityLabel.add(t);
4881      return t;
4882    }
4883
4884    public Contract addSecurityLabel(Coding t) { //3
4885      if (t == null)
4886        return this;
4887      if (this.securityLabel == null)
4888        this.securityLabel = new ArrayList<Coding>();
4889      this.securityLabel.add(t);
4890      return this;
4891    }
4892
4893    /**
4894     * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist
4895     */
4896    public Coding getSecurityLabelFirstRep() { 
4897      if (getSecurityLabel().isEmpty()) {
4898        addSecurityLabel();
4899      }
4900      return getSecurityLabel().get(0);
4901    }
4902
4903    /**
4904     * @return {@link #agent} (An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.)
4905     */
4906    public List<AgentComponent> getAgent() { 
4907      if (this.agent == null)
4908        this.agent = new ArrayList<AgentComponent>();
4909      return this.agent;
4910    }
4911
4912    /**
4913     * @return Returns a reference to <code>this</code> for easy method chaining
4914     */
4915    public Contract setAgent(List<AgentComponent> theAgent) { 
4916      this.agent = theAgent;
4917      return this;
4918    }
4919
4920    public boolean hasAgent() { 
4921      if (this.agent == null)
4922        return false;
4923      for (AgentComponent item : this.agent)
4924        if (!item.isEmpty())
4925          return true;
4926      return false;
4927    }
4928
4929    public AgentComponent addAgent() { //3
4930      AgentComponent t = new AgentComponent();
4931      if (this.agent == null)
4932        this.agent = new ArrayList<AgentComponent>();
4933      this.agent.add(t);
4934      return t;
4935    }
4936
4937    public Contract addAgent(AgentComponent t) { //3
4938      if (t == null)
4939        return this;
4940      if (this.agent == null)
4941        this.agent = new ArrayList<AgentComponent>();
4942      this.agent.add(t);
4943      return this;
4944    }
4945
4946    /**
4947     * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist
4948     */
4949    public AgentComponent getAgentFirstRep() { 
4950      if (getAgent().isEmpty()) {
4951        addAgent();
4952      }
4953      return getAgent().get(0);
4954    }
4955
4956    /**
4957     * @return {@link #signer} (Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.)
4958     */
4959    public List<SignatoryComponent> getSigner() { 
4960      if (this.signer == null)
4961        this.signer = new ArrayList<SignatoryComponent>();
4962      return this.signer;
4963    }
4964
4965    /**
4966     * @return Returns a reference to <code>this</code> for easy method chaining
4967     */
4968    public Contract setSigner(List<SignatoryComponent> theSigner) { 
4969      this.signer = theSigner;
4970      return this;
4971    }
4972
4973    public boolean hasSigner() { 
4974      if (this.signer == null)
4975        return false;
4976      for (SignatoryComponent item : this.signer)
4977        if (!item.isEmpty())
4978          return true;
4979      return false;
4980    }
4981
4982    public SignatoryComponent addSigner() { //3
4983      SignatoryComponent t = new SignatoryComponent();
4984      if (this.signer == null)
4985        this.signer = new ArrayList<SignatoryComponent>();
4986      this.signer.add(t);
4987      return t;
4988    }
4989
4990    public Contract addSigner(SignatoryComponent t) { //3
4991      if (t == null)
4992        return this;
4993      if (this.signer == null)
4994        this.signer = new ArrayList<SignatoryComponent>();
4995      this.signer.add(t);
4996      return this;
4997    }
4998
4999    /**
5000     * @return The first repetition of repeating field {@link #signer}, creating it if it does not already exist
5001     */
5002    public SignatoryComponent getSignerFirstRep() { 
5003      if (getSigner().isEmpty()) {
5004        addSigner();
5005      }
5006      return getSigner().get(0);
5007    }
5008
5009    /**
5010     * @return {@link #valuedItem} (Contract Valued Item List.)
5011     */
5012    public List<ValuedItemComponent> getValuedItem() { 
5013      if (this.valuedItem == null)
5014        this.valuedItem = new ArrayList<ValuedItemComponent>();
5015      return this.valuedItem;
5016    }
5017
5018    /**
5019     * @return Returns a reference to <code>this</code> for easy method chaining
5020     */
5021    public Contract setValuedItem(List<ValuedItemComponent> theValuedItem) { 
5022      this.valuedItem = theValuedItem;
5023      return this;
5024    }
5025
5026    public boolean hasValuedItem() { 
5027      if (this.valuedItem == null)
5028        return false;
5029      for (ValuedItemComponent item : this.valuedItem)
5030        if (!item.isEmpty())
5031          return true;
5032      return false;
5033    }
5034
5035    public ValuedItemComponent addValuedItem() { //3
5036      ValuedItemComponent t = new ValuedItemComponent();
5037      if (this.valuedItem == null)
5038        this.valuedItem = new ArrayList<ValuedItemComponent>();
5039      this.valuedItem.add(t);
5040      return t;
5041    }
5042
5043    public Contract addValuedItem(ValuedItemComponent t) { //3
5044      if (t == null)
5045        return this;
5046      if (this.valuedItem == null)
5047        this.valuedItem = new ArrayList<ValuedItemComponent>();
5048      this.valuedItem.add(t);
5049      return this;
5050    }
5051
5052    /**
5053     * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist
5054     */
5055    public ValuedItemComponent getValuedItemFirstRep() { 
5056      if (getValuedItem().isEmpty()) {
5057        addValuedItem();
5058      }
5059      return getValuedItem().get(0);
5060    }
5061
5062    /**
5063     * @return {@link #term} (One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.)
5064     */
5065    public List<TermComponent> getTerm() { 
5066      if (this.term == null)
5067        this.term = new ArrayList<TermComponent>();
5068      return this.term;
5069    }
5070
5071    /**
5072     * @return Returns a reference to <code>this</code> for easy method chaining
5073     */
5074    public Contract setTerm(List<TermComponent> theTerm) { 
5075      this.term = theTerm;
5076      return this;
5077    }
5078
5079    public boolean hasTerm() { 
5080      if (this.term == null)
5081        return false;
5082      for (TermComponent item : this.term)
5083        if (!item.isEmpty())
5084          return true;
5085      return false;
5086    }
5087
5088    public TermComponent addTerm() { //3
5089      TermComponent t = new TermComponent();
5090      if (this.term == null)
5091        this.term = new ArrayList<TermComponent>();
5092      this.term.add(t);
5093      return t;
5094    }
5095
5096    public Contract addTerm(TermComponent t) { //3
5097      if (t == null)
5098        return this;
5099      if (this.term == null)
5100        this.term = new ArrayList<TermComponent>();
5101      this.term.add(t);
5102      return this;
5103    }
5104
5105    /**
5106     * @return The first repetition of repeating field {@link #term}, creating it if it does not already exist
5107     */
5108    public TermComponent getTermFirstRep() { 
5109      if (getTerm().isEmpty()) {
5110        addTerm();
5111      }
5112      return getTerm().get(0);
5113    }
5114
5115    /**
5116     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5117     */
5118    public Type getBinding() { 
5119      return this.binding;
5120    }
5121
5122    /**
5123     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5124     */
5125    public Attachment getBindingAttachment() throws FHIRException { 
5126      if (this.binding == null)
5127        return null;
5128      if (!(this.binding instanceof Attachment))
5129        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.binding.getClass().getName()+" was encountered");
5130      return (Attachment) this.binding;
5131    }
5132
5133    public boolean hasBindingAttachment() { 
5134      return this != null && this.binding instanceof Attachment;
5135    }
5136
5137    /**
5138     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5139     */
5140    public Reference getBindingReference() throws FHIRException { 
5141      if (this.binding == null)
5142        return null;
5143      if (!(this.binding instanceof Reference))
5144        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.binding.getClass().getName()+" was encountered");
5145      return (Reference) this.binding;
5146    }
5147
5148    public boolean hasBindingReference() { 
5149      return this != null && this.binding instanceof Reference;
5150    }
5151
5152    public boolean hasBinding() { 
5153      return this.binding != null && !this.binding.isEmpty();
5154    }
5155
5156    /**
5157     * @param value {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5158     */
5159    public Contract setBinding(Type value) throws FHIRFormatError { 
5160      if (value != null && !(value instanceof Attachment || value instanceof Reference))
5161        throw new FHIRFormatError("Not the right type for Contract.binding[x]: "+value.fhirType());
5162      this.binding = value;
5163      return this;
5164    }
5165
5166    /**
5167     * @return {@link #friendly} (The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.)
5168     */
5169    public List<FriendlyLanguageComponent> getFriendly() { 
5170      if (this.friendly == null)
5171        this.friendly = new ArrayList<FriendlyLanguageComponent>();
5172      return this.friendly;
5173    }
5174
5175    /**
5176     * @return Returns a reference to <code>this</code> for easy method chaining
5177     */
5178    public Contract setFriendly(List<FriendlyLanguageComponent> theFriendly) { 
5179      this.friendly = theFriendly;
5180      return this;
5181    }
5182
5183    public boolean hasFriendly() { 
5184      if (this.friendly == null)
5185        return false;
5186      for (FriendlyLanguageComponent item : this.friendly)
5187        if (!item.isEmpty())
5188          return true;
5189      return false;
5190    }
5191
5192    public FriendlyLanguageComponent addFriendly() { //3
5193      FriendlyLanguageComponent t = new FriendlyLanguageComponent();
5194      if (this.friendly == null)
5195        this.friendly = new ArrayList<FriendlyLanguageComponent>();
5196      this.friendly.add(t);
5197      return t;
5198    }
5199
5200    public Contract addFriendly(FriendlyLanguageComponent t) { //3
5201      if (t == null)
5202        return this;
5203      if (this.friendly == null)
5204        this.friendly = new ArrayList<FriendlyLanguageComponent>();
5205      this.friendly.add(t);
5206      return this;
5207    }
5208
5209    /**
5210     * @return The first repetition of repeating field {@link #friendly}, creating it if it does not already exist
5211     */
5212    public FriendlyLanguageComponent getFriendlyFirstRep() { 
5213      if (getFriendly().isEmpty()) {
5214        addFriendly();
5215      }
5216      return getFriendly().get(0);
5217    }
5218
5219    /**
5220     * @return {@link #legal} (List of Legal expressions or representations of this Contract.)
5221     */
5222    public List<LegalLanguageComponent> getLegal() { 
5223      if (this.legal == null)
5224        this.legal = new ArrayList<LegalLanguageComponent>();
5225      return this.legal;
5226    }
5227
5228    /**
5229     * @return Returns a reference to <code>this</code> for easy method chaining
5230     */
5231    public Contract setLegal(List<LegalLanguageComponent> theLegal) { 
5232      this.legal = theLegal;
5233      return this;
5234    }
5235
5236    public boolean hasLegal() { 
5237      if (this.legal == null)
5238        return false;
5239      for (LegalLanguageComponent item : this.legal)
5240        if (!item.isEmpty())
5241          return true;
5242      return false;
5243    }
5244
5245    public LegalLanguageComponent addLegal() { //3
5246      LegalLanguageComponent t = new LegalLanguageComponent();
5247      if (this.legal == null)
5248        this.legal = new ArrayList<LegalLanguageComponent>();
5249      this.legal.add(t);
5250      return t;
5251    }
5252
5253    public Contract addLegal(LegalLanguageComponent t) { //3
5254      if (t == null)
5255        return this;
5256      if (this.legal == null)
5257        this.legal = new ArrayList<LegalLanguageComponent>();
5258      this.legal.add(t);
5259      return this;
5260    }
5261
5262    /**
5263     * @return The first repetition of repeating field {@link #legal}, creating it if it does not already exist
5264     */
5265    public LegalLanguageComponent getLegalFirstRep() { 
5266      if (getLegal().isEmpty()) {
5267        addLegal();
5268      }
5269      return getLegal().get(0);
5270    }
5271
5272    /**
5273     * @return {@link #rule} (List of Computable Policy Rule Language Representations of this Contract.)
5274     */
5275    public List<ComputableLanguageComponent> getRule() { 
5276      if (this.rule == null)
5277        this.rule = new ArrayList<ComputableLanguageComponent>();
5278      return this.rule;
5279    }
5280
5281    /**
5282     * @return Returns a reference to <code>this</code> for easy method chaining
5283     */
5284    public Contract setRule(List<ComputableLanguageComponent> theRule) { 
5285      this.rule = theRule;
5286      return this;
5287    }
5288
5289    public boolean hasRule() { 
5290      if (this.rule == null)
5291        return false;
5292      for (ComputableLanguageComponent item : this.rule)
5293        if (!item.isEmpty())
5294          return true;
5295      return false;
5296    }
5297
5298    public ComputableLanguageComponent addRule() { //3
5299      ComputableLanguageComponent t = new ComputableLanguageComponent();
5300      if (this.rule == null)
5301        this.rule = new ArrayList<ComputableLanguageComponent>();
5302      this.rule.add(t);
5303      return t;
5304    }
5305
5306    public Contract addRule(ComputableLanguageComponent t) { //3
5307      if (t == null)
5308        return this;
5309      if (this.rule == null)
5310        this.rule = new ArrayList<ComputableLanguageComponent>();
5311      this.rule.add(t);
5312      return this;
5313    }
5314
5315    /**
5316     * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
5317     */
5318    public ComputableLanguageComponent getRuleFirstRep() { 
5319      if (getRule().isEmpty()) {
5320        addRule();
5321      }
5322      return getRule().get(0);
5323    }
5324
5325      protected void listChildren(List<Property> children) {
5326        super.listChildren(children);
5327        children.add(new Property("identifier", "Identifier", "Unique identifier for this Contract.", 0, 1, identifier));
5328        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
5329        children.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued));
5330        children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies));
5331        children.add(new Property("subject", "Reference(Any)", "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE, subject));
5332        children.add(new Property("topic", "Reference(Any)", "The matter of concern in the context of this agreement.", 0, java.lang.Integer.MAX_VALUE, topic));
5333        children.add(new Property("authority", "Reference(Organization)", "A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.", 0, java.lang.Integer.MAX_VALUE, authority));
5334        children.add(new Property("domain", "Reference(Location)", "Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.", 0, java.lang.Integer.MAX_VALUE, domain));
5335        children.add(new Property("type", "CodeableConcept", "Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.", 0, 1, type));
5336        children.add(new Property("subType", "CodeableConcept", "More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.", 0, java.lang.Integer.MAX_VALUE, subType));
5337        children.add(new Property("action", "CodeableConcept", "Action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, action));
5338        children.add(new Property("actionReason", "CodeableConcept", "Reason for action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, actionReason));
5339        children.add(new Property("decisionType", "CodeableConcept", "The type of decision made by a grantor with respect to an offer made by a grantee.", 0, 1, decisionType));
5340        children.add(new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative));
5341        children.add(new Property("securityLabel", "Coding", "A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
5342        children.add(new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent));
5343        children.add(new Property("signer", "", "Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.", 0, java.lang.Integer.MAX_VALUE, signer));
5344        children.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
5345        children.add(new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term));
5346        children.add(new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding));
5347        children.add(new Property("friendly", "", "The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly));
5348        children.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal));
5349        children.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule));
5350      }
5351
5352      @Override
5353      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5354        switch (_hash) {
5355        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this Contract.", 0, 1, identifier);
5356        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
5357        case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued);
5358        case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies);
5359        case -1867885268: /*subject*/  return new Property("subject", "Reference(Any)", "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE, subject);
5360        case 110546223: /*topic*/  return new Property("topic", "Reference(Any)", "The matter of concern in the context of this agreement.", 0, java.lang.Integer.MAX_VALUE, topic);
5361        case 1475610435: /*authority*/  return new Property("authority", "Reference(Organization)", "A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.", 0, java.lang.Integer.MAX_VALUE, authority);
5362        case -1326197564: /*domain*/  return new Property("domain", "Reference(Location)", "Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.", 0, java.lang.Integer.MAX_VALUE, domain);
5363        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.", 0, 1, type);
5364        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.", 0, java.lang.Integer.MAX_VALUE, subType);
5365        case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "Action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, action);
5366        case 1465121818: /*actionReason*/  return new Property("actionReason", "CodeableConcept", "Reason for action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, actionReason);
5367        case 676128054: /*decisionType*/  return new Property("decisionType", "CodeableConcept", "The type of decision made by a grantor with respect to an offer made by a grantee.", 0, 1, decisionType);
5368        case -92412192: /*contentDerivative*/  return new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative);
5369        case -722296940: /*securityLabel*/  return new Property("securityLabel", "Coding", "A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.", 0, java.lang.Integer.MAX_VALUE, securityLabel);
5370        case 92750597: /*agent*/  return new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent);
5371        case -902467798: /*signer*/  return new Property("signer", "", "Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.", 0, java.lang.Integer.MAX_VALUE, signer);
5372        case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
5373        case 3556460: /*term*/  return new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term);
5374        case 1514826715: /*binding[x]*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5375        case -108220795: /*binding*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5376        case 1218789768: /*bindingAttachment*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5377        case 424425030: /*bindingReference*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5378        case -1423054677: /*friendly*/  return new Property("friendly", "", "The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly);
5379        case 102851257: /*legal*/  return new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal);
5380        case 3512060: /*rule*/  return new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule);
5381        default: return super.getNamedProperty(_hash, _name, _checkValid);
5382        }
5383
5384      }
5385
5386      @Override
5387      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5388        switch (hash) {
5389        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
5390        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ContractStatus>
5391        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
5392        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
5393        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
5394        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : this.topic.toArray(new Base[this.topic.size()]); // Reference
5395        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : this.authority.toArray(new Base[this.authority.size()]); // Reference
5396        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // Reference
5397        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
5398        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
5399        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // CodeableConcept
5400        case 1465121818: /*actionReason*/ return this.actionReason == null ? new Base[0] : this.actionReason.toArray(new Base[this.actionReason.size()]); // CodeableConcept
5401        case 676128054: /*decisionType*/ return this.decisionType == null ? new Base[0] : new Base[] {this.decisionType}; // CodeableConcept
5402        case -92412192: /*contentDerivative*/ return this.contentDerivative == null ? new Base[0] : new Base[] {this.contentDerivative}; // CodeableConcept
5403        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // Coding
5404        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // AgentComponent
5405        case -902467798: /*signer*/ return this.signer == null ? new Base[0] : this.signer.toArray(new Base[this.signer.size()]); // SignatoryComponent
5406        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
5407        case 3556460: /*term*/ return this.term == null ? new Base[0] : this.term.toArray(new Base[this.term.size()]); // TermComponent
5408        case -108220795: /*binding*/ return this.binding == null ? new Base[0] : new Base[] {this.binding}; // Type
5409        case -1423054677: /*friendly*/ return this.friendly == null ? new Base[0] : this.friendly.toArray(new Base[this.friendly.size()]); // FriendlyLanguageComponent
5410        case 102851257: /*legal*/ return this.legal == null ? new Base[0] : this.legal.toArray(new Base[this.legal.size()]); // LegalLanguageComponent
5411        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // ComputableLanguageComponent
5412        default: return super.getProperty(hash, name, checkValid);
5413        }
5414
5415      }
5416
5417      @Override
5418      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5419        switch (hash) {
5420        case -1618432855: // identifier
5421          this.identifier = castToIdentifier(value); // Identifier
5422          return value;
5423        case -892481550: // status
5424          value = new ContractStatusEnumFactory().fromType(castToCode(value));
5425          this.status = (Enumeration) value; // Enumeration<ContractStatus>
5426          return value;
5427        case -1179159893: // issued
5428          this.issued = castToDateTime(value); // DateTimeType
5429          return value;
5430        case -793235316: // applies
5431          this.applies = castToPeriod(value); // Period
5432          return value;
5433        case -1867885268: // subject
5434          this.getSubject().add(castToReference(value)); // Reference
5435          return value;
5436        case 110546223: // topic
5437          this.getTopic().add(castToReference(value)); // Reference
5438          return value;
5439        case 1475610435: // authority
5440          this.getAuthority().add(castToReference(value)); // Reference
5441          return value;
5442        case -1326197564: // domain
5443          this.getDomain().add(castToReference(value)); // Reference
5444          return value;
5445        case 3575610: // type
5446          this.type = castToCodeableConcept(value); // CodeableConcept
5447          return value;
5448        case -1868521062: // subType
5449          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
5450          return value;
5451        case -1422950858: // action
5452          this.getAction().add(castToCodeableConcept(value)); // CodeableConcept
5453          return value;
5454        case 1465121818: // actionReason
5455          this.getActionReason().add(castToCodeableConcept(value)); // CodeableConcept
5456          return value;
5457        case 676128054: // decisionType
5458          this.decisionType = castToCodeableConcept(value); // CodeableConcept
5459          return value;
5460        case -92412192: // contentDerivative
5461          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
5462          return value;
5463        case -722296940: // securityLabel
5464          this.getSecurityLabel().add(castToCoding(value)); // Coding
5465          return value;
5466        case 92750597: // agent
5467          this.getAgent().add((AgentComponent) value); // AgentComponent
5468          return value;
5469        case -902467798: // signer
5470          this.getSigner().add((SignatoryComponent) value); // SignatoryComponent
5471          return value;
5472        case 2046675654: // valuedItem
5473          this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
5474          return value;
5475        case 3556460: // term
5476          this.getTerm().add((TermComponent) value); // TermComponent
5477          return value;
5478        case -108220795: // binding
5479          this.binding = castToType(value); // Type
5480          return value;
5481        case -1423054677: // friendly
5482          this.getFriendly().add((FriendlyLanguageComponent) value); // FriendlyLanguageComponent
5483          return value;
5484        case 102851257: // legal
5485          this.getLegal().add((LegalLanguageComponent) value); // LegalLanguageComponent
5486          return value;
5487        case 3512060: // rule
5488          this.getRule().add((ComputableLanguageComponent) value); // ComputableLanguageComponent
5489          return value;
5490        default: return super.setProperty(hash, name, value);
5491        }
5492
5493      }
5494
5495      @Override
5496      public Base setProperty(String name, Base value) throws FHIRException {
5497        if (name.equals("identifier")) {
5498          this.identifier = castToIdentifier(value); // Identifier
5499        } else if (name.equals("status")) {
5500          value = new ContractStatusEnumFactory().fromType(castToCode(value));
5501          this.status = (Enumeration) value; // Enumeration<ContractStatus>
5502        } else if (name.equals("issued")) {
5503          this.issued = castToDateTime(value); // DateTimeType
5504        } else if (name.equals("applies")) {
5505          this.applies = castToPeriod(value); // Period
5506        } else if (name.equals("subject")) {
5507          this.getSubject().add(castToReference(value));
5508        } else if (name.equals("topic")) {
5509          this.getTopic().add(castToReference(value));
5510        } else if (name.equals("authority")) {
5511          this.getAuthority().add(castToReference(value));
5512        } else if (name.equals("domain")) {
5513          this.getDomain().add(castToReference(value));
5514        } else if (name.equals("type")) {
5515          this.type = castToCodeableConcept(value); // CodeableConcept
5516        } else if (name.equals("subType")) {
5517          this.getSubType().add(castToCodeableConcept(value));
5518        } else if (name.equals("action")) {
5519          this.getAction().add(castToCodeableConcept(value));
5520        } else if (name.equals("actionReason")) {
5521          this.getActionReason().add(castToCodeableConcept(value));
5522        } else if (name.equals("decisionType")) {
5523          this.decisionType = castToCodeableConcept(value); // CodeableConcept
5524        } else if (name.equals("contentDerivative")) {
5525          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
5526        } else if (name.equals("securityLabel")) {
5527          this.getSecurityLabel().add(castToCoding(value));
5528        } else if (name.equals("agent")) {
5529          this.getAgent().add((AgentComponent) value);
5530        } else if (name.equals("signer")) {
5531          this.getSigner().add((SignatoryComponent) value);
5532        } else if (name.equals("valuedItem")) {
5533          this.getValuedItem().add((ValuedItemComponent) value);
5534        } else if (name.equals("term")) {
5535          this.getTerm().add((TermComponent) value);
5536        } else if (name.equals("binding[x]")) {
5537          this.binding = castToType(value); // Type
5538        } else if (name.equals("friendly")) {
5539          this.getFriendly().add((FriendlyLanguageComponent) value);
5540        } else if (name.equals("legal")) {
5541          this.getLegal().add((LegalLanguageComponent) value);
5542        } else if (name.equals("rule")) {
5543          this.getRule().add((ComputableLanguageComponent) value);
5544        } else
5545          return super.setProperty(name, value);
5546        return value;
5547      }
5548
5549      @Override
5550      public Base makeProperty(int hash, String name) throws FHIRException {
5551        switch (hash) {
5552        case -1618432855:  return getIdentifier(); 
5553        case -892481550:  return getStatusElement();
5554        case -1179159893:  return getIssuedElement();
5555        case -793235316:  return getApplies(); 
5556        case -1867885268:  return addSubject(); 
5557        case 110546223:  return addTopic(); 
5558        case 1475610435:  return addAuthority(); 
5559        case -1326197564:  return addDomain(); 
5560        case 3575610:  return getType(); 
5561        case -1868521062:  return addSubType(); 
5562        case -1422950858:  return addAction(); 
5563        case 1465121818:  return addActionReason(); 
5564        case 676128054:  return getDecisionType(); 
5565        case -92412192:  return getContentDerivative(); 
5566        case -722296940:  return addSecurityLabel(); 
5567        case 92750597:  return addAgent(); 
5568        case -902467798:  return addSigner(); 
5569        case 2046675654:  return addValuedItem(); 
5570        case 3556460:  return addTerm(); 
5571        case 1514826715:  return getBinding(); 
5572        case -108220795:  return getBinding(); 
5573        case -1423054677:  return addFriendly(); 
5574        case 102851257:  return addLegal(); 
5575        case 3512060:  return addRule(); 
5576        default: return super.makeProperty(hash, name);
5577        }
5578
5579      }
5580
5581      @Override
5582      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5583        switch (hash) {
5584        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
5585        case -892481550: /*status*/ return new String[] {"code"};
5586        case -1179159893: /*issued*/ return new String[] {"dateTime"};
5587        case -793235316: /*applies*/ return new String[] {"Period"};
5588        case -1867885268: /*subject*/ return new String[] {"Reference"};
5589        case 110546223: /*topic*/ return new String[] {"Reference"};
5590        case 1475610435: /*authority*/ return new String[] {"Reference"};
5591        case -1326197564: /*domain*/ return new String[] {"Reference"};
5592        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
5593        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
5594        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
5595        case 1465121818: /*actionReason*/ return new String[] {"CodeableConcept"};
5596        case 676128054: /*decisionType*/ return new String[] {"CodeableConcept"};
5597        case -92412192: /*contentDerivative*/ return new String[] {"CodeableConcept"};
5598        case -722296940: /*securityLabel*/ return new String[] {"Coding"};
5599        case 92750597: /*agent*/ return new String[] {};
5600        case -902467798: /*signer*/ return new String[] {};
5601        case 2046675654: /*valuedItem*/ return new String[] {};
5602        case 3556460: /*term*/ return new String[] {};
5603        case -108220795: /*binding*/ return new String[] {"Attachment", "Reference"};
5604        case -1423054677: /*friendly*/ return new String[] {};
5605        case 102851257: /*legal*/ return new String[] {};
5606        case 3512060: /*rule*/ return new String[] {};
5607        default: return super.getTypesForProperty(hash, name);
5608        }
5609
5610      }
5611
5612      @Override
5613      public Base addChild(String name) throws FHIRException {
5614        if (name.equals("identifier")) {
5615          this.identifier = new Identifier();
5616          return this.identifier;
5617        }
5618        else if (name.equals("status")) {
5619          throw new FHIRException("Cannot call addChild on a primitive type Contract.status");
5620        }
5621        else if (name.equals("issued")) {
5622          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
5623        }
5624        else if (name.equals("applies")) {
5625          this.applies = new Period();
5626          return this.applies;
5627        }
5628        else if (name.equals("subject")) {
5629          return addSubject();
5630        }
5631        else if (name.equals("topic")) {
5632          return addTopic();
5633        }
5634        else if (name.equals("authority")) {
5635          return addAuthority();
5636        }
5637        else if (name.equals("domain")) {
5638          return addDomain();
5639        }
5640        else if (name.equals("type")) {
5641          this.type = new CodeableConcept();
5642          return this.type;
5643        }
5644        else if (name.equals("subType")) {
5645          return addSubType();
5646        }
5647        else if (name.equals("action")) {
5648          return addAction();
5649        }
5650        else if (name.equals("actionReason")) {
5651          return addActionReason();
5652        }
5653        else if (name.equals("decisionType")) {
5654          this.decisionType = new CodeableConcept();
5655          return this.decisionType;
5656        }
5657        else if (name.equals("contentDerivative")) {
5658          this.contentDerivative = new CodeableConcept();
5659          return this.contentDerivative;
5660        }
5661        else if (name.equals("securityLabel")) {
5662          return addSecurityLabel();
5663        }
5664        else if (name.equals("agent")) {
5665          return addAgent();
5666        }
5667        else if (name.equals("signer")) {
5668          return addSigner();
5669        }
5670        else if (name.equals("valuedItem")) {
5671          return addValuedItem();
5672        }
5673        else if (name.equals("term")) {
5674          return addTerm();
5675        }
5676        else if (name.equals("bindingAttachment")) {
5677          this.binding = new Attachment();
5678          return this.binding;
5679        }
5680        else if (name.equals("bindingReference")) {
5681          this.binding = new Reference();
5682          return this.binding;
5683        }
5684        else if (name.equals("friendly")) {
5685          return addFriendly();
5686        }
5687        else if (name.equals("legal")) {
5688          return addLegal();
5689        }
5690        else if (name.equals("rule")) {
5691          return addRule();
5692        }
5693        else
5694          return super.addChild(name);
5695      }
5696
5697  public String fhirType() {
5698    return "Contract";
5699
5700  }
5701
5702      public Contract copy() {
5703        Contract dst = new Contract();
5704        copyValues(dst);
5705        dst.identifier = identifier == null ? null : identifier.copy();
5706        dst.status = status == null ? null : status.copy();
5707        dst.issued = issued == null ? null : issued.copy();
5708        dst.applies = applies == null ? null : applies.copy();
5709        if (subject != null) {
5710          dst.subject = new ArrayList<Reference>();
5711          for (Reference i : subject)
5712            dst.subject.add(i.copy());
5713        };
5714        if (topic != null) {
5715          dst.topic = new ArrayList<Reference>();
5716          for (Reference i : topic)
5717            dst.topic.add(i.copy());
5718        };
5719        if (authority != null) {
5720          dst.authority = new ArrayList<Reference>();
5721          for (Reference i : authority)
5722            dst.authority.add(i.copy());
5723        };
5724        if (domain != null) {
5725          dst.domain = new ArrayList<Reference>();
5726          for (Reference i : domain)
5727            dst.domain.add(i.copy());
5728        };
5729        dst.type = type == null ? null : type.copy();
5730        if (subType != null) {
5731          dst.subType = new ArrayList<CodeableConcept>();
5732          for (CodeableConcept i : subType)
5733            dst.subType.add(i.copy());
5734        };
5735        if (action != null) {
5736          dst.action = new ArrayList<CodeableConcept>();
5737          for (CodeableConcept i : action)
5738            dst.action.add(i.copy());
5739        };
5740        if (actionReason != null) {
5741          dst.actionReason = new ArrayList<CodeableConcept>();
5742          for (CodeableConcept i : actionReason)
5743            dst.actionReason.add(i.copy());
5744        };
5745        dst.decisionType = decisionType == null ? null : decisionType.copy();
5746        dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
5747        if (securityLabel != null) {
5748          dst.securityLabel = new ArrayList<Coding>();
5749          for (Coding i : securityLabel)
5750            dst.securityLabel.add(i.copy());
5751        };
5752        if (agent != null) {
5753          dst.agent = new ArrayList<AgentComponent>();
5754          for (AgentComponent i : agent)
5755            dst.agent.add(i.copy());
5756        };
5757        if (signer != null) {
5758          dst.signer = new ArrayList<SignatoryComponent>();
5759          for (SignatoryComponent i : signer)
5760            dst.signer.add(i.copy());
5761        };
5762        if (valuedItem != null) {
5763          dst.valuedItem = new ArrayList<ValuedItemComponent>();
5764          for (ValuedItemComponent i : valuedItem)
5765            dst.valuedItem.add(i.copy());
5766        };
5767        if (term != null) {
5768          dst.term = new ArrayList<TermComponent>();
5769          for (TermComponent i : term)
5770            dst.term.add(i.copy());
5771        };
5772        dst.binding = binding == null ? null : binding.copy();
5773        if (friendly != null) {
5774          dst.friendly = new ArrayList<FriendlyLanguageComponent>();
5775          for (FriendlyLanguageComponent i : friendly)
5776            dst.friendly.add(i.copy());
5777        };
5778        if (legal != null) {
5779          dst.legal = new ArrayList<LegalLanguageComponent>();
5780          for (LegalLanguageComponent i : legal)
5781            dst.legal.add(i.copy());
5782        };
5783        if (rule != null) {
5784          dst.rule = new ArrayList<ComputableLanguageComponent>();
5785          for (ComputableLanguageComponent i : rule)
5786            dst.rule.add(i.copy());
5787        };
5788        return dst;
5789      }
5790
5791      protected Contract typedCopy() {
5792        return copy();
5793      }
5794
5795      @Override
5796      public boolean equalsDeep(Base other_) {
5797        if (!super.equalsDeep(other_))
5798          return false;
5799        if (!(other_ instanceof Contract))
5800          return false;
5801        Contract o = (Contract) other_;
5802        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(issued, o.issued, true)
5803           && compareDeep(applies, o.applies, true) && compareDeep(subject, o.subject, true) && compareDeep(topic, o.topic, true)
5804           && compareDeep(authority, o.authority, true) && compareDeep(domain, o.domain, true) && compareDeep(type, o.type, true)
5805           && compareDeep(subType, o.subType, true) && compareDeep(action, o.action, true) && compareDeep(actionReason, o.actionReason, true)
5806           && compareDeep(decisionType, o.decisionType, true) && compareDeep(contentDerivative, o.contentDerivative, true)
5807           && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(agent, o.agent, true) && compareDeep(signer, o.signer, true)
5808           && compareDeep(valuedItem, o.valuedItem, true) && compareDeep(term, o.term, true) && compareDeep(binding, o.binding, true)
5809           && compareDeep(friendly, o.friendly, true) && compareDeep(legal, o.legal, true) && compareDeep(rule, o.rule, true)
5810          ;
5811      }
5812
5813      @Override
5814      public boolean equalsShallow(Base other_) {
5815        if (!super.equalsShallow(other_))
5816          return false;
5817        if (!(other_ instanceof Contract))
5818          return false;
5819        Contract o = (Contract) other_;
5820        return compareValues(status, o.status, true) && compareValues(issued, o.issued, true);
5821      }
5822
5823      public boolean isEmpty() {
5824        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, issued
5825          , applies, subject, topic, authority, domain, type, subType, action, actionReason
5826          , decisionType, contentDerivative, securityLabel, agent, signer, valuedItem, term
5827          , binding, friendly, legal, rule);
5828      }
5829
5830  @Override
5831  public ResourceType getResourceType() {
5832    return ResourceType.Contract;
5833   }
5834
5835 /**
5836   * Search parameter: <b>identifier</b>
5837   * <p>
5838   * Description: <b>The identity of the contract</b><br>
5839   * Type: <b>token</b><br>
5840   * Path: <b>Contract.identifier</b><br>
5841   * </p>
5842   */
5843  @SearchParamDefinition(name="identifier", path="Contract.identifier", description="The identity of the contract", type="token" )
5844  public static final String SP_IDENTIFIER = "identifier";
5845 /**
5846   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5847   * <p>
5848   * Description: <b>The identity of the contract</b><br>
5849   * Type: <b>token</b><br>
5850   * Path: <b>Contract.identifier</b><br>
5851   * </p>
5852   */
5853  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
5854
5855 /**
5856   * Search parameter: <b>agent</b>
5857   * <p>
5858   * Description: <b>Agent to the Contact</b><br>
5859   * Type: <b>reference</b><br>
5860   * Path: <b>Contract.agent.actor</b><br>
5861   * </p>
5862   */
5863  @SearchParamDefinition(name="agent", path="Contract.agent.actor", description="Agent to the Contact", type="reference", target={Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class } )
5864  public static final String SP_AGENT = "agent";
5865 /**
5866   * <b>Fluent Client</b> search parameter constant for <b>agent</b>
5867   * <p>
5868   * Description: <b>Agent to the Contact</b><br>
5869   * Type: <b>reference</b><br>
5870   * Path: <b>Contract.agent.actor</b><br>
5871   * </p>
5872   */
5873  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AGENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AGENT);
5874
5875/**
5876   * Constant for fluent queries to be used to add include statements. Specifies
5877   * the path value of "<b>Contract:agent</b>".
5878   */
5879  public static final ca.uhn.fhir.model.api.Include INCLUDE_AGENT = new ca.uhn.fhir.model.api.Include("Contract:agent").toLocked();
5880
5881 /**
5882   * Search parameter: <b>patient</b>
5883   * <p>
5884   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
5885   * Type: <b>reference</b><br>
5886   * Path: <b>Contract.subject</b><br>
5887   * </p>
5888   */
5889  @SearchParamDefinition(name="patient", path="Contract.subject", description="The identity of the subject of the contract (if a patient)", type="reference", target={Patient.class } )
5890  public static final String SP_PATIENT = "patient";
5891 /**
5892   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
5893   * <p>
5894   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
5895   * Type: <b>reference</b><br>
5896   * Path: <b>Contract.subject</b><br>
5897   * </p>
5898   */
5899  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
5900
5901/**
5902   * Constant for fluent queries to be used to add include statements. Specifies
5903   * the path value of "<b>Contract:patient</b>".
5904   */
5905  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Contract:patient").toLocked();
5906
5907 /**
5908   * Search parameter: <b>subject</b>
5909   * <p>
5910   * Description: <b>The identity of the subject of the contract</b><br>
5911   * Type: <b>reference</b><br>
5912   * Path: <b>Contract.subject</b><br>
5913   * </p>
5914   */
5915  @SearchParamDefinition(name="subject", path="Contract.subject", description="The identity of the subject of the contract", type="reference" )
5916  public static final String SP_SUBJECT = "subject";
5917 /**
5918   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
5919   * <p>
5920   * Description: <b>The identity of the subject of the contract</b><br>
5921   * Type: <b>reference</b><br>
5922   * Path: <b>Contract.subject</b><br>
5923   * </p>
5924   */
5925  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
5926
5927/**
5928   * Constant for fluent queries to be used to add include statements. Specifies
5929   * the path value of "<b>Contract:subject</b>".
5930   */
5931  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Contract:subject").toLocked();
5932
5933 /**
5934   * Search parameter: <b>authority</b>
5935   * <p>
5936   * Description: <b>The authority of the contract</b><br>
5937   * Type: <b>reference</b><br>
5938   * Path: <b>Contract.authority</b><br>
5939   * </p>
5940   */
5941  @SearchParamDefinition(name="authority", path="Contract.authority", description="The authority of the contract", type="reference", target={Organization.class } )
5942  public static final String SP_AUTHORITY = "authority";
5943 /**
5944   * <b>Fluent Client</b> search parameter constant for <b>authority</b>
5945   * <p>
5946   * Description: <b>The authority of the contract</b><br>
5947   * Type: <b>reference</b><br>
5948   * Path: <b>Contract.authority</b><br>
5949   * </p>
5950   */
5951  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHORITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHORITY);
5952
5953/**
5954   * Constant for fluent queries to be used to add include statements. Specifies
5955   * the path value of "<b>Contract:authority</b>".
5956   */
5957  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHORITY = new ca.uhn.fhir.model.api.Include("Contract:authority").toLocked();
5958
5959 /**
5960   * Search parameter: <b>domain</b>
5961   * <p>
5962   * Description: <b>The domain of the contract</b><br>
5963   * Type: <b>reference</b><br>
5964   * Path: <b>Contract.domain</b><br>
5965   * </p>
5966   */
5967  @SearchParamDefinition(name="domain", path="Contract.domain", description="The domain of the contract", type="reference", target={Location.class } )
5968  public static final String SP_DOMAIN = "domain";
5969 /**
5970   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
5971   * <p>
5972   * Description: <b>The domain of the contract</b><br>
5973   * Type: <b>reference</b><br>
5974   * Path: <b>Contract.domain</b><br>
5975   * </p>
5976   */
5977  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DOMAIN);
5978
5979/**
5980   * Constant for fluent queries to be used to add include statements. Specifies
5981   * the path value of "<b>Contract:domain</b>".
5982   */
5983  public static final ca.uhn.fhir.model.api.Include INCLUDE_DOMAIN = new ca.uhn.fhir.model.api.Include("Contract:domain").toLocked();
5984
5985 /**
5986   * Search parameter: <b>term-topic</b>
5987   * <p>
5988   * Description: <b>The identity of the topic of the contract terms</b><br>
5989   * Type: <b>reference</b><br>
5990   * Path: <b>Contract.term.topic</b><br>
5991   * </p>
5992   */
5993  @SearchParamDefinition(name="term-topic", path="Contract.term.topic", description="The identity of the topic of the contract terms", type="reference" )
5994  public static final String SP_TERM_TOPIC = "term-topic";
5995 /**
5996   * <b>Fluent Client</b> search parameter constant for <b>term-topic</b>
5997   * <p>
5998   * Description: <b>The identity of the topic of the contract terms</b><br>
5999   * Type: <b>reference</b><br>
6000   * Path: <b>Contract.term.topic</b><br>
6001   * </p>
6002   */
6003  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TERM_TOPIC = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_TERM_TOPIC);
6004
6005/**
6006   * Constant for fluent queries to be used to add include statements. Specifies
6007   * the path value of "<b>Contract:term-topic</b>".
6008   */
6009  public static final ca.uhn.fhir.model.api.Include INCLUDE_TERM_TOPIC = new ca.uhn.fhir.model.api.Include("Contract:term-topic").toLocked();
6010
6011 /**
6012   * Search parameter: <b>issued</b>
6013   * <p>
6014   * Description: <b>The date/time the contract was issued</b><br>
6015   * Type: <b>date</b><br>
6016   * Path: <b>Contract.issued</b><br>
6017   * </p>
6018   */
6019  @SearchParamDefinition(name="issued", path="Contract.issued", description="The date/time the contract was issued", type="date" )
6020  public static final String SP_ISSUED = "issued";
6021 /**
6022   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
6023   * <p>
6024   * Description: <b>The date/time the contract was issued</b><br>
6025   * Type: <b>date</b><br>
6026   * Path: <b>Contract.issued</b><br>
6027   * </p>
6028   */
6029  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ISSUED);
6030
6031 /**
6032   * Search parameter: <b>signer</b>
6033   * <p>
6034   * Description: <b>Contract Signatory Party</b><br>
6035   * Type: <b>reference</b><br>
6036   * Path: <b>Contract.signer.party</b><br>
6037   * </p>
6038   */
6039  @SearchParamDefinition(name="signer", path="Contract.signer.party", description="Contract Signatory Party", type="reference", target={Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
6040  public static final String SP_SIGNER = "signer";
6041 /**
6042   * <b>Fluent Client</b> search parameter constant for <b>signer</b>
6043   * <p>
6044   * Description: <b>Contract Signatory Party</b><br>
6045   * Type: <b>reference</b><br>
6046   * Path: <b>Contract.signer.party</b><br>
6047   * </p>
6048   */
6049  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SIGNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SIGNER);
6050
6051/**
6052   * Constant for fluent queries to be used to add include statements. Specifies
6053   * the path value of "<b>Contract:signer</b>".
6054   */
6055  public static final ca.uhn.fhir.model.api.Include INCLUDE_SIGNER = new ca.uhn.fhir.model.api.Include("Contract:signer").toLocked();
6056
6057
6058}
6059