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