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