001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048
049/**
050 * Legally enforceable, formally recorded unilateral or bilateral directive
051 * i.e., a policy or agreement.
052 */
053@ResourceDef(name = "Contract", profile = "http://hl7.org/fhir/StructureDefinition/Contract")
054public class Contract extends DomainResource {
055
056  public enum ContractStatus {
057    /**
058     * Contract is augmented with additional information to correct errors in a
059     * predecessor or to updated values in a predecessor. Usage: Contract altered
060     * within effective time. Precedence Order = 9. Comparable FHIR and v.3 status
061     * codes: revised; replaced.
062     */
063    AMENDED,
064    /**
065     * Contract is augmented with additional information that was missing from a
066     * predecessor Contract. Usage: Contract altered within effective time.
067     * Precedence Order = 9. Comparable FHIR and v.3 status codes: updated,
068     * replaced.
069     */
070    APPENDED,
071    /**
072     * Contract is terminated due to failure of the Grantor and/or the Grantee to
073     * fulfil one or more contract provisions. Usage: Abnormal contract termination.
074     * Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed;
075     * aborted.
076     */
077    CANCELLED,
078    /**
079     * Contract is pended to rectify failure of the Grantor or the Grantee to fulfil
080     * contract provision(s). E.g., Grantee complaint about Grantor's failure to
081     * comply with contract provisions. Usage: Contract pended. Precedence Order =
082     * 7. Comparable FHIR and v.3 status codes: on hold; pended; suspended.
083     */
084    DISPUTED,
085    /**
086     * Contract was created in error. No Precedence Order. Status may be applied to
087     * a Contract with any status.
088     */
089    ENTEREDINERROR,
090    /**
091     * Contract execution pending; may be executed when either the Grantor or the
092     * Grantee accepts the contract provisions by signing. I.e., where either the
093     * Grantor or the Grantee has signed, but not both. E.g., when an insurance
094     * applicant signs the insurers application, which references the policy. Usage:
095     * Optional first step of contract execution activity. May be skipped and
096     * contracting activity moves directly to executed state. Precedence Order = 3.
097     * Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended;
098     * active.
099     */
100    EXECUTABLE,
101    /**
102     * Contract is activated for period stipulated when both the Grantor and Grantee
103     * have signed it. Usage: Required state for normal completion of contracting
104     * activity. Precedence Order = 6. Comparable FHIR and v.3 status codes:
105     * accepted; completed.
106     */
107    EXECUTED,
108    /**
109     * Contract execution is suspended while either or both the Grantor and Grantee
110     * propose and consider new or revised contract provisions. I.e., where the
111     * party which has not signed proposes changes to the terms. E .g., a life
112     * insurer declines to agree to the signed application because the life insurer
113     * has evidence that the applicant, who asserted to being younger or a
114     * non-smoker to get a lower premium rate - but offers instead to agree to a
115     * higher premium based on the applicants actual age or smoking status. Usage:
116     * Optional contract activity between executable and executed state. Precedence
117     * Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.
118     */
119    NEGOTIABLE,
120    /**
121     * Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract
122     * hard copy or electronic 'template', 'form' or 'application'. E.g., health
123     * insurance application; consent directive form. Usage: Beginning of contract
124     * negotiation, which may have been completed as a precondition because used for
125     * 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes:
126     * requested; new.
127     */
128    OFFERED,
129    /**
130     * Contract template is available as the basis for an application or offer by
131     * the Grantor or Grantee. E.g., health insurance policy; consent directive
132     * policy. Usage: Required initial contract activity, which may have been
133     * completed as a precondition because used for 0..* contracts. Precedence Order
134     * = 1. Comparable FHIR and v.3 status codes: proposed; intended.
135     */
136    POLICY,
137    /**
138     * Execution of the Contract is not completed because either or both the Grantor
139     * and Grantee decline to accept some or all of the contract provisions. Usage:
140     * Optional contract activity between executable and abnormal termination.
141     * Precedence Order = 5. Comparable FHIR and v.3 status codes: stopped;
142     * cancelled.
143     */
144    REJECTED,
145    /**
146     * Beginning of a successor Contract at the termination of predecessor Contract
147     * lifecycle. Usage: Follows termination of a preceding Contract that has
148     * reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3
149     * status codes: superseded.
150     */
151    RENEWED,
152    /**
153     * A Contract that is rescinded. May be required prior to replacing with an
154     * updated Contract. Comparable FHIR and v.3 status codes: nullified.
155     */
156    REVOKED,
157    /**
158     * Contract is reactivated after being pended because of faulty execution.
159     * *E.g., competency of the signer(s), or where the policy is substantially
160     * different from and did not accompany the application/form so that the
161     * applicant could not compare them. Aka - ''reactivated''. Usage: Optional
162     * stage where a pended contract is reactivated. Precedence Order = 8.
163     * Comparable FHIR and v.3 status codes: reactivated.
164     */
165    RESOLVED,
166    /**
167     * Contract reaches its expiry date. It might or might not be renewed or
168     * renegotiated. Usage: Normal end of contract period. Precedence Order = 12.
169     * Comparable FHIR and v.3 status codes: Obsoleted.
170     */
171    TERMINATED,
172    /**
173     * added to help the parsers with the generic types
174     */
175    NULL;
176
177    public static ContractStatus fromCode(String codeString) throws FHIRException {
178      if (codeString == null || "".equals(codeString))
179        return null;
180      if ("amended".equals(codeString))
181        return AMENDED;
182      if ("appended".equals(codeString))
183        return APPENDED;
184      if ("cancelled".equals(codeString))
185        return CANCELLED;
186      if ("disputed".equals(codeString))
187        return DISPUTED;
188      if ("entered-in-error".equals(codeString))
189        return ENTEREDINERROR;
190      if ("executable".equals(codeString))
191        return EXECUTABLE;
192      if ("executed".equals(codeString))
193        return EXECUTED;
194      if ("negotiable".equals(codeString))
195        return NEGOTIABLE;
196      if ("offered".equals(codeString))
197        return OFFERED;
198      if ("policy".equals(codeString))
199        return POLICY;
200      if ("rejected".equals(codeString))
201        return REJECTED;
202      if ("renewed".equals(codeString))
203        return RENEWED;
204      if ("revoked".equals(codeString))
205        return REVOKED;
206      if ("resolved".equals(codeString))
207        return RESOLVED;
208      if ("terminated".equals(codeString))
209        return TERMINATED;
210      if (Configuration.isAcceptInvalidEnums())
211        return null;
212      else
213        throw new FHIRException("Unknown ContractStatus code '" + codeString + "'");
214    }
215
216    public String toCode() {
217      switch (this) {
218      case AMENDED:
219        return "amended";
220      case APPENDED:
221        return "appended";
222      case CANCELLED:
223        return "cancelled";
224      case DISPUTED:
225        return "disputed";
226      case ENTEREDINERROR:
227        return "entered-in-error";
228      case EXECUTABLE:
229        return "executable";
230      case EXECUTED:
231        return "executed";
232      case NEGOTIABLE:
233        return "negotiable";
234      case OFFERED:
235        return "offered";
236      case POLICY:
237        return "policy";
238      case REJECTED:
239        return "rejected";
240      case RENEWED:
241        return "renewed";
242      case REVOKED:
243        return "revoked";
244      case RESOLVED:
245        return "resolved";
246      case TERMINATED:
247        return "terminated";
248      case NULL:
249        return null;
250      default:
251        return "?";
252      }
253    }
254
255    public String getSystem() {
256      switch (this) {
257      case AMENDED:
258        return "http://hl7.org/fhir/contract-status";
259      case APPENDED:
260        return "http://hl7.org/fhir/contract-status";
261      case CANCELLED:
262        return "http://hl7.org/fhir/contract-status";
263      case DISPUTED:
264        return "http://hl7.org/fhir/contract-status";
265      case ENTEREDINERROR:
266        return "http://hl7.org/fhir/contract-status";
267      case EXECUTABLE:
268        return "http://hl7.org/fhir/contract-status";
269      case EXECUTED:
270        return "http://hl7.org/fhir/contract-status";
271      case NEGOTIABLE:
272        return "http://hl7.org/fhir/contract-status";
273      case OFFERED:
274        return "http://hl7.org/fhir/contract-status";
275      case POLICY:
276        return "http://hl7.org/fhir/contract-status";
277      case REJECTED:
278        return "http://hl7.org/fhir/contract-status";
279      case RENEWED:
280        return "http://hl7.org/fhir/contract-status";
281      case REVOKED:
282        return "http://hl7.org/fhir/contract-status";
283      case RESOLVED:
284        return "http://hl7.org/fhir/contract-status";
285      case TERMINATED:
286        return "http://hl7.org/fhir/contract-status";
287      case NULL:
288        return null;
289      default:
290        return "?";
291      }
292    }
293
294    public String getDefinition() {
295      switch (this) {
296      case AMENDED:
297        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.";
298      case APPENDED:
299        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.";
300      case CANCELLED:
301        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.";
302      case DISPUTED:
303        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.";
304      case ENTEREDINERROR:
305        return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
306      case EXECUTABLE:
307        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.";
308      case EXECUTED:
309        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.";
310      case NEGOTIABLE:
311        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.";
312      case OFFERED:
313        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.";
314      case POLICY:
315        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.";
316      case REJECTED:
317        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.";
318      case RENEWED:
319        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.";
320      case REVOKED:
321        return "A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.";
322      case RESOLVED:
323        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.";
324      case TERMINATED:
325        return "Contract reaches its expiry date. It might or might not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.";
326      case NULL:
327        return null;
328      default:
329        return "?";
330      }
331    }
332
333    public String getDisplay() {
334      switch (this) {
335      case AMENDED:
336        return "Amended";
337      case APPENDED:
338        return "Appended";
339      case CANCELLED:
340        return "Cancelled";
341      case DISPUTED:
342        return "Disputed";
343      case ENTEREDINERROR:
344        return "Entered in Error";
345      case EXECUTABLE:
346        return "Executable";
347      case EXECUTED:
348        return "Executed";
349      case NEGOTIABLE:
350        return "Negotiable";
351      case OFFERED:
352        return "Offered";
353      case POLICY:
354        return "Policy";
355      case REJECTED:
356        return "Rejected";
357      case RENEWED:
358        return "Renewed";
359      case REVOKED:
360        return "Revoked";
361      case RESOLVED:
362        return "Resolved";
363      case TERMINATED:
364        return "Terminated";
365      case NULL:
366        return null;
367      default:
368        return "?";
369      }
370    }
371  }
372
373  public static class ContractStatusEnumFactory implements EnumFactory<ContractStatus> {
374    public ContractStatus fromCode(String codeString) throws IllegalArgumentException {
375      if (codeString == null || "".equals(codeString))
376        if (codeString == null || "".equals(codeString))
377          return null;
378      if ("amended".equals(codeString))
379        return ContractStatus.AMENDED;
380      if ("appended".equals(codeString))
381        return ContractStatus.APPENDED;
382      if ("cancelled".equals(codeString))
383        return ContractStatus.CANCELLED;
384      if ("disputed".equals(codeString))
385        return ContractStatus.DISPUTED;
386      if ("entered-in-error".equals(codeString))
387        return ContractStatus.ENTEREDINERROR;
388      if ("executable".equals(codeString))
389        return ContractStatus.EXECUTABLE;
390      if ("executed".equals(codeString))
391        return ContractStatus.EXECUTED;
392      if ("negotiable".equals(codeString))
393        return ContractStatus.NEGOTIABLE;
394      if ("offered".equals(codeString))
395        return ContractStatus.OFFERED;
396      if ("policy".equals(codeString))
397        return ContractStatus.POLICY;
398      if ("rejected".equals(codeString))
399        return ContractStatus.REJECTED;
400      if ("renewed".equals(codeString))
401        return ContractStatus.RENEWED;
402      if ("revoked".equals(codeString))
403        return ContractStatus.REVOKED;
404      if ("resolved".equals(codeString))
405        return ContractStatus.RESOLVED;
406      if ("terminated".equals(codeString))
407        return ContractStatus.TERMINATED;
408      throw new IllegalArgumentException("Unknown ContractStatus code '" + codeString + "'");
409    }
410
411    public Enumeration<ContractStatus> fromType(PrimitiveType<?> code) throws FHIRException {
412      if (code == null)
413        return null;
414      if (code.isEmpty())
415        return new Enumeration<ContractStatus>(this, ContractStatus.NULL, code);
416      String codeString = code.asStringValue();
417      if (codeString == null || "".equals(codeString))
418        return new Enumeration<ContractStatus>(this, ContractStatus.NULL, code);
419      if ("amended".equals(codeString))
420        return new Enumeration<ContractStatus>(this, ContractStatus.AMENDED, code);
421      if ("appended".equals(codeString))
422        return new Enumeration<ContractStatus>(this, ContractStatus.APPENDED, code);
423      if ("cancelled".equals(codeString))
424        return new Enumeration<ContractStatus>(this, ContractStatus.CANCELLED, code);
425      if ("disputed".equals(codeString))
426        return new Enumeration<ContractStatus>(this, ContractStatus.DISPUTED, code);
427      if ("entered-in-error".equals(codeString))
428        return new Enumeration<ContractStatus>(this, ContractStatus.ENTEREDINERROR, code);
429      if ("executable".equals(codeString))
430        return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTABLE, code);
431      if ("executed".equals(codeString))
432        return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTED, code);
433      if ("negotiable".equals(codeString))
434        return new Enumeration<ContractStatus>(this, ContractStatus.NEGOTIABLE, code);
435      if ("offered".equals(codeString))
436        return new Enumeration<ContractStatus>(this, ContractStatus.OFFERED, code);
437      if ("policy".equals(codeString))
438        return new Enumeration<ContractStatus>(this, ContractStatus.POLICY, code);
439      if ("rejected".equals(codeString))
440        return new Enumeration<ContractStatus>(this, ContractStatus.REJECTED, code);
441      if ("renewed".equals(codeString))
442        return new Enumeration<ContractStatus>(this, ContractStatus.RENEWED, code);
443      if ("revoked".equals(codeString))
444        return new Enumeration<ContractStatus>(this, ContractStatus.REVOKED, code);
445      if ("resolved".equals(codeString))
446        return new Enumeration<ContractStatus>(this, ContractStatus.RESOLVED, code);
447      if ("terminated".equals(codeString))
448        return new Enumeration<ContractStatus>(this, ContractStatus.TERMINATED, code);
449      throw new FHIRException("Unknown ContractStatus code '" + codeString + "'");
450    }
451
452    public String toCode(ContractStatus code) {
453      if (code == ContractStatus.AMENDED)
454        return "amended";
455      if (code == ContractStatus.APPENDED)
456        return "appended";
457      if (code == ContractStatus.CANCELLED)
458        return "cancelled";
459      if (code == ContractStatus.DISPUTED)
460        return "disputed";
461      if (code == ContractStatus.ENTEREDINERROR)
462        return "entered-in-error";
463      if (code == ContractStatus.EXECUTABLE)
464        return "executable";
465      if (code == ContractStatus.EXECUTED)
466        return "executed";
467      if (code == ContractStatus.NEGOTIABLE)
468        return "negotiable";
469      if (code == ContractStatus.OFFERED)
470        return "offered";
471      if (code == ContractStatus.POLICY)
472        return "policy";
473      if (code == ContractStatus.REJECTED)
474        return "rejected";
475      if (code == ContractStatus.RENEWED)
476        return "renewed";
477      if (code == ContractStatus.REVOKED)
478        return "revoked";
479      if (code == ContractStatus.RESOLVED)
480        return "resolved";
481      if (code == ContractStatus.TERMINATED)
482        return "terminated";
483      return "?";
484    }
485
486    public String toSystem(ContractStatus code) {
487      return code.getSystem();
488    }
489  }
490
491  public enum ContractPublicationStatus {
492    /**
493     * Contract is augmented with additional information to correct errors in a
494     * predecessor or to updated values in a predecessor. Usage: Contract altered
495     * within effective time. Precedence Order = 9. Comparable FHIR and v.3 status
496     * codes: revised; replaced.
497     */
498    AMENDED,
499    /**
500     * Contract is augmented with additional information that was missing from a
501     * predecessor Contract. Usage: Contract altered within effective time.
502     * Precedence Order = 9. Comparable FHIR and v.3 status codes: updated,
503     * replaced.
504     */
505    APPENDED,
506    /**
507     * Contract is terminated due to failure of the Grantor and/or the Grantee to
508     * fulfil one or more contract provisions. Usage: Abnormal contract termination.
509     * Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed;
510     * aborted.
511     */
512    CANCELLED,
513    /**
514     * Contract is pended to rectify failure of the Grantor or the Grantee to fulfil
515     * contract provision(s). E.g., Grantee complaint about Grantor's failure to
516     * comply with contract provisions. Usage: Contract pended. Precedence Order =
517     * 7. Comparable FHIR and v.3 status codes: on hold; pended; suspended.
518     */
519    DISPUTED,
520    /**
521     * Contract was created in error. No Precedence Order. Status may be applied to
522     * a Contract with any status.
523     */
524    ENTEREDINERROR,
525    /**
526     * Contract execution pending; may be executed when either the Grantor or the
527     * Grantee accepts the contract provisions by signing. I.e., where either the
528     * Grantor or the Grantee has signed, but not both. E.g., when an insurance
529     * applicant signs the insurers application, which references the policy. Usage:
530     * Optional first step of contract execution activity. May be skipped and
531     * contracting activity moves directly to executed state. Precedence Order = 3.
532     * Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended;
533     * active.
534     */
535    EXECUTABLE,
536    /**
537     * Contract is activated for period stipulated when both the Grantor and Grantee
538     * have signed it. Usage: Required state for normal completion of contracting
539     * activity. Precedence Order = 6. Comparable FHIR and v.3 status codes:
540     * accepted; completed.
541     */
542    EXECUTED,
543    /**
544     * Contract execution is suspended while either or both the Grantor and Grantee
545     * propose and consider new or revised contract provisions. I.e., where the
546     * party which has not signed proposes changes to the terms. E .g., a life
547     * insurer declines to agree to the signed application because the life insurer
548     * has evidence that the applicant, who asserted to being younger or a
549     * non-smoker to get a lower premium rate - but offers instead to agree to a
550     * higher premium based on the applicants actual age or smoking status. Usage:
551     * Optional contract activity between executable and executed state. Precedence
552     * Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.
553     */
554    NEGOTIABLE,
555    /**
556     * Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract
557     * hard copy or electronic 'template', 'form' or 'application'. E.g., health
558     * insurance application; consent directive form. Usage: Beginning of contract
559     * negotiation, which may have been completed as a precondition because used for
560     * 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes:
561     * requested; new.
562     */
563    OFFERED,
564    /**
565     * Contract template is available as the basis for an application or offer by
566     * the Grantor or Grantee. E.g., health insurance policy; consent directive
567     * policy. Usage: Required initial contract activity, which may have been
568     * completed as a precondition because used for 0..* contracts. Precedence Order
569     * = 1. Comparable FHIR and v.3 status codes: proposed; intended.
570     */
571    POLICY,
572    /**
573     * Execution of the Contract is not completed because either or both the Grantor
574     * and Grantee decline to accept some or all of the contract provisions. Usage:
575     * Optional contract activity between executable and abnormal termination.
576     * Precedence Order = 5. Comparable FHIR and v.3 status codes: stopped;
577     * cancelled.
578     */
579    REJECTED,
580    /**
581     * Beginning of a successor Contract at the termination of predecessor Contract
582     * lifecycle. Usage: Follows termination of a preceding Contract that has
583     * reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3
584     * status codes: superseded.
585     */
586    RENEWED,
587    /**
588     * A Contract that is rescinded. May be required prior to replacing with an
589     * updated Contract. Comparable FHIR and v.3 status codes: nullified.
590     */
591    REVOKED,
592    /**
593     * Contract is reactivated after being pended because of faulty execution.
594     * *E.g., competency of the signer(s), or where the policy is substantially
595     * different from and did not accompany the application/form so that the
596     * applicant could not compare them. Aka - ''reactivated''. Usage: Optional
597     * stage where a pended contract is reactivated. Precedence Order = 8.
598     * Comparable FHIR and v.3 status codes: reactivated.
599     */
600    RESOLVED,
601    /**
602     * Contract reaches its expiry date. It might or might not be renewed or
603     * renegotiated. Usage: Normal end of contract period. Precedence Order = 12.
604     * Comparable FHIR and v.3 status codes: Obsoleted.
605     */
606    TERMINATED,
607    /**
608     * added to help the parsers with the generic types
609     */
610    NULL;
611
612    public static ContractPublicationStatus fromCode(String codeString) throws FHIRException {
613      if (codeString == null || "".equals(codeString))
614        return null;
615      if ("amended".equals(codeString))
616        return AMENDED;
617      if ("appended".equals(codeString))
618        return APPENDED;
619      if ("cancelled".equals(codeString))
620        return CANCELLED;
621      if ("disputed".equals(codeString))
622        return DISPUTED;
623      if ("entered-in-error".equals(codeString))
624        return ENTEREDINERROR;
625      if ("executable".equals(codeString))
626        return EXECUTABLE;
627      if ("executed".equals(codeString))
628        return EXECUTED;
629      if ("negotiable".equals(codeString))
630        return NEGOTIABLE;
631      if ("offered".equals(codeString))
632        return OFFERED;
633      if ("policy".equals(codeString))
634        return POLICY;
635      if ("rejected".equals(codeString))
636        return REJECTED;
637      if ("renewed".equals(codeString))
638        return RENEWED;
639      if ("revoked".equals(codeString))
640        return REVOKED;
641      if ("resolved".equals(codeString))
642        return RESOLVED;
643      if ("terminated".equals(codeString))
644        return TERMINATED;
645      if (Configuration.isAcceptInvalidEnums())
646        return null;
647      else
648        throw new FHIRException("Unknown ContractPublicationStatus code '" + codeString + "'");
649    }
650
651    public String toCode() {
652      switch (this) {
653      case AMENDED:
654        return "amended";
655      case APPENDED:
656        return "appended";
657      case CANCELLED:
658        return "cancelled";
659      case DISPUTED:
660        return "disputed";
661      case ENTEREDINERROR:
662        return "entered-in-error";
663      case EXECUTABLE:
664        return "executable";
665      case EXECUTED:
666        return "executed";
667      case NEGOTIABLE:
668        return "negotiable";
669      case OFFERED:
670        return "offered";
671      case POLICY:
672        return "policy";
673      case REJECTED:
674        return "rejected";
675      case RENEWED:
676        return "renewed";
677      case REVOKED:
678        return "revoked";
679      case RESOLVED:
680        return "resolved";
681      case TERMINATED:
682        return "terminated";
683      case NULL:
684        return null;
685      default:
686        return "?";
687      }
688    }
689
690    public String getSystem() {
691      switch (this) {
692      case AMENDED:
693        return "http://hl7.org/fhir/contract-publicationstatus";
694      case APPENDED:
695        return "http://hl7.org/fhir/contract-publicationstatus";
696      case CANCELLED:
697        return "http://hl7.org/fhir/contract-publicationstatus";
698      case DISPUTED:
699        return "http://hl7.org/fhir/contract-publicationstatus";
700      case ENTEREDINERROR:
701        return "http://hl7.org/fhir/contract-publicationstatus";
702      case EXECUTABLE:
703        return "http://hl7.org/fhir/contract-publicationstatus";
704      case EXECUTED:
705        return "http://hl7.org/fhir/contract-publicationstatus";
706      case NEGOTIABLE:
707        return "http://hl7.org/fhir/contract-publicationstatus";
708      case OFFERED:
709        return "http://hl7.org/fhir/contract-publicationstatus";
710      case POLICY:
711        return "http://hl7.org/fhir/contract-publicationstatus";
712      case REJECTED:
713        return "http://hl7.org/fhir/contract-publicationstatus";
714      case RENEWED:
715        return "http://hl7.org/fhir/contract-publicationstatus";
716      case REVOKED:
717        return "http://hl7.org/fhir/contract-publicationstatus";
718      case RESOLVED:
719        return "http://hl7.org/fhir/contract-publicationstatus";
720      case TERMINATED:
721        return "http://hl7.org/fhir/contract-publicationstatus";
722      case NULL:
723        return null;
724      default:
725        return "?";
726      }
727    }
728
729    public String getDefinition() {
730      switch (this) {
731      case AMENDED:
732        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.";
733      case APPENDED:
734        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.";
735      case CANCELLED:
736        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.";
737      case DISPUTED:
738        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.";
739      case ENTEREDINERROR:
740        return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
741      case EXECUTABLE:
742        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.";
743      case EXECUTED:
744        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.";
745      case NEGOTIABLE:
746        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.";
747      case OFFERED:
748        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.";
749      case POLICY:
750        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.";
751      case REJECTED:
752        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.";
753      case RENEWED:
754        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.";
755      case REVOKED:
756        return "A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.";
757      case RESOLVED:
758        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.";
759      case TERMINATED:
760        return "Contract reaches its expiry date. It might or might not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.";
761      case NULL:
762        return null;
763      default:
764        return "?";
765      }
766    }
767
768    public String getDisplay() {
769      switch (this) {
770      case AMENDED:
771        return "Amended";
772      case APPENDED:
773        return "Appended";
774      case CANCELLED:
775        return "Cancelled";
776      case DISPUTED:
777        return "Disputed";
778      case ENTEREDINERROR:
779        return "Entered in Error";
780      case EXECUTABLE:
781        return "Executable";
782      case EXECUTED:
783        return "Executed";
784      case NEGOTIABLE:
785        return "Negotiable";
786      case OFFERED:
787        return "Offered";
788      case POLICY:
789        return "Policy";
790      case REJECTED:
791        return "Rejected";
792      case RENEWED:
793        return "Renewed";
794      case REVOKED:
795        return "Revoked";
796      case RESOLVED:
797        return "Resolved";
798      case TERMINATED:
799        return "Terminated";
800      case NULL:
801        return null;
802      default:
803        return "?";
804      }
805    }
806  }
807
808  public static class ContractPublicationStatusEnumFactory implements EnumFactory<ContractPublicationStatus> {
809    public ContractPublicationStatus fromCode(String codeString) throws IllegalArgumentException {
810      if (codeString == null || "".equals(codeString))
811        if (codeString == null || "".equals(codeString))
812          return null;
813      if ("amended".equals(codeString))
814        return ContractPublicationStatus.AMENDED;
815      if ("appended".equals(codeString))
816        return ContractPublicationStatus.APPENDED;
817      if ("cancelled".equals(codeString))
818        return ContractPublicationStatus.CANCELLED;
819      if ("disputed".equals(codeString))
820        return ContractPublicationStatus.DISPUTED;
821      if ("entered-in-error".equals(codeString))
822        return ContractPublicationStatus.ENTEREDINERROR;
823      if ("executable".equals(codeString))
824        return ContractPublicationStatus.EXECUTABLE;
825      if ("executed".equals(codeString))
826        return ContractPublicationStatus.EXECUTED;
827      if ("negotiable".equals(codeString))
828        return ContractPublicationStatus.NEGOTIABLE;
829      if ("offered".equals(codeString))
830        return ContractPublicationStatus.OFFERED;
831      if ("policy".equals(codeString))
832        return ContractPublicationStatus.POLICY;
833      if ("rejected".equals(codeString))
834        return ContractPublicationStatus.REJECTED;
835      if ("renewed".equals(codeString))
836        return ContractPublicationStatus.RENEWED;
837      if ("revoked".equals(codeString))
838        return ContractPublicationStatus.REVOKED;
839      if ("resolved".equals(codeString))
840        return ContractPublicationStatus.RESOLVED;
841      if ("terminated".equals(codeString))
842        return ContractPublicationStatus.TERMINATED;
843      throw new IllegalArgumentException("Unknown ContractPublicationStatus code '" + codeString + "'");
844    }
845
846    public Enumeration<ContractPublicationStatus> fromType(PrimitiveType<?> code) throws FHIRException {
847      if (code == null)
848        return null;
849      if (code.isEmpty())
850        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NULL, code);
851      String codeString = code.asStringValue();
852      if (codeString == null || "".equals(codeString))
853        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NULL, code);
854      if ("amended".equals(codeString))
855        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.AMENDED, code);
856      if ("appended".equals(codeString))
857        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.APPENDED, code);
858      if ("cancelled".equals(codeString))
859        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.CANCELLED, code);
860      if ("disputed".equals(codeString))
861        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.DISPUTED, code);
862      if ("entered-in-error".equals(codeString))
863        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.ENTEREDINERROR, code);
864      if ("executable".equals(codeString))
865        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTABLE, code);
866      if ("executed".equals(codeString))
867        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTED, code);
868      if ("negotiable".equals(codeString))
869        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NEGOTIABLE, code);
870      if ("offered".equals(codeString))
871        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.OFFERED, code);
872      if ("policy".equals(codeString))
873        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.POLICY, code);
874      if ("rejected".equals(codeString))
875        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REJECTED, code);
876      if ("renewed".equals(codeString))
877        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RENEWED, code);
878      if ("revoked".equals(codeString))
879        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REVOKED, code);
880      if ("resolved".equals(codeString))
881        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RESOLVED, code);
882      if ("terminated".equals(codeString))
883        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.TERMINATED, code);
884      throw new FHIRException("Unknown ContractPublicationStatus code '" + codeString + "'");
885    }
886
887    public String toCode(ContractPublicationStatus code) {
888      if (code == ContractPublicationStatus.AMENDED)
889        return "amended";
890      if (code == ContractPublicationStatus.APPENDED)
891        return "appended";
892      if (code == ContractPublicationStatus.CANCELLED)
893        return "cancelled";
894      if (code == ContractPublicationStatus.DISPUTED)
895        return "disputed";
896      if (code == ContractPublicationStatus.ENTEREDINERROR)
897        return "entered-in-error";
898      if (code == ContractPublicationStatus.EXECUTABLE)
899        return "executable";
900      if (code == ContractPublicationStatus.EXECUTED)
901        return "executed";
902      if (code == ContractPublicationStatus.NEGOTIABLE)
903        return "negotiable";
904      if (code == ContractPublicationStatus.OFFERED)
905        return "offered";
906      if (code == ContractPublicationStatus.POLICY)
907        return "policy";
908      if (code == ContractPublicationStatus.REJECTED)
909        return "rejected";
910      if (code == ContractPublicationStatus.RENEWED)
911        return "renewed";
912      if (code == ContractPublicationStatus.REVOKED)
913        return "revoked";
914      if (code == ContractPublicationStatus.RESOLVED)
915        return "resolved";
916      if (code == ContractPublicationStatus.TERMINATED)
917        return "terminated";
918      return "?";
919    }
920
921    public String toSystem(ContractPublicationStatus code) {
922      return code.getSystem();
923    }
924  }
925
926  @Block()
927  public static class ContentDefinitionComponent extends BackboneElement implements IBaseBackboneElement {
928    /**
929     * Precusory content structure and use, i.e., a boilerplate, template,
930     * application for a contract such as an insurance policy or benefits under a
931     * program, e.g., workers compensation.
932     */
933    @Child(name = "type", type = {
934        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
935    @Description(shortDefinition = "Content structure and use", formalDefinition = "Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.")
936    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-definition-type")
937    protected CodeableConcept type;
938
939    /**
940     * Detailed Precusory content type.
941     */
942    @Child(name = "subType", type = {
943        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
944    @Description(shortDefinition = "Detailed Content Type Definition", formalDefinition = "Detailed Precusory content type.")
945    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-definition-subtype")
946    protected CodeableConcept subType;
947
948    /**
949     * The individual or organization that published the Contract precursor content.
950     */
951    @Child(name = "publisher", type = { Practitioner.class, PractitionerRole.class,
952        Organization.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
953    @Description(shortDefinition = "Publisher Entity", formalDefinition = "The  individual or organization that published the Contract precursor content.")
954    protected Reference publisher;
955
956    /**
957     * The actual object that is the target of the reference (The individual or
958     * organization that published the Contract precursor content.)
959     */
960    protected Resource publisherTarget;
961
962    /**
963     * The date (and optionally time) when the contract was published. The date must
964     * change when the business version changes and it must change if the status
965     * code changes. In addition, it should change when the substantive content of
966     * the contract changes.
967     */
968    @Child(name = "publicationDate", type = {
969        DateTimeType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
970    @Description(shortDefinition = "When published", formalDefinition = "The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.")
971    protected DateTimeType publicationDate;
972
973    /**
974     * amended | appended | cancelled | disputed | entered-in-error | executable |
975     * executed | negotiable | offered | policy | rejected | renewed | revoked |
976     * resolved | terminated.
977     */
978    @Child(name = "publicationStatus", type = {
979        CodeType.class }, order = 5, min = 1, max = 1, modifier = false, summary = false)
980    @Description(shortDefinition = "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated", formalDefinition = "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.")
981    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-publicationstatus")
982    protected Enumeration<ContractPublicationStatus> publicationStatus;
983
984    /**
985     * A copyright statement relating to Contract precursor content. Copyright
986     * statements are generally legal restrictions on the use and publishing of the
987     * Contract precursor content.
988     */
989    @Child(name = "copyright", type = {
990        MarkdownType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
991    @Description(shortDefinition = "Publication Ownership", formalDefinition = "A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.")
992    protected MarkdownType copyright;
993
994    private static final long serialVersionUID = -699592864L;
995
996    /**
997     * Constructor
998     */
999    public ContentDefinitionComponent() {
1000      super();
1001    }
1002
1003    /**
1004     * Constructor
1005     */
1006    public ContentDefinitionComponent(CodeableConcept type, Enumeration<ContractPublicationStatus> publicationStatus) {
1007      super();
1008      this.type = type;
1009      this.publicationStatus = publicationStatus;
1010    }
1011
1012    /**
1013     * @return {@link #type} (Precusory content structure and use, i.e., a
1014     *         boilerplate, template, application for a contract such as an
1015     *         insurance policy or benefits under a program, e.g., workers
1016     *         compensation.)
1017     */
1018    public CodeableConcept getType() {
1019      if (this.type == null)
1020        if (Configuration.errorOnAutoCreate())
1021          throw new Error("Attempt to auto-create ContentDefinitionComponent.type");
1022        else if (Configuration.doAutoCreate())
1023          this.type = new CodeableConcept(); // cc
1024      return this.type;
1025    }
1026
1027    public boolean hasType() {
1028      return this.type != null && !this.type.isEmpty();
1029    }
1030
1031    /**
1032     * @param value {@link #type} (Precusory content structure and use, i.e., a
1033     *              boilerplate, template, application for a contract such as an
1034     *              insurance policy or benefits under a program, e.g., workers
1035     *              compensation.)
1036     */
1037    public ContentDefinitionComponent setType(CodeableConcept value) {
1038      this.type = value;
1039      return this;
1040    }
1041
1042    /**
1043     * @return {@link #subType} (Detailed Precusory content type.)
1044     */
1045    public CodeableConcept getSubType() {
1046      if (this.subType == null)
1047        if (Configuration.errorOnAutoCreate())
1048          throw new Error("Attempt to auto-create ContentDefinitionComponent.subType");
1049        else if (Configuration.doAutoCreate())
1050          this.subType = new CodeableConcept(); // cc
1051      return this.subType;
1052    }
1053
1054    public boolean hasSubType() {
1055      return this.subType != null && !this.subType.isEmpty();
1056    }
1057
1058    /**
1059     * @param value {@link #subType} (Detailed Precusory content type.)
1060     */
1061    public ContentDefinitionComponent setSubType(CodeableConcept value) {
1062      this.subType = value;
1063      return this;
1064    }
1065
1066    /**
1067     * @return {@link #publisher} (The individual or organization that published the
1068     *         Contract precursor content.)
1069     */
1070    public Reference getPublisher() {
1071      if (this.publisher == null)
1072        if (Configuration.errorOnAutoCreate())
1073          throw new Error("Attempt to auto-create ContentDefinitionComponent.publisher");
1074        else if (Configuration.doAutoCreate())
1075          this.publisher = new Reference(); // cc
1076      return this.publisher;
1077    }
1078
1079    public boolean hasPublisher() {
1080      return this.publisher != null && !this.publisher.isEmpty();
1081    }
1082
1083    /**
1084     * @param value {@link #publisher} (The individual or organization that
1085     *              published the Contract precursor content.)
1086     */
1087    public ContentDefinitionComponent setPublisher(Reference value) {
1088      this.publisher = value;
1089      return this;
1090    }
1091
1092    /**
1093     * @return {@link #publisher} The actual object that is the target of the
1094     *         reference. The reference library doesn't populate this, but you can
1095     *         use it to hold the resource if you resolve it. (The individual or
1096     *         organization that published the Contract precursor content.)
1097     */
1098    public Resource getPublisherTarget() {
1099      return this.publisherTarget;
1100    }
1101
1102    /**
1103     * @param value {@link #publisher} The actual object that is the target of the
1104     *              reference. The reference library doesn't use these, but you can
1105     *              use it to hold the resource if you resolve it. (The individual
1106     *              or organization that published the Contract precursor content.)
1107     */
1108    public ContentDefinitionComponent setPublisherTarget(Resource value) {
1109      this.publisherTarget = value;
1110      return this;
1111    }
1112
1113    /**
1114     * @return {@link #publicationDate} (The date (and optionally time) when the
1115     *         contract was published. The date must change when the business
1116     *         version changes and it must change if the status code changes. In
1117     *         addition, it should change when the substantive content of the
1118     *         contract changes.). This is the underlying object with id, value and
1119     *         extensions. The accessor "getPublicationDate" gives direct access to
1120     *         the value
1121     */
1122    public DateTimeType getPublicationDateElement() {
1123      if (this.publicationDate == null)
1124        if (Configuration.errorOnAutoCreate())
1125          throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationDate");
1126        else if (Configuration.doAutoCreate())
1127          this.publicationDate = new DateTimeType(); // bb
1128      return this.publicationDate;
1129    }
1130
1131    public boolean hasPublicationDateElement() {
1132      return this.publicationDate != null && !this.publicationDate.isEmpty();
1133    }
1134
1135    public boolean hasPublicationDate() {
1136      return this.publicationDate != null && !this.publicationDate.isEmpty();
1137    }
1138
1139    /**
1140     * @param value {@link #publicationDate} (The date (and optionally time) when
1141     *              the contract was published. The date must change when the
1142     *              business version changes and it must change if the status code
1143     *              changes. In addition, it should change when the substantive
1144     *              content of the contract changes.). This is the underlying object
1145     *              with id, value and extensions. The accessor "getPublicationDate"
1146     *              gives direct access to the value
1147     */
1148    public ContentDefinitionComponent setPublicationDateElement(DateTimeType value) {
1149      this.publicationDate = value;
1150      return this;
1151    }
1152
1153    /**
1154     * @return The date (and optionally time) when the contract was published. The
1155     *         date must change when the business version changes and it must change
1156     *         if the status code changes. In addition, it should change when the
1157     *         substantive content of the contract changes.
1158     */
1159    public Date getPublicationDate() {
1160      return this.publicationDate == null ? null : this.publicationDate.getValue();
1161    }
1162
1163    /**
1164     * @param value The date (and optionally time) when the contract was published.
1165     *              The date must change when the business version changes and it
1166     *              must change if the status code changes. In addition, it should
1167     *              change when the substantive content of the contract changes.
1168     */
1169    public ContentDefinitionComponent setPublicationDate(Date value) {
1170      if (value == null)
1171        this.publicationDate = null;
1172      else {
1173        if (this.publicationDate == null)
1174          this.publicationDate = new DateTimeType();
1175        this.publicationDate.setValue(value);
1176      }
1177      return this;
1178    }
1179
1180    /**
1181     * @return {@link #publicationStatus} (amended | appended | cancelled | disputed
1182     *         | entered-in-error | executable | executed | negotiable | offered |
1183     *         policy | rejected | renewed | revoked | resolved | terminated.). This
1184     *         is the underlying object with id, value and extensions. The accessor
1185     *         "getPublicationStatus" gives direct access to the value
1186     */
1187    public Enumeration<ContractPublicationStatus> getPublicationStatusElement() {
1188      if (this.publicationStatus == null)
1189        if (Configuration.errorOnAutoCreate())
1190          throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationStatus");
1191        else if (Configuration.doAutoCreate())
1192          this.publicationStatus = new Enumeration<ContractPublicationStatus>(
1193              new ContractPublicationStatusEnumFactory()); // bb
1194      return this.publicationStatus;
1195    }
1196
1197    public boolean hasPublicationStatusElement() {
1198      return this.publicationStatus != null && !this.publicationStatus.isEmpty();
1199    }
1200
1201    public boolean hasPublicationStatus() {
1202      return this.publicationStatus != null && !this.publicationStatus.isEmpty();
1203    }
1204
1205    /**
1206     * @param value {@link #publicationStatus} (amended | appended | cancelled |
1207     *              disputed | entered-in-error | executable | executed | negotiable
1208     *              | offered | policy | rejected | renewed | revoked | resolved |
1209     *              terminated.). This is the underlying object with id, value and
1210     *              extensions. The accessor "getPublicationStatus" gives direct
1211     *              access to the value
1212     */
1213    public ContentDefinitionComponent setPublicationStatusElement(Enumeration<ContractPublicationStatus> value) {
1214      this.publicationStatus = value;
1215      return this;
1216    }
1217
1218    /**
1219     * @return amended | appended | cancelled | disputed | entered-in-error |
1220     *         executable | executed | negotiable | offered | policy | rejected |
1221     *         renewed | revoked | resolved | terminated.
1222     */
1223    public ContractPublicationStatus getPublicationStatus() {
1224      return this.publicationStatus == null ? null : this.publicationStatus.getValue();
1225    }
1226
1227    /**
1228     * @param value amended | appended | cancelled | disputed | entered-in-error |
1229     *              executable | executed | negotiable | offered | policy | rejected
1230     *              | renewed | revoked | resolved | terminated.
1231     */
1232    public ContentDefinitionComponent setPublicationStatus(ContractPublicationStatus value) {
1233      if (this.publicationStatus == null)
1234        this.publicationStatus = new Enumeration<ContractPublicationStatus>(new ContractPublicationStatusEnumFactory());
1235      this.publicationStatus.setValue(value);
1236      return this;
1237    }
1238
1239    /**
1240     * @return {@link #copyright} (A copyright statement relating to Contract
1241     *         precursor content. Copyright statements are generally legal
1242     *         restrictions on the use and publishing of the Contract precursor
1243     *         content.). This is the underlying object with id, value and
1244     *         extensions. The accessor "getCopyright" gives direct access to the
1245     *         value
1246     */
1247    public MarkdownType getCopyrightElement() {
1248      if (this.copyright == null)
1249        if (Configuration.errorOnAutoCreate())
1250          throw new Error("Attempt to auto-create ContentDefinitionComponent.copyright");
1251        else if (Configuration.doAutoCreate())
1252          this.copyright = new MarkdownType(); // bb
1253      return this.copyright;
1254    }
1255
1256    public boolean hasCopyrightElement() {
1257      return this.copyright != null && !this.copyright.isEmpty();
1258    }
1259
1260    public boolean hasCopyright() {
1261      return this.copyright != null && !this.copyright.isEmpty();
1262    }
1263
1264    /**
1265     * @param value {@link #copyright} (A copyright statement relating to Contract
1266     *              precursor content. Copyright statements are generally legal
1267     *              restrictions on the use and publishing of the Contract precursor
1268     *              content.). This is the underlying object with id, value and
1269     *              extensions. The accessor "getCopyright" gives direct access to
1270     *              the value
1271     */
1272    public ContentDefinitionComponent setCopyrightElement(MarkdownType value) {
1273      this.copyright = value;
1274      return this;
1275    }
1276
1277    /**
1278     * @return A copyright statement relating to Contract precursor content.
1279     *         Copyright statements are generally legal restrictions on the use and
1280     *         publishing of the Contract precursor content.
1281     */
1282    public String getCopyright() {
1283      return this.copyright == null ? null : this.copyright.getValue();
1284    }
1285
1286    /**
1287     * @param value A copyright statement relating to Contract precursor content.
1288     *              Copyright statements are generally legal restrictions on the use
1289     *              and publishing of the Contract precursor content.
1290     */
1291    public ContentDefinitionComponent setCopyright(String value) {
1292      if (value == null)
1293        this.copyright = null;
1294      else {
1295        if (this.copyright == null)
1296          this.copyright = new MarkdownType();
1297        this.copyright.setValue(value);
1298      }
1299      return this;
1300    }
1301
1302    protected void listChildren(List<Property> children) {
1303      super.listChildren(children);
1304      children.add(new Property("type", "CodeableConcept",
1305          "Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.",
1306          0, 1, type));
1307      children.add(new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType));
1308      children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)",
1309          "The  individual or organization that published the Contract precursor content.", 0, 1, publisher));
1310      children.add(new Property("publicationDate", "dateTime",
1311          "The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.",
1312          0, 1, publicationDate));
1313      children.add(new Property("publicationStatus", "code",
1314          "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.",
1315          0, 1, publicationStatus));
1316      children.add(new Property("copyright", "markdown",
1317          "A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.",
1318          0, 1, copyright));
1319    }
1320
1321    @Override
1322    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1323      switch (_hash) {
1324      case 3575610:
1325        /* type */ return new Property("type", "CodeableConcept",
1326            "Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.",
1327            0, 1, type);
1328      case -1868521062:
1329        /* subType */ return new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1,
1330            subType);
1331      case 1447404028:
1332        /* publisher */ return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)",
1333            "The  individual or organization that published the Contract precursor content.", 0, 1, publisher);
1334      case 1470566394:
1335        /* publicationDate */ return new Property("publicationDate", "dateTime",
1336            "The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.",
1337            0, 1, publicationDate);
1338      case 616500542:
1339        /* publicationStatus */ return new Property("publicationStatus", "code",
1340            "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.",
1341            0, 1, publicationStatus);
1342      case 1522889671:
1343        /* copyright */ return new Property("copyright", "markdown",
1344            "A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.",
1345            0, 1, copyright);
1346      default:
1347        return super.getNamedProperty(_hash, _name, _checkValid);
1348      }
1349
1350    }
1351
1352    @Override
1353    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1354      switch (hash) {
1355      case 3575610:
1356        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1357      case -1868521062:
1358        /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
1359      case 1447404028:
1360        /* publisher */ return this.publisher == null ? new Base[0] : new Base[] { this.publisher }; // Reference
1361      case 1470566394:
1362        /* publicationDate */ return this.publicationDate == null ? new Base[0] : new Base[] { this.publicationDate }; // DateTimeType
1363      case 616500542:
1364        /* publicationStatus */ return this.publicationStatus == null ? new Base[0]
1365            : new Base[] { this.publicationStatus }; // Enumeration<ContractPublicationStatus>
1366      case 1522889671:
1367        /* copyright */ return this.copyright == null ? new Base[0] : new Base[] { this.copyright }; // MarkdownType
1368      default:
1369        return super.getProperty(hash, name, checkValid);
1370      }
1371
1372    }
1373
1374    @Override
1375    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1376      switch (hash) {
1377      case 3575610: // type
1378        this.type = castToCodeableConcept(value); // CodeableConcept
1379        return value;
1380      case -1868521062: // subType
1381        this.subType = castToCodeableConcept(value); // CodeableConcept
1382        return value;
1383      case 1447404028: // publisher
1384        this.publisher = castToReference(value); // Reference
1385        return value;
1386      case 1470566394: // publicationDate
1387        this.publicationDate = castToDateTime(value); // DateTimeType
1388        return value;
1389      case 616500542: // publicationStatus
1390        value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1391        this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1392        return value;
1393      case 1522889671: // copyright
1394        this.copyright = castToMarkdown(value); // MarkdownType
1395        return value;
1396      default:
1397        return super.setProperty(hash, name, value);
1398      }
1399
1400    }
1401
1402    @Override
1403    public Base setProperty(String name, Base value) throws FHIRException {
1404      if (name.equals("type")) {
1405        this.type = castToCodeableConcept(value); // CodeableConcept
1406      } else if (name.equals("subType")) {
1407        this.subType = castToCodeableConcept(value); // CodeableConcept
1408      } else if (name.equals("publisher")) {
1409        this.publisher = castToReference(value); // Reference
1410      } else if (name.equals("publicationDate")) {
1411        this.publicationDate = castToDateTime(value); // DateTimeType
1412      } else if (name.equals("publicationStatus")) {
1413        value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1414        this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1415      } else if (name.equals("copyright")) {
1416        this.copyright = castToMarkdown(value); // MarkdownType
1417      } else
1418        return super.setProperty(name, value);
1419      return value;
1420    }
1421
1422    @Override
1423    public Base makeProperty(int hash, String name) throws FHIRException {
1424      switch (hash) {
1425      case 3575610:
1426        return getType();
1427      case -1868521062:
1428        return getSubType();
1429      case 1447404028:
1430        return getPublisher();
1431      case 1470566394:
1432        return getPublicationDateElement();
1433      case 616500542:
1434        return getPublicationStatusElement();
1435      case 1522889671:
1436        return getCopyrightElement();
1437      default:
1438        return super.makeProperty(hash, name);
1439      }
1440
1441    }
1442
1443    @Override
1444    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1445      switch (hash) {
1446      case 3575610:
1447        /* type */ return new String[] { "CodeableConcept" };
1448      case -1868521062:
1449        /* subType */ return new String[] { "CodeableConcept" };
1450      case 1447404028:
1451        /* publisher */ return new String[] { "Reference" };
1452      case 1470566394:
1453        /* publicationDate */ return new String[] { "dateTime" };
1454      case 616500542:
1455        /* publicationStatus */ return new String[] { "code" };
1456      case 1522889671:
1457        /* copyright */ return new String[] { "markdown" };
1458      default:
1459        return super.getTypesForProperty(hash, name);
1460      }
1461
1462    }
1463
1464    @Override
1465    public Base addChild(String name) throws FHIRException {
1466      if (name.equals("type")) {
1467        this.type = new CodeableConcept();
1468        return this.type;
1469      } else if (name.equals("subType")) {
1470        this.subType = new CodeableConcept();
1471        return this.subType;
1472      } else if (name.equals("publisher")) {
1473        this.publisher = new Reference();
1474        return this.publisher;
1475      } else if (name.equals("publicationDate")) {
1476        throw new FHIRException("Cannot call addChild on a singleton property Contract.publicationDate");
1477      } else if (name.equals("publicationStatus")) {
1478        throw new FHIRException("Cannot call addChild on a singleton property Contract.publicationStatus");
1479      } else if (name.equals("copyright")) {
1480        throw new FHIRException("Cannot call addChild on a singleton property Contract.copyright");
1481      } else
1482        return super.addChild(name);
1483    }
1484
1485    public ContentDefinitionComponent copy() {
1486      ContentDefinitionComponent dst = new ContentDefinitionComponent();
1487      copyValues(dst);
1488      return dst;
1489    }
1490
1491    public void copyValues(ContentDefinitionComponent dst) {
1492      super.copyValues(dst);
1493      dst.type = type == null ? null : type.copy();
1494      dst.subType = subType == null ? null : subType.copy();
1495      dst.publisher = publisher == null ? null : publisher.copy();
1496      dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
1497      dst.publicationStatus = publicationStatus == null ? null : publicationStatus.copy();
1498      dst.copyright = copyright == null ? null : copyright.copy();
1499    }
1500
1501    @Override
1502    public boolean equalsDeep(Base other_) {
1503      if (!super.equalsDeep(other_))
1504        return false;
1505      if (!(other_ instanceof ContentDefinitionComponent))
1506        return false;
1507      ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1508      return compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
1509          && compareDeep(publisher, o.publisher, true) && compareDeep(publicationDate, o.publicationDate, true)
1510          && compareDeep(publicationStatus, o.publicationStatus, true) && compareDeep(copyright, o.copyright, true);
1511    }
1512
1513    @Override
1514    public boolean equalsShallow(Base other_) {
1515      if (!super.equalsShallow(other_))
1516        return false;
1517      if (!(other_ instanceof ContentDefinitionComponent))
1518        return false;
1519      ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1520      return compareValues(publicationDate, o.publicationDate, true)
1521          && compareValues(publicationStatus, o.publicationStatus, true) && compareValues(copyright, o.copyright, true);
1522    }
1523
1524    public boolean isEmpty() {
1525      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, subType, publisher, publicationDate,
1526          publicationStatus, copyright);
1527    }
1528
1529    public String fhirType() {
1530      return "Contract.contentDefinition";
1531
1532    }
1533
1534  }
1535
1536  @Block()
1537  public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1538    /**
1539     * Unique identifier for this particular Contract Provision.
1540     */
1541    @Child(name = "identifier", type = {
1542        Identifier.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
1543    @Description(shortDefinition = "Contract Term Number", formalDefinition = "Unique identifier for this particular Contract Provision.")
1544    protected Identifier identifier;
1545
1546    /**
1547     * When this Contract Provision was issued.
1548     */
1549    @Child(name = "issued", type = {
1550        DateTimeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1551    @Description(shortDefinition = "Contract Term Issue Date Time", formalDefinition = "When this Contract Provision was issued.")
1552    protected DateTimeType issued;
1553
1554    /**
1555     * Relevant time or time-period when this Contract Provision is applicable.
1556     */
1557    @Child(name = "applies", type = { Period.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1558    @Description(shortDefinition = "Contract Term Effective Time", formalDefinition = "Relevant time or time-period when this Contract Provision is applicable.")
1559    protected Period applies;
1560
1561    /**
1562     * The entity that the term applies to.
1563     */
1564    @Child(name = "topic", type = { CodeableConcept.class,
1565        Reference.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1566    @Description(shortDefinition = "Term Concern", formalDefinition = "The entity that the term applies to.")
1567    protected Type topic;
1568
1569    /**
1570     * A legal clause or condition contained within a contract that requires one or
1571     * both parties to perform a particular requirement by some specified time or
1572     * prevents one or both parties from performing a particular requirement by some
1573     * specified time.
1574     */
1575    @Child(name = "type", type = {
1576        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1577    @Description(shortDefinition = "Contract Term Type or Form", formalDefinition = "A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.")
1578    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-term-type")
1579    protected CodeableConcept type;
1580
1581    /**
1582     * A specialized legal clause or condition based on overarching contract type.
1583     */
1584    @Child(name = "subType", type = {
1585        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
1586    @Description(shortDefinition = "Contract Term Type specific classification", formalDefinition = "A specialized legal clause or condition based on overarching contract type.")
1587    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-term-subtype")
1588    protected CodeableConcept subType;
1589
1590    /**
1591     * Statement of a provision in a policy or a contract.
1592     */
1593    @Child(name = "text", type = { StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1594    @Description(shortDefinition = "Term Statement", formalDefinition = "Statement of a provision in a policy or a contract.")
1595    protected StringType text;
1596
1597    /**
1598     * Security labels that protect the handling of information about the term and
1599     * its elements, which may be specifically identified..
1600     */
1601    @Child(name = "securityLabel", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1602    @Description(shortDefinition = "Protection for the Term", formalDefinition = "Security labels that protect the handling of information about the term and its elements, which may be specifically identified..")
1603    protected List<SecurityLabelComponent> securityLabel;
1604
1605    /**
1606     * The matter of concern in the context of this provision of the agrement.
1607     */
1608    @Child(name = "offer", type = {}, order = 9, min = 1, max = 1, modifier = false, summary = false)
1609    @Description(shortDefinition = "Context of the Contract term", formalDefinition = "The matter of concern in the context of this provision of the agrement.")
1610    protected ContractOfferComponent offer;
1611
1612    /**
1613     * Contract Term Asset List.
1614     */
1615    @Child(name = "asset", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1616    @Description(shortDefinition = "Contract Term Asset List", formalDefinition = "Contract Term Asset List.")
1617    protected List<ContractAssetComponent> asset;
1618
1619    /**
1620     * An actor taking a role in an activity for which it can be assigned some
1621     * degree of responsibility for the activity taking place.
1622     */
1623    @Child(name = "action", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1624    @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.")
1625    protected List<ActionComponent> action;
1626
1627    /**
1628     * Nested group of Contract Provisions.
1629     */
1630    @Child(name = "group", type = {
1631        TermComponent.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1632    @Description(shortDefinition = "Nested Contract Term Group", formalDefinition = "Nested group of Contract Provisions.")
1633    protected List<TermComponent> group;
1634
1635    private static final long serialVersionUID = -460907186L;
1636
1637    /**
1638     * Constructor
1639     */
1640    public TermComponent() {
1641      super();
1642    }
1643
1644    /**
1645     * Constructor
1646     */
1647    public TermComponent(ContractOfferComponent offer) {
1648      super();
1649      this.offer = offer;
1650    }
1651
1652    /**
1653     * @return {@link #identifier} (Unique identifier for this particular Contract
1654     *         Provision.)
1655     */
1656    public Identifier getIdentifier() {
1657      if (this.identifier == null)
1658        if (Configuration.errorOnAutoCreate())
1659          throw new Error("Attempt to auto-create TermComponent.identifier");
1660        else if (Configuration.doAutoCreate())
1661          this.identifier = new Identifier(); // cc
1662      return this.identifier;
1663    }
1664
1665    public boolean hasIdentifier() {
1666      return this.identifier != null && !this.identifier.isEmpty();
1667    }
1668
1669    /**
1670     * @param value {@link #identifier} (Unique identifier for this particular
1671     *              Contract Provision.)
1672     */
1673    public TermComponent setIdentifier(Identifier value) {
1674      this.identifier = value;
1675      return this;
1676    }
1677
1678    /**
1679     * @return {@link #issued} (When this Contract Provision was issued.). This is
1680     *         the underlying object with id, value and extensions. The accessor
1681     *         "getIssued" gives direct access to the value
1682     */
1683    public DateTimeType getIssuedElement() {
1684      if (this.issued == null)
1685        if (Configuration.errorOnAutoCreate())
1686          throw new Error("Attempt to auto-create TermComponent.issued");
1687        else if (Configuration.doAutoCreate())
1688          this.issued = new DateTimeType(); // bb
1689      return this.issued;
1690    }
1691
1692    public boolean hasIssuedElement() {
1693      return this.issued != null && !this.issued.isEmpty();
1694    }
1695
1696    public boolean hasIssued() {
1697      return this.issued != null && !this.issued.isEmpty();
1698    }
1699
1700    /**
1701     * @param value {@link #issued} (When this Contract Provision was issued.). This
1702     *              is the underlying object with id, value and extensions. The
1703     *              accessor "getIssued" gives direct access to the value
1704     */
1705    public TermComponent setIssuedElement(DateTimeType value) {
1706      this.issued = value;
1707      return this;
1708    }
1709
1710    /**
1711     * @return When this Contract Provision was issued.
1712     */
1713    public Date getIssued() {
1714      return this.issued == null ? null : this.issued.getValue();
1715    }
1716
1717    /**
1718     * @param value When this Contract Provision was issued.
1719     */
1720    public TermComponent setIssued(Date value) {
1721      if (value == null)
1722        this.issued = null;
1723      else {
1724        if (this.issued == null)
1725          this.issued = new DateTimeType();
1726        this.issued.setValue(value);
1727      }
1728      return this;
1729    }
1730
1731    /**
1732     * @return {@link #applies} (Relevant time or time-period when this Contract
1733     *         Provision is applicable.)
1734     */
1735    public Period getApplies() {
1736      if (this.applies == null)
1737        if (Configuration.errorOnAutoCreate())
1738          throw new Error("Attempt to auto-create TermComponent.applies");
1739        else if (Configuration.doAutoCreate())
1740          this.applies = new Period(); // cc
1741      return this.applies;
1742    }
1743
1744    public boolean hasApplies() {
1745      return this.applies != null && !this.applies.isEmpty();
1746    }
1747
1748    /**
1749     * @param value {@link #applies} (Relevant time or time-period when this
1750     *              Contract Provision is applicable.)
1751     */
1752    public TermComponent setApplies(Period value) {
1753      this.applies = value;
1754      return this;
1755    }
1756
1757    /**
1758     * @return {@link #topic} (The entity that the term applies to.)
1759     */
1760    public Type getTopic() {
1761      return this.topic;
1762    }
1763
1764    /**
1765     * @return {@link #topic} (The entity that the term applies to.)
1766     */
1767    public CodeableConcept getTopicCodeableConcept() throws FHIRException {
1768      if (this.topic == null)
1769        this.topic = new CodeableConcept();
1770      if (!(this.topic instanceof CodeableConcept))
1771        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1772            + this.topic.getClass().getName() + " was encountered");
1773      return (CodeableConcept) this.topic;
1774    }
1775
1776    public boolean hasTopicCodeableConcept() {
1777      return this != null && this.topic instanceof CodeableConcept;
1778    }
1779
1780    /**
1781     * @return {@link #topic} (The entity that the term applies to.)
1782     */
1783    public Reference getTopicReference() throws FHIRException {
1784      if (this.topic == null)
1785        this.topic = new Reference();
1786      if (!(this.topic instanceof Reference))
1787        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.topic.getClass().getName()
1788            + " was encountered");
1789      return (Reference) this.topic;
1790    }
1791
1792    public boolean hasTopicReference() {
1793      return this != null && this.topic instanceof Reference;
1794    }
1795
1796    public boolean hasTopic() {
1797      return this.topic != null && !this.topic.isEmpty();
1798    }
1799
1800    /**
1801     * @param value {@link #topic} (The entity that the term applies to.)
1802     */
1803    public TermComponent setTopic(Type value) {
1804      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1805        throw new Error("Not the right type for Contract.term.topic[x]: " + value.fhirType());
1806      this.topic = value;
1807      return this;
1808    }
1809
1810    /**
1811     * @return {@link #type} (A legal clause or condition contained within a
1812     *         contract that requires one or both parties to perform a particular
1813     *         requirement by some specified time or prevents one or both parties
1814     *         from performing a particular requirement by some specified time.)
1815     */
1816    public CodeableConcept getType() {
1817      if (this.type == null)
1818        if (Configuration.errorOnAutoCreate())
1819          throw new Error("Attempt to auto-create TermComponent.type");
1820        else if (Configuration.doAutoCreate())
1821          this.type = new CodeableConcept(); // cc
1822      return this.type;
1823    }
1824
1825    public boolean hasType() {
1826      return this.type != null && !this.type.isEmpty();
1827    }
1828
1829    /**
1830     * @param value {@link #type} (A legal clause or condition contained within a
1831     *              contract that requires one or both parties to perform a
1832     *              particular requirement by some specified time or prevents one or
1833     *              both parties from performing a particular requirement by some
1834     *              specified time.)
1835     */
1836    public TermComponent setType(CodeableConcept value) {
1837      this.type = value;
1838      return this;
1839    }
1840
1841    /**
1842     * @return {@link #subType} (A specialized legal clause or condition based on
1843     *         overarching contract type.)
1844     */
1845    public CodeableConcept getSubType() {
1846      if (this.subType == null)
1847        if (Configuration.errorOnAutoCreate())
1848          throw new Error("Attempt to auto-create TermComponent.subType");
1849        else if (Configuration.doAutoCreate())
1850          this.subType = new CodeableConcept(); // cc
1851      return this.subType;
1852    }
1853
1854    public boolean hasSubType() {
1855      return this.subType != null && !this.subType.isEmpty();
1856    }
1857
1858    /**
1859     * @param value {@link #subType} (A specialized legal clause or condition based
1860     *              on overarching contract type.)
1861     */
1862    public TermComponent setSubType(CodeableConcept value) {
1863      this.subType = value;
1864      return this;
1865    }
1866
1867    /**
1868     * @return {@link #text} (Statement of a provision in a policy or a contract.).
1869     *         This is the underlying object with id, value and extensions. The
1870     *         accessor "getText" gives direct access to the value
1871     */
1872    public StringType getTextElement() {
1873      if (this.text == null)
1874        if (Configuration.errorOnAutoCreate())
1875          throw new Error("Attempt to auto-create TermComponent.text");
1876        else if (Configuration.doAutoCreate())
1877          this.text = new StringType(); // bb
1878      return this.text;
1879    }
1880
1881    public boolean hasTextElement() {
1882      return this.text != null && !this.text.isEmpty();
1883    }
1884
1885    public boolean hasText() {
1886      return this.text != null && !this.text.isEmpty();
1887    }
1888
1889    /**
1890     * @param value {@link #text} (Statement of a provision in a policy or a
1891     *              contract.). This is the underlying object with id, value and
1892     *              extensions. The accessor "getText" gives direct access to the
1893     *              value
1894     */
1895    public TermComponent setTextElement(StringType value) {
1896      this.text = value;
1897      return this;
1898    }
1899
1900    /**
1901     * @return Statement of a provision in a policy or a contract.
1902     */
1903    public String getText() {
1904      return this.text == null ? null : this.text.getValue();
1905    }
1906
1907    /**
1908     * @param value Statement of a provision in a policy or a contract.
1909     */
1910    public TermComponent setText(String value) {
1911      if (Utilities.noString(value))
1912        this.text = null;
1913      else {
1914        if (this.text == null)
1915          this.text = new StringType();
1916        this.text.setValue(value);
1917      }
1918      return this;
1919    }
1920
1921    /**
1922     * @return {@link #securityLabel} (Security labels that protect the handling of
1923     *         information about the term and its elements, which may be
1924     *         specifically identified..)
1925     */
1926    public List<SecurityLabelComponent> getSecurityLabel() {
1927      if (this.securityLabel == null)
1928        this.securityLabel = new ArrayList<SecurityLabelComponent>();
1929      return this.securityLabel;
1930    }
1931
1932    /**
1933     * @return Returns a reference to <code>this</code> for easy method chaining
1934     */
1935    public TermComponent setSecurityLabel(List<SecurityLabelComponent> theSecurityLabel) {
1936      this.securityLabel = theSecurityLabel;
1937      return this;
1938    }
1939
1940    public boolean hasSecurityLabel() {
1941      if (this.securityLabel == null)
1942        return false;
1943      for (SecurityLabelComponent item : this.securityLabel)
1944        if (!item.isEmpty())
1945          return true;
1946      return false;
1947    }
1948
1949    public SecurityLabelComponent addSecurityLabel() { // 3
1950      SecurityLabelComponent t = new SecurityLabelComponent();
1951      if (this.securityLabel == null)
1952        this.securityLabel = new ArrayList<SecurityLabelComponent>();
1953      this.securityLabel.add(t);
1954      return t;
1955    }
1956
1957    public TermComponent addSecurityLabel(SecurityLabelComponent t) { // 3
1958      if (t == null)
1959        return this;
1960      if (this.securityLabel == null)
1961        this.securityLabel = new ArrayList<SecurityLabelComponent>();
1962      this.securityLabel.add(t);
1963      return this;
1964    }
1965
1966    /**
1967     * @return The first repetition of repeating field {@link #securityLabel},
1968     *         creating it if it does not already exist
1969     */
1970    public SecurityLabelComponent getSecurityLabelFirstRep() {
1971      if (getSecurityLabel().isEmpty()) {
1972        addSecurityLabel();
1973      }
1974      return getSecurityLabel().get(0);
1975    }
1976
1977    /**
1978     * @return {@link #offer} (The matter of concern in the context of this
1979     *         provision of the agrement.)
1980     */
1981    public ContractOfferComponent getOffer() {
1982      if (this.offer == null)
1983        if (Configuration.errorOnAutoCreate())
1984          throw new Error("Attempt to auto-create TermComponent.offer");
1985        else if (Configuration.doAutoCreate())
1986          this.offer = new ContractOfferComponent(); // cc
1987      return this.offer;
1988    }
1989
1990    public boolean hasOffer() {
1991      return this.offer != null && !this.offer.isEmpty();
1992    }
1993
1994    /**
1995     * @param value {@link #offer} (The matter of concern in the context of this
1996     *              provision of the agrement.)
1997     */
1998    public TermComponent setOffer(ContractOfferComponent value) {
1999      this.offer = value;
2000      return this;
2001    }
2002
2003    /**
2004     * @return {@link #asset} (Contract Term Asset List.)
2005     */
2006    public List<ContractAssetComponent> getAsset() {
2007      if (this.asset == null)
2008        this.asset = new ArrayList<ContractAssetComponent>();
2009      return this.asset;
2010    }
2011
2012    /**
2013     * @return Returns a reference to <code>this</code> for easy method chaining
2014     */
2015    public TermComponent setAsset(List<ContractAssetComponent> theAsset) {
2016      this.asset = theAsset;
2017      return this;
2018    }
2019
2020    public boolean hasAsset() {
2021      if (this.asset == null)
2022        return false;
2023      for (ContractAssetComponent item : this.asset)
2024        if (!item.isEmpty())
2025          return true;
2026      return false;
2027    }
2028
2029    public ContractAssetComponent addAsset() { // 3
2030      ContractAssetComponent t = new ContractAssetComponent();
2031      if (this.asset == null)
2032        this.asset = new ArrayList<ContractAssetComponent>();
2033      this.asset.add(t);
2034      return t;
2035    }
2036
2037    public TermComponent addAsset(ContractAssetComponent t) { // 3
2038      if (t == null)
2039        return this;
2040      if (this.asset == null)
2041        this.asset = new ArrayList<ContractAssetComponent>();
2042      this.asset.add(t);
2043      return this;
2044    }
2045
2046    /**
2047     * @return The first repetition of repeating field {@link #asset}, creating it
2048     *         if it does not already exist
2049     */
2050    public ContractAssetComponent getAssetFirstRep() {
2051      if (getAsset().isEmpty()) {
2052        addAsset();
2053      }
2054      return getAsset().get(0);
2055    }
2056
2057    /**
2058     * @return {@link #action} (An actor taking a role in an activity for which it
2059     *         can be assigned some degree of responsibility for the activity taking
2060     *         place.)
2061     */
2062    public List<ActionComponent> getAction() {
2063      if (this.action == null)
2064        this.action = new ArrayList<ActionComponent>();
2065      return this.action;
2066    }
2067
2068    /**
2069     * @return Returns a reference to <code>this</code> for easy method chaining
2070     */
2071    public TermComponent setAction(List<ActionComponent> theAction) {
2072      this.action = theAction;
2073      return this;
2074    }
2075
2076    public boolean hasAction() {
2077      if (this.action == null)
2078        return false;
2079      for (ActionComponent item : this.action)
2080        if (!item.isEmpty())
2081          return true;
2082      return false;
2083    }
2084
2085    public ActionComponent addAction() { // 3
2086      ActionComponent t = new ActionComponent();
2087      if (this.action == null)
2088        this.action = new ArrayList<ActionComponent>();
2089      this.action.add(t);
2090      return t;
2091    }
2092
2093    public TermComponent addAction(ActionComponent t) { // 3
2094      if (t == null)
2095        return this;
2096      if (this.action == null)
2097        this.action = new ArrayList<ActionComponent>();
2098      this.action.add(t);
2099      return this;
2100    }
2101
2102    /**
2103     * @return The first repetition of repeating field {@link #action}, creating it
2104     *         if it does not already exist
2105     */
2106    public ActionComponent getActionFirstRep() {
2107      if (getAction().isEmpty()) {
2108        addAction();
2109      }
2110      return getAction().get(0);
2111    }
2112
2113    /**
2114     * @return {@link #group} (Nested group of Contract Provisions.)
2115     */
2116    public List<TermComponent> getGroup() {
2117      if (this.group == null)
2118        this.group = new ArrayList<TermComponent>();
2119      return this.group;
2120    }
2121
2122    /**
2123     * @return Returns a reference to <code>this</code> for easy method chaining
2124     */
2125    public TermComponent setGroup(List<TermComponent> theGroup) {
2126      this.group = theGroup;
2127      return this;
2128    }
2129
2130    public boolean hasGroup() {
2131      if (this.group == null)
2132        return false;
2133      for (TermComponent item : this.group)
2134        if (!item.isEmpty())
2135          return true;
2136      return false;
2137    }
2138
2139    public TermComponent addGroup() { // 3
2140      TermComponent t = new TermComponent();
2141      if (this.group == null)
2142        this.group = new ArrayList<TermComponent>();
2143      this.group.add(t);
2144      return t;
2145    }
2146
2147    public TermComponent addGroup(TermComponent t) { // 3
2148      if (t == null)
2149        return this;
2150      if (this.group == null)
2151        this.group = new ArrayList<TermComponent>();
2152      this.group.add(t);
2153      return this;
2154    }
2155
2156    /**
2157     * @return The first repetition of repeating field {@link #group}, creating it
2158     *         if it does not already exist
2159     */
2160    public TermComponent getGroupFirstRep() {
2161      if (getGroup().isEmpty()) {
2162        addGroup();
2163      }
2164      return getGroup().get(0);
2165    }
2166
2167    protected void listChildren(List<Property> children) {
2168      super.listChildren(children);
2169      children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.",
2170          0, 1, identifier));
2171      children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
2172      children.add(new Property("applies", "Period",
2173          "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
2174      children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0,
2175          1, topic));
2176      children.add(new Property("type", "CodeableConcept",
2177          "A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.",
2178          0, 1, type));
2179      children.add(new Property("subType", "CodeableConcept",
2180          "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType));
2181      children.add(new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text));
2182      children.add(new Property("securityLabel", "",
2183          "Security labels that protect the handling of information about the term and its elements, which may be specifically identified..",
2184          0, java.lang.Integer.MAX_VALUE, securityLabel));
2185      children.add(new Property("offer", "", "The matter of concern in the context of this provision of the agrement.",
2186          0, 1, offer));
2187      children.add(new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset));
2188      children.add(new Property("action", "",
2189          "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.",
2190          0, java.lang.Integer.MAX_VALUE, action));
2191      children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0,
2192          java.lang.Integer.MAX_VALUE, group));
2193    }
2194
2195    @Override
2196    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2197      switch (_hash) {
2198      case -1618432855:
2199        /* identifier */ return new Property("identifier", "Identifier",
2200            "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
2201      case -1179159893:
2202        /* issued */ return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1,
2203            issued);
2204      case -793235316:
2205        /* applies */ return new Property("applies", "Period",
2206            "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
2207      case -957295375:
2208        /* topic[x] */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2209            "The entity that the term applies to.", 0, 1, topic);
2210      case 110546223:
2211        /* topic */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2212            "The entity that the term applies to.", 0, 1, topic);
2213      case 777778802:
2214        /* topicCodeableConcept */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2215            "The entity that the term applies to.", 0, 1, topic);
2216      case -343345444:
2217        /* topicReference */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2218            "The entity that the term applies to.", 0, 1, topic);
2219      case 3575610:
2220        /* type */ return new Property("type", "CodeableConcept",
2221            "A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.",
2222            0, 1, type);
2223      case -1868521062:
2224        /* subType */ return new Property("subType", "CodeableConcept",
2225            "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType);
2226      case 3556653:
2227        /* text */ return new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1,
2228            text);
2229      case -722296940:
2230        /* securityLabel */ return new Property("securityLabel", "",
2231            "Security labels that protect the handling of information about the term and its elements, which may be specifically identified..",
2232            0, java.lang.Integer.MAX_VALUE, securityLabel);
2233      case 105650780:
2234        /* offer */ return new Property("offer", "",
2235            "The matter of concern in the context of this provision of the agrement.", 0, 1, offer);
2236      case 93121264:
2237        /* asset */ return new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE,
2238            asset);
2239      case -1422950858:
2240        /* action */ return new Property("action", "",
2241            "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.",
2242            0, java.lang.Integer.MAX_VALUE, action);
2243      case 98629247:
2244        /* group */ return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0,
2245            java.lang.Integer.MAX_VALUE, group);
2246      default:
2247        return super.getNamedProperty(_hash, _name, _checkValid);
2248      }
2249
2250    }
2251
2252    @Override
2253    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2254      switch (hash) {
2255      case -1618432855:
2256        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
2257      case -1179159893:
2258        /* issued */ return this.issued == null ? new Base[0] : new Base[] { this.issued }; // DateTimeType
2259      case -793235316:
2260        /* applies */ return this.applies == null ? new Base[0] : new Base[] { this.applies }; // Period
2261      case 110546223:
2262        /* topic */ return this.topic == null ? new Base[0] : new Base[] { this.topic }; // Type
2263      case 3575610:
2264        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2265      case -1868521062:
2266        /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
2267      case 3556653:
2268        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
2269      case -722296940:
2270        /* securityLabel */ return this.securityLabel == null ? new Base[0]
2271            : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // SecurityLabelComponent
2272      case 105650780:
2273        /* offer */ return this.offer == null ? new Base[0] : new Base[] { this.offer }; // ContractOfferComponent
2274      case 93121264:
2275        /* asset */ return this.asset == null ? new Base[0] : this.asset.toArray(new Base[this.asset.size()]); // ContractAssetComponent
2276      case -1422950858:
2277        /* action */ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionComponent
2278      case 98629247:
2279        /* group */ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
2280      default:
2281        return super.getProperty(hash, name, checkValid);
2282      }
2283
2284    }
2285
2286    @Override
2287    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2288      switch (hash) {
2289      case -1618432855: // identifier
2290        this.identifier = castToIdentifier(value); // Identifier
2291        return value;
2292      case -1179159893: // issued
2293        this.issued = castToDateTime(value); // DateTimeType
2294        return value;
2295      case -793235316: // applies
2296        this.applies = castToPeriod(value); // Period
2297        return value;
2298      case 110546223: // topic
2299        this.topic = castToType(value); // Type
2300        return value;
2301      case 3575610: // type
2302        this.type = castToCodeableConcept(value); // CodeableConcept
2303        return value;
2304      case -1868521062: // subType
2305        this.subType = castToCodeableConcept(value); // CodeableConcept
2306        return value;
2307      case 3556653: // text
2308        this.text = castToString(value); // StringType
2309        return value;
2310      case -722296940: // securityLabel
2311        this.getSecurityLabel().add((SecurityLabelComponent) value); // SecurityLabelComponent
2312        return value;
2313      case 105650780: // offer
2314        this.offer = (ContractOfferComponent) value; // ContractOfferComponent
2315        return value;
2316      case 93121264: // asset
2317        this.getAsset().add((ContractAssetComponent) value); // ContractAssetComponent
2318        return value;
2319      case -1422950858: // action
2320        this.getAction().add((ActionComponent) value); // ActionComponent
2321        return value;
2322      case 98629247: // group
2323        this.getGroup().add((TermComponent) value); // TermComponent
2324        return value;
2325      default:
2326        return super.setProperty(hash, name, value);
2327      }
2328
2329    }
2330
2331    @Override
2332    public Base setProperty(String name, Base value) throws FHIRException {
2333      if (name.equals("identifier")) {
2334        this.identifier = castToIdentifier(value); // Identifier
2335      } else if (name.equals("issued")) {
2336        this.issued = castToDateTime(value); // DateTimeType
2337      } else if (name.equals("applies")) {
2338        this.applies = castToPeriod(value); // Period
2339      } else if (name.equals("topic[x]")) {
2340        this.topic = castToType(value); // Type
2341      } else if (name.equals("type")) {
2342        this.type = castToCodeableConcept(value); // CodeableConcept
2343      } else if (name.equals("subType")) {
2344        this.subType = castToCodeableConcept(value); // CodeableConcept
2345      } else if (name.equals("text")) {
2346        this.text = castToString(value); // StringType
2347      } else if (name.equals("securityLabel")) {
2348        this.getSecurityLabel().add((SecurityLabelComponent) value);
2349      } else if (name.equals("offer")) {
2350        this.offer = (ContractOfferComponent) value; // ContractOfferComponent
2351      } else if (name.equals("asset")) {
2352        this.getAsset().add((ContractAssetComponent) value);
2353      } else if (name.equals("action")) {
2354        this.getAction().add((ActionComponent) value);
2355      } else if (name.equals("group")) {
2356        this.getGroup().add((TermComponent) value);
2357      } else
2358        return super.setProperty(name, value);
2359      return value;
2360    }
2361
2362    @Override
2363    public Base makeProperty(int hash, String name) throws FHIRException {
2364      switch (hash) {
2365      case -1618432855:
2366        return getIdentifier();
2367      case -1179159893:
2368        return getIssuedElement();
2369      case -793235316:
2370        return getApplies();
2371      case -957295375:
2372        return getTopic();
2373      case 110546223:
2374        return getTopic();
2375      case 3575610:
2376        return getType();
2377      case -1868521062:
2378        return getSubType();
2379      case 3556653:
2380        return getTextElement();
2381      case -722296940:
2382        return addSecurityLabel();
2383      case 105650780:
2384        return getOffer();
2385      case 93121264:
2386        return addAsset();
2387      case -1422950858:
2388        return addAction();
2389      case 98629247:
2390        return addGroup();
2391      default:
2392        return super.makeProperty(hash, name);
2393      }
2394
2395    }
2396
2397    @Override
2398    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2399      switch (hash) {
2400      case -1618432855:
2401        /* identifier */ return new String[] { "Identifier" };
2402      case -1179159893:
2403        /* issued */ return new String[] { "dateTime" };
2404      case -793235316:
2405        /* applies */ return new String[] { "Period" };
2406      case 110546223:
2407        /* topic */ return new String[] { "CodeableConcept", "Reference" };
2408      case 3575610:
2409        /* type */ return new String[] { "CodeableConcept" };
2410      case -1868521062:
2411        /* subType */ return new String[] { "CodeableConcept" };
2412      case 3556653:
2413        /* text */ return new String[] { "string" };
2414      case -722296940:
2415        /* securityLabel */ return new String[] {};
2416      case 105650780:
2417        /* offer */ return new String[] {};
2418      case 93121264:
2419        /* asset */ return new String[] {};
2420      case -1422950858:
2421        /* action */ return new String[] {};
2422      case 98629247:
2423        /* group */ return new String[] { "@Contract.term" };
2424      default:
2425        return super.getTypesForProperty(hash, name);
2426      }
2427
2428    }
2429
2430    @Override
2431    public Base addChild(String name) throws FHIRException {
2432      if (name.equals("identifier")) {
2433        this.identifier = new Identifier();
2434        return this.identifier;
2435      } else if (name.equals("issued")) {
2436        throw new FHIRException("Cannot call addChild on a singleton property Contract.issued");
2437      } else if (name.equals("applies")) {
2438        this.applies = new Period();
2439        return this.applies;
2440      } else if (name.equals("topicCodeableConcept")) {
2441        this.topic = new CodeableConcept();
2442        return this.topic;
2443      } else if (name.equals("topicReference")) {
2444        this.topic = new Reference();
2445        return this.topic;
2446      } else if (name.equals("type")) {
2447        this.type = new CodeableConcept();
2448        return this.type;
2449      } else if (name.equals("subType")) {
2450        this.subType = new CodeableConcept();
2451        return this.subType;
2452      } else if (name.equals("text")) {
2453        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
2454      } else if (name.equals("securityLabel")) {
2455        return addSecurityLabel();
2456      } else if (name.equals("offer")) {
2457        this.offer = new ContractOfferComponent();
2458        return this.offer;
2459      } else if (name.equals("asset")) {
2460        return addAsset();
2461      } else if (name.equals("action")) {
2462        return addAction();
2463      } else if (name.equals("group")) {
2464        return addGroup();
2465      } else
2466        return super.addChild(name);
2467    }
2468
2469    public TermComponent copy() {
2470      TermComponent dst = new TermComponent();
2471      copyValues(dst);
2472      return dst;
2473    }
2474
2475    public void copyValues(TermComponent dst) {
2476      super.copyValues(dst);
2477      dst.identifier = identifier == null ? null : identifier.copy();
2478      dst.issued = issued == null ? null : issued.copy();
2479      dst.applies = applies == null ? null : applies.copy();
2480      dst.topic = topic == null ? null : topic.copy();
2481      dst.type = type == null ? null : type.copy();
2482      dst.subType = subType == null ? null : subType.copy();
2483      dst.text = text == null ? null : text.copy();
2484      if (securityLabel != null) {
2485        dst.securityLabel = new ArrayList<SecurityLabelComponent>();
2486        for (SecurityLabelComponent i : securityLabel)
2487          dst.securityLabel.add(i.copy());
2488      }
2489      ;
2490      dst.offer = offer == null ? null : offer.copy();
2491      if (asset != null) {
2492        dst.asset = new ArrayList<ContractAssetComponent>();
2493        for (ContractAssetComponent i : asset)
2494          dst.asset.add(i.copy());
2495      }
2496      ;
2497      if (action != null) {
2498        dst.action = new ArrayList<ActionComponent>();
2499        for (ActionComponent i : action)
2500          dst.action.add(i.copy());
2501      }
2502      ;
2503      if (group != null) {
2504        dst.group = new ArrayList<TermComponent>();
2505        for (TermComponent i : group)
2506          dst.group.add(i.copy());
2507      }
2508      ;
2509    }
2510
2511    @Override
2512    public boolean equalsDeep(Base other_) {
2513      if (!super.equalsDeep(other_))
2514        return false;
2515      if (!(other_ instanceof TermComponent))
2516        return false;
2517      TermComponent o = (TermComponent) other_;
2518      return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true)
2519          && compareDeep(applies, o.applies, true) && compareDeep(topic, o.topic, true)
2520          && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(text, o.text, true)
2521          && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(offer, o.offer, true)
2522          && compareDeep(asset, o.asset, true) && compareDeep(action, o.action, true)
2523          && compareDeep(group, o.group, true);
2524    }
2525
2526    @Override
2527    public boolean equalsShallow(Base other_) {
2528      if (!super.equalsShallow(other_))
2529        return false;
2530      if (!(other_ instanceof TermComponent))
2531        return false;
2532      TermComponent o = (TermComponent) other_;
2533      return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2534    }
2535
2536    public boolean isEmpty() {
2537      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies, topic, type, subType,
2538          text, securityLabel, offer, asset, action, group);
2539    }
2540
2541    public String fhirType() {
2542      return "Contract.term";
2543
2544    }
2545
2546  }
2547
2548  @Block()
2549  public static class SecurityLabelComponent extends BackboneElement implements IBaseBackboneElement {
2550    /**
2551     * Number used to link this term or term element to the applicable Security
2552     * Label.
2553     */
2554    @Child(name = "number", type = {
2555        UnsignedIntType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2556    @Description(shortDefinition = "Link to Security Labels", formalDefinition = "Number used to link this term or term element to the applicable Security Label.")
2557    protected List<UnsignedIntType> number;
2558
2559    /**
2560     * Security label privacy tag that species the level of confidentiality
2561     * protection required for this term and/or term elements.
2562     */
2563    @Child(name = "classification", type = {
2564        Coding.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2565    @Description(shortDefinition = "Confidentiality Protection", formalDefinition = "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.")
2566    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-security-classification")
2567    protected Coding classification;
2568
2569    /**
2570     * Security label privacy tag that species the applicable privacy and security
2571     * policies governing this term and/or term elements.
2572     */
2573    @Child(name = "category", type = {
2574        Coding.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2575    @Description(shortDefinition = "Applicable Policy", formalDefinition = "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.")
2576    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-security-category")
2577    protected List<Coding> category;
2578
2579    /**
2580     * Security label privacy tag that species the manner in which term and/or term
2581     * elements are to be protected.
2582     */
2583    @Child(name = "control", type = {
2584        Coding.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2585    @Description(shortDefinition = "Handling Instructions", formalDefinition = "Security label privacy tag that species the manner in which term and/or term elements are to be protected.")
2586    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-security-control")
2587    protected List<Coding> control;
2588
2589    private static final long serialVersionUID = 788281758L;
2590
2591    /**
2592     * Constructor
2593     */
2594    public SecurityLabelComponent() {
2595      super();
2596    }
2597
2598    /**
2599     * Constructor
2600     */
2601    public SecurityLabelComponent(Coding classification) {
2602      super();
2603      this.classification = classification;
2604    }
2605
2606    /**
2607     * @return {@link #number} (Number used to link this term or term element to the
2608     *         applicable Security Label.)
2609     */
2610    public List<UnsignedIntType> getNumber() {
2611      if (this.number == null)
2612        this.number = new ArrayList<UnsignedIntType>();
2613      return this.number;
2614    }
2615
2616    /**
2617     * @return Returns a reference to <code>this</code> for easy method chaining
2618     */
2619    public SecurityLabelComponent setNumber(List<UnsignedIntType> theNumber) {
2620      this.number = theNumber;
2621      return this;
2622    }
2623
2624    public boolean hasNumber() {
2625      if (this.number == null)
2626        return false;
2627      for (UnsignedIntType item : this.number)
2628        if (!item.isEmpty())
2629          return true;
2630      return false;
2631    }
2632
2633    /**
2634     * @return {@link #number} (Number used to link this term or term element to the
2635     *         applicable Security Label.)
2636     */
2637    public UnsignedIntType addNumberElement() {// 2
2638      UnsignedIntType t = new UnsignedIntType();
2639      if (this.number == null)
2640        this.number = new ArrayList<UnsignedIntType>();
2641      this.number.add(t);
2642      return t;
2643    }
2644
2645    /**
2646     * @param value {@link #number} (Number used to link this term or term element
2647     *              to the applicable Security Label.)
2648     */
2649    public SecurityLabelComponent addNumber(int value) { // 1
2650      UnsignedIntType t = new UnsignedIntType();
2651      t.setValue(value);
2652      if (this.number == null)
2653        this.number = new ArrayList<UnsignedIntType>();
2654      this.number.add(t);
2655      return this;
2656    }
2657
2658    /**
2659     * @param value {@link #number} (Number used to link this term or term element
2660     *              to the applicable Security Label.)
2661     */
2662    public boolean hasNumber(int value) {
2663      if (this.number == null)
2664        return false;
2665      for (UnsignedIntType v : this.number)
2666        if (v.getValue().equals(value)) // unsignedInt
2667          return true;
2668      return false;
2669    }
2670
2671    /**
2672     * @return {@link #classification} (Security label privacy tag that species the
2673     *         level of confidentiality protection required for this term and/or
2674     *         term elements.)
2675     */
2676    public Coding getClassification() {
2677      if (this.classification == null)
2678        if (Configuration.errorOnAutoCreate())
2679          throw new Error("Attempt to auto-create SecurityLabelComponent.classification");
2680        else if (Configuration.doAutoCreate())
2681          this.classification = new Coding(); // cc
2682      return this.classification;
2683    }
2684
2685    public boolean hasClassification() {
2686      return this.classification != null && !this.classification.isEmpty();
2687    }
2688
2689    /**
2690     * @param value {@link #classification} (Security label privacy tag that species
2691     *              the level of confidentiality protection required for this term
2692     *              and/or term elements.)
2693     */
2694    public SecurityLabelComponent setClassification(Coding value) {
2695      this.classification = value;
2696      return this;
2697    }
2698
2699    /**
2700     * @return {@link #category} (Security label privacy tag that species the
2701     *         applicable privacy and security policies governing this term and/or
2702     *         term elements.)
2703     */
2704    public List<Coding> getCategory() {
2705      if (this.category == null)
2706        this.category = new ArrayList<Coding>();
2707      return this.category;
2708    }
2709
2710    /**
2711     * @return Returns a reference to <code>this</code> for easy method chaining
2712     */
2713    public SecurityLabelComponent setCategory(List<Coding> theCategory) {
2714      this.category = theCategory;
2715      return this;
2716    }
2717
2718    public boolean hasCategory() {
2719      if (this.category == null)
2720        return false;
2721      for (Coding item : this.category)
2722        if (!item.isEmpty())
2723          return true;
2724      return false;
2725    }
2726
2727    public Coding addCategory() { // 3
2728      Coding t = new Coding();
2729      if (this.category == null)
2730        this.category = new ArrayList<Coding>();
2731      this.category.add(t);
2732      return t;
2733    }
2734
2735    public SecurityLabelComponent addCategory(Coding t) { // 3
2736      if (t == null)
2737        return this;
2738      if (this.category == null)
2739        this.category = new ArrayList<Coding>();
2740      this.category.add(t);
2741      return this;
2742    }
2743
2744    /**
2745     * @return The first repetition of repeating field {@link #category}, creating
2746     *         it if it does not already exist
2747     */
2748    public Coding getCategoryFirstRep() {
2749      if (getCategory().isEmpty()) {
2750        addCategory();
2751      }
2752      return getCategory().get(0);
2753    }
2754
2755    /**
2756     * @return {@link #control} (Security label privacy tag that species the manner
2757     *         in which term and/or term elements are to be protected.)
2758     */
2759    public List<Coding> getControl() {
2760      if (this.control == null)
2761        this.control = new ArrayList<Coding>();
2762      return this.control;
2763    }
2764
2765    /**
2766     * @return Returns a reference to <code>this</code> for easy method chaining
2767     */
2768    public SecurityLabelComponent setControl(List<Coding> theControl) {
2769      this.control = theControl;
2770      return this;
2771    }
2772
2773    public boolean hasControl() {
2774      if (this.control == null)
2775        return false;
2776      for (Coding item : this.control)
2777        if (!item.isEmpty())
2778          return true;
2779      return false;
2780    }
2781
2782    public Coding addControl() { // 3
2783      Coding t = new Coding();
2784      if (this.control == null)
2785        this.control = new ArrayList<Coding>();
2786      this.control.add(t);
2787      return t;
2788    }
2789
2790    public SecurityLabelComponent addControl(Coding t) { // 3
2791      if (t == null)
2792        return this;
2793      if (this.control == null)
2794        this.control = new ArrayList<Coding>();
2795      this.control.add(t);
2796      return this;
2797    }
2798
2799    /**
2800     * @return The first repetition of repeating field {@link #control}, creating it
2801     *         if it does not already exist
2802     */
2803    public Coding getControlFirstRep() {
2804      if (getControl().isEmpty()) {
2805        addControl();
2806      }
2807      return getControl().get(0);
2808    }
2809
2810    protected void listChildren(List<Property> children) {
2811      super.listChildren(children);
2812      children.add(new Property("number", "unsignedInt",
2813          "Number used to link this term or term element to the applicable Security Label.", 0,
2814          java.lang.Integer.MAX_VALUE, number));
2815      children.add(new Property("classification", "Coding",
2816          "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.",
2817          0, 1, classification));
2818      children.add(new Property("category", "Coding",
2819          "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.",
2820          0, java.lang.Integer.MAX_VALUE, category));
2821      children.add(new Property("control", "Coding",
2822          "Security label privacy tag that species the manner in which term and/or term elements are to be protected.",
2823          0, java.lang.Integer.MAX_VALUE, control));
2824    }
2825
2826    @Override
2827    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2828      switch (_hash) {
2829      case -1034364087:
2830        /* number */ return new Property("number", "unsignedInt",
2831            "Number used to link this term or term element to the applicable Security Label.", 0,
2832            java.lang.Integer.MAX_VALUE, number);
2833      case 382350310:
2834        /* classification */ return new Property("classification", "Coding",
2835            "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.",
2836            0, 1, classification);
2837      case 50511102:
2838        /* category */ return new Property("category", "Coding",
2839            "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.",
2840            0, java.lang.Integer.MAX_VALUE, category);
2841      case 951543133:
2842        /* control */ return new Property("control", "Coding",
2843            "Security label privacy tag that species the manner in which term and/or term elements are to be protected.",
2844            0, java.lang.Integer.MAX_VALUE, control);
2845      default:
2846        return super.getNamedProperty(_hash, _name, _checkValid);
2847      }
2848
2849    }
2850
2851    @Override
2852    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2853      switch (hash) {
2854      case -1034364087:
2855        /* number */ return this.number == null ? new Base[0] : this.number.toArray(new Base[this.number.size()]); // UnsignedIntType
2856      case 382350310:
2857        /* classification */ return this.classification == null ? new Base[0] : new Base[] { this.classification }; // Coding
2858      case 50511102:
2859        /* category */ return this.category == null ? new Base[0]
2860            : this.category.toArray(new Base[this.category.size()]); // Coding
2861      case 951543133:
2862        /* control */ return this.control == null ? new Base[0] : this.control.toArray(new Base[this.control.size()]); // Coding
2863      default:
2864        return super.getProperty(hash, name, checkValid);
2865      }
2866
2867    }
2868
2869    @Override
2870    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2871      switch (hash) {
2872      case -1034364087: // number
2873        this.getNumber().add(castToUnsignedInt(value)); // UnsignedIntType
2874        return value;
2875      case 382350310: // classification
2876        this.classification = castToCoding(value); // Coding
2877        return value;
2878      case 50511102: // category
2879        this.getCategory().add(castToCoding(value)); // Coding
2880        return value;
2881      case 951543133: // control
2882        this.getControl().add(castToCoding(value)); // Coding
2883        return value;
2884      default:
2885        return super.setProperty(hash, name, value);
2886      }
2887
2888    }
2889
2890    @Override
2891    public Base setProperty(String name, Base value) throws FHIRException {
2892      if (name.equals("number")) {
2893        this.getNumber().add(castToUnsignedInt(value));
2894      } else if (name.equals("classification")) {
2895        this.classification = castToCoding(value); // Coding
2896      } else if (name.equals("category")) {
2897        this.getCategory().add(castToCoding(value));
2898      } else if (name.equals("control")) {
2899        this.getControl().add(castToCoding(value));
2900      } else
2901        return super.setProperty(name, value);
2902      return value;
2903    }
2904
2905    @Override
2906    public Base makeProperty(int hash, String name) throws FHIRException {
2907      switch (hash) {
2908      case -1034364087:
2909        return addNumberElement();
2910      case 382350310:
2911        return getClassification();
2912      case 50511102:
2913        return addCategory();
2914      case 951543133:
2915        return addControl();
2916      default:
2917        return super.makeProperty(hash, name);
2918      }
2919
2920    }
2921
2922    @Override
2923    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2924      switch (hash) {
2925      case -1034364087:
2926        /* number */ return new String[] { "unsignedInt" };
2927      case 382350310:
2928        /* classification */ return new String[] { "Coding" };
2929      case 50511102:
2930        /* category */ return new String[] { "Coding" };
2931      case 951543133:
2932        /* control */ return new String[] { "Coding" };
2933      default:
2934        return super.getTypesForProperty(hash, name);
2935      }
2936
2937    }
2938
2939    @Override
2940    public Base addChild(String name) throws FHIRException {
2941      if (name.equals("number")) {
2942        throw new FHIRException("Cannot call addChild on a singleton property Contract.number");
2943      } else if (name.equals("classification")) {
2944        this.classification = new Coding();
2945        return this.classification;
2946      } else if (name.equals("category")) {
2947        return addCategory();
2948      } else if (name.equals("control")) {
2949        return addControl();
2950      } else
2951        return super.addChild(name);
2952    }
2953
2954    public SecurityLabelComponent copy() {
2955      SecurityLabelComponent dst = new SecurityLabelComponent();
2956      copyValues(dst);
2957      return dst;
2958    }
2959
2960    public void copyValues(SecurityLabelComponent dst) {
2961      super.copyValues(dst);
2962      if (number != null) {
2963        dst.number = new ArrayList<UnsignedIntType>();
2964        for (UnsignedIntType i : number)
2965          dst.number.add(i.copy());
2966      }
2967      ;
2968      dst.classification = classification == null ? null : classification.copy();
2969      if (category != null) {
2970        dst.category = new ArrayList<Coding>();
2971        for (Coding i : category)
2972          dst.category.add(i.copy());
2973      }
2974      ;
2975      if (control != null) {
2976        dst.control = new ArrayList<Coding>();
2977        for (Coding i : control)
2978          dst.control.add(i.copy());
2979      }
2980      ;
2981    }
2982
2983    @Override
2984    public boolean equalsDeep(Base other_) {
2985      if (!super.equalsDeep(other_))
2986        return false;
2987      if (!(other_ instanceof SecurityLabelComponent))
2988        return false;
2989      SecurityLabelComponent o = (SecurityLabelComponent) other_;
2990      return compareDeep(number, o.number, true) && compareDeep(classification, o.classification, true)
2991          && compareDeep(category, o.category, true) && compareDeep(control, o.control, true);
2992    }
2993
2994    @Override
2995    public boolean equalsShallow(Base other_) {
2996      if (!super.equalsShallow(other_))
2997        return false;
2998      if (!(other_ instanceof SecurityLabelComponent))
2999        return false;
3000      SecurityLabelComponent o = (SecurityLabelComponent) other_;
3001      return compareValues(number, o.number, true);
3002    }
3003
3004    public boolean isEmpty() {
3005      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, classification, category, control);
3006    }
3007
3008    public String fhirType() {
3009      return "Contract.term.securityLabel";
3010
3011    }
3012
3013  }
3014
3015  @Block()
3016  public static class ContractOfferComponent extends BackboneElement implements IBaseBackboneElement {
3017    /**
3018     * Unique identifier for this particular Contract Provision.
3019     */
3020    @Child(name = "identifier", type = {
3021        Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3022    @Description(shortDefinition = "Offer business ID", formalDefinition = "Unique identifier for this particular Contract Provision.")
3023    protected List<Identifier> identifier;
3024
3025    /**
3026     * Offer Recipient.
3027     */
3028    @Child(name = "party", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3029    @Description(shortDefinition = "Offer Recipient", formalDefinition = "Offer Recipient.")
3030    protected List<ContractPartyComponent> party;
3031
3032    /**
3033     * The owner of an asset has the residual control rights over the asset: the
3034     * right to decide all usages of the asset in any way not inconsistent with a
3035     * prior contract, custom, or law (Hart, 1995, p. 30).
3036     */
3037    @Child(name = "topic", type = { Reference.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
3038    @Description(shortDefinition = "Negotiable offer asset", formalDefinition = "The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).")
3039    protected Reference topic;
3040
3041    /**
3042     * The actual object that is the target of the reference (The owner of an asset
3043     * has the residual control rights over the asset: the right to decide all
3044     * usages of the asset in any way not inconsistent with a prior contract,
3045     * custom, or law (Hart, 1995, p. 30).)
3046     */
3047    protected Resource topicTarget;
3048
3049    /**
3050     * Type of Contract Provision such as specific requirements, purposes for
3051     * actions, obligations, prohibitions, e.g. life time maximum benefit.
3052     */
3053    @Child(name = "type", type = {
3054        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
3055    @Description(shortDefinition = "Contract Offer Type or Form", formalDefinition = "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.")
3056    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-term-type")
3057    protected CodeableConcept type;
3058
3059    /**
3060     * Type of choice made by accepting party with respect to an offer made by an
3061     * offeror/ grantee.
3062     */
3063    @Child(name = "decision", type = {
3064        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
3065    @Description(shortDefinition = "Accepting party choice", formalDefinition = "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.")
3066    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActConsentDirective")
3067    protected CodeableConcept decision;
3068
3069    /**
3070     * How the decision about a Contract was conveyed.
3071     */
3072    @Child(name = "decisionMode", type = {
3073        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3074    @Description(shortDefinition = "How decision is conveyed", formalDefinition = "How the decision about a Contract was conveyed.")
3075    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-decision-mode")
3076    protected List<CodeableConcept> decisionMode;
3077
3078    /**
3079     * Response to offer text.
3080     */
3081    @Child(name = "answer", type = {}, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3082    @Description(shortDefinition = "Response to offer text", formalDefinition = "Response to offer text.")
3083    protected List<AnswerComponent> answer;
3084
3085    /**
3086     * Human readable form of this Contract Offer.
3087     */
3088    @Child(name = "text", type = { StringType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
3089    @Description(shortDefinition = "Human readable offer text", formalDefinition = "Human readable form of this Contract Offer.")
3090    protected StringType text;
3091
3092    /**
3093     * The id of the clause or question text of the offer in the referenced
3094     * questionnaire/response.
3095     */
3096    @Child(name = "linkId", type = {
3097        StringType.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3098    @Description(shortDefinition = "Pointer to text", formalDefinition = "The id of the clause or question text of the offer in the referenced questionnaire/response.")
3099    protected List<StringType> linkId;
3100
3101    /**
3102     * Security labels that protects the offer.
3103     */
3104    @Child(name = "securityLabelNumber", type = {
3105        UnsignedIntType.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3106    @Description(shortDefinition = "Offer restriction numbers", formalDefinition = "Security labels that protects the offer.")
3107    protected List<UnsignedIntType> securityLabelNumber;
3108
3109    private static final long serialVersionUID = -395674449L;
3110
3111    /**
3112     * Constructor
3113     */
3114    public ContractOfferComponent() {
3115      super();
3116    }
3117
3118    /**
3119     * @return {@link #identifier} (Unique identifier for this particular Contract
3120     *         Provision.)
3121     */
3122    public List<Identifier> getIdentifier() {
3123      if (this.identifier == null)
3124        this.identifier = new ArrayList<Identifier>();
3125      return this.identifier;
3126    }
3127
3128    /**
3129     * @return Returns a reference to <code>this</code> for easy method chaining
3130     */
3131    public ContractOfferComponent setIdentifier(List<Identifier> theIdentifier) {
3132      this.identifier = theIdentifier;
3133      return this;
3134    }
3135
3136    public boolean hasIdentifier() {
3137      if (this.identifier == null)
3138        return false;
3139      for (Identifier item : this.identifier)
3140        if (!item.isEmpty())
3141          return true;
3142      return false;
3143    }
3144
3145    public Identifier addIdentifier() { // 3
3146      Identifier t = new Identifier();
3147      if (this.identifier == null)
3148        this.identifier = new ArrayList<Identifier>();
3149      this.identifier.add(t);
3150      return t;
3151    }
3152
3153    public ContractOfferComponent addIdentifier(Identifier t) { // 3
3154      if (t == null)
3155        return this;
3156      if (this.identifier == null)
3157        this.identifier = new ArrayList<Identifier>();
3158      this.identifier.add(t);
3159      return this;
3160    }
3161
3162    /**
3163     * @return The first repetition of repeating field {@link #identifier}, creating
3164     *         it if it does not already exist
3165     */
3166    public Identifier getIdentifierFirstRep() {
3167      if (getIdentifier().isEmpty()) {
3168        addIdentifier();
3169      }
3170      return getIdentifier().get(0);
3171    }
3172
3173    /**
3174     * @return {@link #party} (Offer Recipient.)
3175     */
3176    public List<ContractPartyComponent> getParty() {
3177      if (this.party == null)
3178        this.party = new ArrayList<ContractPartyComponent>();
3179      return this.party;
3180    }
3181
3182    /**
3183     * @return Returns a reference to <code>this</code> for easy method chaining
3184     */
3185    public ContractOfferComponent setParty(List<ContractPartyComponent> theParty) {
3186      this.party = theParty;
3187      return this;
3188    }
3189
3190    public boolean hasParty() {
3191      if (this.party == null)
3192        return false;
3193      for (ContractPartyComponent item : this.party)
3194        if (!item.isEmpty())
3195          return true;
3196      return false;
3197    }
3198
3199    public ContractPartyComponent addParty() { // 3
3200      ContractPartyComponent t = new ContractPartyComponent();
3201      if (this.party == null)
3202        this.party = new ArrayList<ContractPartyComponent>();
3203      this.party.add(t);
3204      return t;
3205    }
3206
3207    public ContractOfferComponent addParty(ContractPartyComponent t) { // 3
3208      if (t == null)
3209        return this;
3210      if (this.party == null)
3211        this.party = new ArrayList<ContractPartyComponent>();
3212      this.party.add(t);
3213      return this;
3214    }
3215
3216    /**
3217     * @return The first repetition of repeating field {@link #party}, creating it
3218     *         if it does not already exist
3219     */
3220    public ContractPartyComponent getPartyFirstRep() {
3221      if (getParty().isEmpty()) {
3222        addParty();
3223      }
3224      return getParty().get(0);
3225    }
3226
3227    /**
3228     * @return {@link #topic} (The owner of an asset has the residual control rights
3229     *         over the asset: the right to decide all usages of the asset in any
3230     *         way not inconsistent with a prior contract, custom, or law (Hart,
3231     *         1995, p. 30).)
3232     */
3233    public Reference getTopic() {
3234      if (this.topic == null)
3235        if (Configuration.errorOnAutoCreate())
3236          throw new Error("Attempt to auto-create ContractOfferComponent.topic");
3237        else if (Configuration.doAutoCreate())
3238          this.topic = new Reference(); // cc
3239      return this.topic;
3240    }
3241
3242    public boolean hasTopic() {
3243      return this.topic != null && !this.topic.isEmpty();
3244    }
3245
3246    /**
3247     * @param value {@link #topic} (The owner of an asset has the residual control
3248     *              rights over the asset: the right to decide all usages of the
3249     *              asset in any way not inconsistent with a prior contract, custom,
3250     *              or law (Hart, 1995, p. 30).)
3251     */
3252    public ContractOfferComponent setTopic(Reference value) {
3253      this.topic = value;
3254      return this;
3255    }
3256
3257    /**
3258     * @return {@link #topic} The actual object that is the target of the reference.
3259     *         The reference library doesn't populate this, but you can use it to
3260     *         hold the resource if you resolve it. (The owner of an asset has the
3261     *         residual control rights over the asset: the right to decide all
3262     *         usages of the asset in any way not inconsistent with a prior
3263     *         contract, custom, or law (Hart, 1995, p. 30).)
3264     */
3265    public Resource getTopicTarget() {
3266      return this.topicTarget;
3267    }
3268
3269    /**
3270     * @param value {@link #topic} The actual object that is the target of the
3271     *              reference. The reference library doesn't use these, but you can
3272     *              use it to hold the resource if you resolve it. (The owner of an
3273     *              asset has the residual control rights over the asset: the right
3274     *              to decide all usages of the asset in any way not inconsistent
3275     *              with a prior contract, custom, or law (Hart, 1995, p. 30).)
3276     */
3277    public ContractOfferComponent setTopicTarget(Resource value) {
3278      this.topicTarget = value;
3279      return this;
3280    }
3281
3282    /**
3283     * @return {@link #type} (Type of Contract Provision such as specific
3284     *         requirements, purposes for actions, obligations, prohibitions, e.g.
3285     *         life time maximum benefit.)
3286     */
3287    public CodeableConcept getType() {
3288      if (this.type == null)
3289        if (Configuration.errorOnAutoCreate())
3290          throw new Error("Attempt to auto-create ContractOfferComponent.type");
3291        else if (Configuration.doAutoCreate())
3292          this.type = new CodeableConcept(); // cc
3293      return this.type;
3294    }
3295
3296    public boolean hasType() {
3297      return this.type != null && !this.type.isEmpty();
3298    }
3299
3300    /**
3301     * @param value {@link #type} (Type of Contract Provision such as specific
3302     *              requirements, purposes for actions, obligations, prohibitions,
3303     *              e.g. life time maximum benefit.)
3304     */
3305    public ContractOfferComponent setType(CodeableConcept value) {
3306      this.type = value;
3307      return this;
3308    }
3309
3310    /**
3311     * @return {@link #decision} (Type of choice made by accepting party with
3312     *         respect to an offer made by an offeror/ grantee.)
3313     */
3314    public CodeableConcept getDecision() {
3315      if (this.decision == null)
3316        if (Configuration.errorOnAutoCreate())
3317          throw new Error("Attempt to auto-create ContractOfferComponent.decision");
3318        else if (Configuration.doAutoCreate())
3319          this.decision = new CodeableConcept(); // cc
3320      return this.decision;
3321    }
3322
3323    public boolean hasDecision() {
3324      return this.decision != null && !this.decision.isEmpty();
3325    }
3326
3327    /**
3328     * @param value {@link #decision} (Type of choice made by accepting party with
3329     *              respect to an offer made by an offeror/ grantee.)
3330     */
3331    public ContractOfferComponent setDecision(CodeableConcept value) {
3332      this.decision = value;
3333      return this;
3334    }
3335
3336    /**
3337     * @return {@link #decisionMode} (How the decision about a Contract was
3338     *         conveyed.)
3339     */
3340    public List<CodeableConcept> getDecisionMode() {
3341      if (this.decisionMode == null)
3342        this.decisionMode = new ArrayList<CodeableConcept>();
3343      return this.decisionMode;
3344    }
3345
3346    /**
3347     * @return Returns a reference to <code>this</code> for easy method chaining
3348     */
3349    public ContractOfferComponent setDecisionMode(List<CodeableConcept> theDecisionMode) {
3350      this.decisionMode = theDecisionMode;
3351      return this;
3352    }
3353
3354    public boolean hasDecisionMode() {
3355      if (this.decisionMode == null)
3356        return false;
3357      for (CodeableConcept item : this.decisionMode)
3358        if (!item.isEmpty())
3359          return true;
3360      return false;
3361    }
3362
3363    public CodeableConcept addDecisionMode() { // 3
3364      CodeableConcept t = new CodeableConcept();
3365      if (this.decisionMode == null)
3366        this.decisionMode = new ArrayList<CodeableConcept>();
3367      this.decisionMode.add(t);
3368      return t;
3369    }
3370
3371    public ContractOfferComponent addDecisionMode(CodeableConcept t) { // 3
3372      if (t == null)
3373        return this;
3374      if (this.decisionMode == null)
3375        this.decisionMode = new ArrayList<CodeableConcept>();
3376      this.decisionMode.add(t);
3377      return this;
3378    }
3379
3380    /**
3381     * @return The first repetition of repeating field {@link #decisionMode},
3382     *         creating it if it does not already exist
3383     */
3384    public CodeableConcept getDecisionModeFirstRep() {
3385      if (getDecisionMode().isEmpty()) {
3386        addDecisionMode();
3387      }
3388      return getDecisionMode().get(0);
3389    }
3390
3391    /**
3392     * @return {@link #answer} (Response to offer text.)
3393     */
3394    public List<AnswerComponent> getAnswer() {
3395      if (this.answer == null)
3396        this.answer = new ArrayList<AnswerComponent>();
3397      return this.answer;
3398    }
3399
3400    /**
3401     * @return Returns a reference to <code>this</code> for easy method chaining
3402     */
3403    public ContractOfferComponent setAnswer(List<AnswerComponent> theAnswer) {
3404      this.answer = theAnswer;
3405      return this;
3406    }
3407
3408    public boolean hasAnswer() {
3409      if (this.answer == null)
3410        return false;
3411      for (AnswerComponent item : this.answer)
3412        if (!item.isEmpty())
3413          return true;
3414      return false;
3415    }
3416
3417    public AnswerComponent addAnswer() { // 3
3418      AnswerComponent t = new AnswerComponent();
3419      if (this.answer == null)
3420        this.answer = new ArrayList<AnswerComponent>();
3421      this.answer.add(t);
3422      return t;
3423    }
3424
3425    public ContractOfferComponent addAnswer(AnswerComponent t) { // 3
3426      if (t == null)
3427        return this;
3428      if (this.answer == null)
3429        this.answer = new ArrayList<AnswerComponent>();
3430      this.answer.add(t);
3431      return this;
3432    }
3433
3434    /**
3435     * @return The first repetition of repeating field {@link #answer}, creating it
3436     *         if it does not already exist
3437     */
3438    public AnswerComponent getAnswerFirstRep() {
3439      if (getAnswer().isEmpty()) {
3440        addAnswer();
3441      }
3442      return getAnswer().get(0);
3443    }
3444
3445    /**
3446     * @return {@link #text} (Human readable form of this Contract Offer.). This is
3447     *         the underlying object with id, value and extensions. The accessor
3448     *         "getText" gives direct access to the value
3449     */
3450    public StringType getTextElement() {
3451      if (this.text == null)
3452        if (Configuration.errorOnAutoCreate())
3453          throw new Error("Attempt to auto-create ContractOfferComponent.text");
3454        else if (Configuration.doAutoCreate())
3455          this.text = new StringType(); // bb
3456      return this.text;
3457    }
3458
3459    public boolean hasTextElement() {
3460      return this.text != null && !this.text.isEmpty();
3461    }
3462
3463    public boolean hasText() {
3464      return this.text != null && !this.text.isEmpty();
3465    }
3466
3467    /**
3468     * @param value {@link #text} (Human readable form of this Contract Offer.).
3469     *              This is the underlying object with id, value and extensions. The
3470     *              accessor "getText" gives direct access to the value
3471     */
3472    public ContractOfferComponent setTextElement(StringType value) {
3473      this.text = value;
3474      return this;
3475    }
3476
3477    /**
3478     * @return Human readable form of this Contract Offer.
3479     */
3480    public String getText() {
3481      return this.text == null ? null : this.text.getValue();
3482    }
3483
3484    /**
3485     * @param value Human readable form of this Contract Offer.
3486     */
3487    public ContractOfferComponent setText(String value) {
3488      if (Utilities.noString(value))
3489        this.text = null;
3490      else {
3491        if (this.text == null)
3492          this.text = new StringType();
3493        this.text.setValue(value);
3494      }
3495      return this;
3496    }
3497
3498    /**
3499     * @return {@link #linkId} (The id of the clause or question text of the offer
3500     *         in the referenced questionnaire/response.)
3501     */
3502    public List<StringType> getLinkId() {
3503      if (this.linkId == null)
3504        this.linkId = new ArrayList<StringType>();
3505      return this.linkId;
3506    }
3507
3508    /**
3509     * @return Returns a reference to <code>this</code> for easy method chaining
3510     */
3511    public ContractOfferComponent setLinkId(List<StringType> theLinkId) {
3512      this.linkId = theLinkId;
3513      return this;
3514    }
3515
3516    public boolean hasLinkId() {
3517      if (this.linkId == null)
3518        return false;
3519      for (StringType item : this.linkId)
3520        if (!item.isEmpty())
3521          return true;
3522      return false;
3523    }
3524
3525    /**
3526     * @return {@link #linkId} (The id of the clause or question text of the offer
3527     *         in the referenced questionnaire/response.)
3528     */
3529    public StringType addLinkIdElement() {// 2
3530      StringType t = new StringType();
3531      if (this.linkId == null)
3532        this.linkId = new ArrayList<StringType>();
3533      this.linkId.add(t);
3534      return t;
3535    }
3536
3537    /**
3538     * @param value {@link #linkId} (The id of the clause or question text of the
3539     *              offer in the referenced questionnaire/response.)
3540     */
3541    public ContractOfferComponent addLinkId(String value) { // 1
3542      StringType t = new StringType();
3543      t.setValue(value);
3544      if (this.linkId == null)
3545        this.linkId = new ArrayList<StringType>();
3546      this.linkId.add(t);
3547      return this;
3548    }
3549
3550    /**
3551     * @param value {@link #linkId} (The id of the clause or question text of the
3552     *              offer in the referenced questionnaire/response.)
3553     */
3554    public boolean hasLinkId(String value) {
3555      if (this.linkId == null)
3556        return false;
3557      for (StringType v : this.linkId)
3558        if (v.getValue().equals(value)) // string
3559          return true;
3560      return false;
3561    }
3562
3563    /**
3564     * @return {@link #securityLabelNumber} (Security labels that protects the
3565     *         offer.)
3566     */
3567    public List<UnsignedIntType> getSecurityLabelNumber() {
3568      if (this.securityLabelNumber == null)
3569        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
3570      return this.securityLabelNumber;
3571    }
3572
3573    /**
3574     * @return Returns a reference to <code>this</code> for easy method chaining
3575     */
3576    public ContractOfferComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
3577      this.securityLabelNumber = theSecurityLabelNumber;
3578      return this;
3579    }
3580
3581    public boolean hasSecurityLabelNumber() {
3582      if (this.securityLabelNumber == null)
3583        return false;
3584      for (UnsignedIntType item : this.securityLabelNumber)
3585        if (!item.isEmpty())
3586          return true;
3587      return false;
3588    }
3589
3590    /**
3591     * @return {@link #securityLabelNumber} (Security labels that protects the
3592     *         offer.)
3593     */
3594    public UnsignedIntType addSecurityLabelNumberElement() {// 2
3595      UnsignedIntType t = new UnsignedIntType();
3596      if (this.securityLabelNumber == null)
3597        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
3598      this.securityLabelNumber.add(t);
3599      return t;
3600    }
3601
3602    /**
3603     * @param value {@link #securityLabelNumber} (Security labels that protects the
3604     *              offer.)
3605     */
3606    public ContractOfferComponent addSecurityLabelNumber(int value) { // 1
3607      UnsignedIntType t = new UnsignedIntType();
3608      t.setValue(value);
3609      if (this.securityLabelNumber == null)
3610        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
3611      this.securityLabelNumber.add(t);
3612      return this;
3613    }
3614
3615    /**
3616     * @param value {@link #securityLabelNumber} (Security labels that protects the
3617     *              offer.)
3618     */
3619    public boolean hasSecurityLabelNumber(int value) {
3620      if (this.securityLabelNumber == null)
3621        return false;
3622      for (UnsignedIntType v : this.securityLabelNumber)
3623        if (v.getValue().equals(value)) // unsignedInt
3624          return true;
3625      return false;
3626    }
3627
3628    protected void listChildren(List<Property> children) {
3629      super.listChildren(children);
3630      children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.",
3631          0, java.lang.Integer.MAX_VALUE, identifier));
3632      children.add(new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party));
3633      children.add(new Property("topic", "Reference(Any)",
3634          "The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).",
3635          0, 1, topic));
3636      children.add(new Property("type", "CodeableConcept",
3637          "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.",
3638          0, 1, type));
3639      children.add(new Property("decision", "CodeableConcept",
3640          "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.", 0, 1,
3641          decision));
3642      children.add(new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0,
3643          java.lang.Integer.MAX_VALUE, decisionMode));
3644      children.add(new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer));
3645      children.add(new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text));
3646      children.add(new Property("linkId", "string",
3647          "The id of the clause or question text of the offer in the referenced questionnaire/response.", 0,
3648          java.lang.Integer.MAX_VALUE, linkId));
3649      children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0,
3650          java.lang.Integer.MAX_VALUE, securityLabelNumber));
3651    }
3652
3653    @Override
3654    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3655      switch (_hash) {
3656      case -1618432855:
3657        /* identifier */ return new Property("identifier", "Identifier",
3658            "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier);
3659      case 106437350:
3660        /* party */ return new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party);
3661      case 110546223:
3662        /* topic */ return new Property("topic", "Reference(Any)",
3663            "The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).",
3664            0, 1, topic);
3665      case 3575610:
3666        /* type */ return new Property("type", "CodeableConcept",
3667            "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.",
3668            0, 1, type);
3669      case 565719004:
3670        /* decision */ return new Property("decision", "CodeableConcept",
3671            "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.", 0, 1,
3672            decision);
3673      case 675909535:
3674        /* decisionMode */ return new Property("decisionMode", "CodeableConcept",
3675            "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode);
3676      case -1412808770:
3677        /* answer */ return new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE,
3678            answer);
3679      case 3556653:
3680        /* text */ return new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text);
3681      case -1102667083:
3682        /* linkId */ return new Property("linkId", "string",
3683            "The id of the clause or question text of the offer in the referenced questionnaire/response.", 0,
3684            java.lang.Integer.MAX_VALUE, linkId);
3685      case -149460995:
3686        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
3687            "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
3688      default:
3689        return super.getNamedProperty(_hash, _name, _checkValid);
3690      }
3691
3692    }
3693
3694    @Override
3695    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3696      switch (hash) {
3697      case -1618432855:
3698        /* identifier */ return this.identifier == null ? new Base[0]
3699            : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3700      case 106437350:
3701        /* party */ return this.party == null ? new Base[0] : this.party.toArray(new Base[this.party.size()]); // ContractPartyComponent
3702      case 110546223:
3703        /* topic */ return this.topic == null ? new Base[0] : new Base[] { this.topic }; // Reference
3704      case 3575610:
3705        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3706      case 565719004:
3707        /* decision */ return this.decision == null ? new Base[0] : new Base[] { this.decision }; // CodeableConcept
3708      case 675909535:
3709        /* decisionMode */ return this.decisionMode == null ? new Base[0]
3710            : this.decisionMode.toArray(new Base[this.decisionMode.size()]); // CodeableConcept
3711      case -1412808770:
3712        /* answer */ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
3713      case 3556653:
3714        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
3715      case -1102667083:
3716        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
3717      case -149460995:
3718        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
3719            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
3720      default:
3721        return super.getProperty(hash, name, checkValid);
3722      }
3723
3724    }
3725
3726    @Override
3727    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3728      switch (hash) {
3729      case -1618432855: // identifier
3730        this.getIdentifier().add(castToIdentifier(value)); // Identifier
3731        return value;
3732      case 106437350: // party
3733        this.getParty().add((ContractPartyComponent) value); // ContractPartyComponent
3734        return value;
3735      case 110546223: // topic
3736        this.topic = castToReference(value); // Reference
3737        return value;
3738      case 3575610: // type
3739        this.type = castToCodeableConcept(value); // CodeableConcept
3740        return value;
3741      case 565719004: // decision
3742        this.decision = castToCodeableConcept(value); // CodeableConcept
3743        return value;
3744      case 675909535: // decisionMode
3745        this.getDecisionMode().add(castToCodeableConcept(value)); // CodeableConcept
3746        return value;
3747      case -1412808770: // answer
3748        this.getAnswer().add((AnswerComponent) value); // AnswerComponent
3749        return value;
3750      case 3556653: // text
3751        this.text = castToString(value); // StringType
3752        return value;
3753      case -1102667083: // linkId
3754        this.getLinkId().add(castToString(value)); // StringType
3755        return value;
3756      case -149460995: // securityLabelNumber
3757        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
3758        return value;
3759      default:
3760        return super.setProperty(hash, name, value);
3761      }
3762
3763    }
3764
3765    @Override
3766    public Base setProperty(String name, Base value) throws FHIRException {
3767      if (name.equals("identifier")) {
3768        this.getIdentifier().add(castToIdentifier(value));
3769      } else if (name.equals("party")) {
3770        this.getParty().add((ContractPartyComponent) value);
3771      } else if (name.equals("topic")) {
3772        this.topic = castToReference(value); // Reference
3773      } else if (name.equals("type")) {
3774        this.type = castToCodeableConcept(value); // CodeableConcept
3775      } else if (name.equals("decision")) {
3776        this.decision = castToCodeableConcept(value); // CodeableConcept
3777      } else if (name.equals("decisionMode")) {
3778        this.getDecisionMode().add(castToCodeableConcept(value));
3779      } else if (name.equals("answer")) {
3780        this.getAnswer().add((AnswerComponent) value);
3781      } else if (name.equals("text")) {
3782        this.text = castToString(value); // StringType
3783      } else if (name.equals("linkId")) {
3784        this.getLinkId().add(castToString(value));
3785      } else if (name.equals("securityLabelNumber")) {
3786        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
3787      } else
3788        return super.setProperty(name, value);
3789      return value;
3790    }
3791
3792    @Override
3793    public Base makeProperty(int hash, String name) throws FHIRException {
3794      switch (hash) {
3795      case -1618432855:
3796        return addIdentifier();
3797      case 106437350:
3798        return addParty();
3799      case 110546223:
3800        return getTopic();
3801      case 3575610:
3802        return getType();
3803      case 565719004:
3804        return getDecision();
3805      case 675909535:
3806        return addDecisionMode();
3807      case -1412808770:
3808        return addAnswer();
3809      case 3556653:
3810        return getTextElement();
3811      case -1102667083:
3812        return addLinkIdElement();
3813      case -149460995:
3814        return addSecurityLabelNumberElement();
3815      default:
3816        return super.makeProperty(hash, name);
3817      }
3818
3819    }
3820
3821    @Override
3822    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3823      switch (hash) {
3824      case -1618432855:
3825        /* identifier */ return new String[] { "Identifier" };
3826      case 106437350:
3827        /* party */ return new String[] {};
3828      case 110546223:
3829        /* topic */ return new String[] { "Reference" };
3830      case 3575610:
3831        /* type */ return new String[] { "CodeableConcept" };
3832      case 565719004:
3833        /* decision */ return new String[] { "CodeableConcept" };
3834      case 675909535:
3835        /* decisionMode */ return new String[] { "CodeableConcept" };
3836      case -1412808770:
3837        /* answer */ return new String[] {};
3838      case 3556653:
3839        /* text */ return new String[] { "string" };
3840      case -1102667083:
3841        /* linkId */ return new String[] { "string" };
3842      case -149460995:
3843        /* securityLabelNumber */ return new String[] { "unsignedInt" };
3844      default:
3845        return super.getTypesForProperty(hash, name);
3846      }
3847
3848    }
3849
3850    @Override
3851    public Base addChild(String name) throws FHIRException {
3852      if (name.equals("identifier")) {
3853        return addIdentifier();
3854      } else if (name.equals("party")) {
3855        return addParty();
3856      } else if (name.equals("topic")) {
3857        this.topic = new Reference();
3858        return this.topic;
3859      } else if (name.equals("type")) {
3860        this.type = new CodeableConcept();
3861        return this.type;
3862      } else if (name.equals("decision")) {
3863        this.decision = new CodeableConcept();
3864        return this.decision;
3865      } else if (name.equals("decisionMode")) {
3866        return addDecisionMode();
3867      } else if (name.equals("answer")) {
3868        return addAnswer();
3869      } else if (name.equals("text")) {
3870        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
3871      } else if (name.equals("linkId")) {
3872        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
3873      } else if (name.equals("securityLabelNumber")) {
3874        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
3875      } else
3876        return super.addChild(name);
3877    }
3878
3879    public ContractOfferComponent copy() {
3880      ContractOfferComponent dst = new ContractOfferComponent();
3881      copyValues(dst);
3882      return dst;
3883    }
3884
3885    public void copyValues(ContractOfferComponent dst) {
3886      super.copyValues(dst);
3887      if (identifier != null) {
3888        dst.identifier = new ArrayList<Identifier>();
3889        for (Identifier i : identifier)
3890          dst.identifier.add(i.copy());
3891      }
3892      ;
3893      if (party != null) {
3894        dst.party = new ArrayList<ContractPartyComponent>();
3895        for (ContractPartyComponent i : party)
3896          dst.party.add(i.copy());
3897      }
3898      ;
3899      dst.topic = topic == null ? null : topic.copy();
3900      dst.type = type == null ? null : type.copy();
3901      dst.decision = decision == null ? null : decision.copy();
3902      if (decisionMode != null) {
3903        dst.decisionMode = new ArrayList<CodeableConcept>();
3904        for (CodeableConcept i : decisionMode)
3905          dst.decisionMode.add(i.copy());
3906      }
3907      ;
3908      if (answer != null) {
3909        dst.answer = new ArrayList<AnswerComponent>();
3910        for (AnswerComponent i : answer)
3911          dst.answer.add(i.copy());
3912      }
3913      ;
3914      dst.text = text == null ? null : text.copy();
3915      if (linkId != null) {
3916        dst.linkId = new ArrayList<StringType>();
3917        for (StringType i : linkId)
3918          dst.linkId.add(i.copy());
3919      }
3920      ;
3921      if (securityLabelNumber != null) {
3922        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
3923        for (UnsignedIntType i : securityLabelNumber)
3924          dst.securityLabelNumber.add(i.copy());
3925      }
3926      ;
3927    }
3928
3929    @Override
3930    public boolean equalsDeep(Base other_) {
3931      if (!super.equalsDeep(other_))
3932        return false;
3933      if (!(other_ instanceof ContractOfferComponent))
3934        return false;
3935      ContractOfferComponent o = (ContractOfferComponent) other_;
3936      return compareDeep(identifier, o.identifier, true) && compareDeep(party, o.party, true)
3937          && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true)
3938          && compareDeep(decision, o.decision, true) && compareDeep(decisionMode, o.decisionMode, true)
3939          && compareDeep(answer, o.answer, true) && compareDeep(text, o.text, true)
3940          && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
3941    }
3942
3943    @Override
3944    public boolean equalsShallow(Base other_) {
3945      if (!super.equalsShallow(other_))
3946        return false;
3947      if (!(other_ instanceof ContractOfferComponent))
3948        return false;
3949      ContractOfferComponent o = (ContractOfferComponent) other_;
3950      return compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true)
3951          && compareValues(securityLabelNumber, o.securityLabelNumber, true);
3952    }
3953
3954    public boolean isEmpty() {
3955      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, party, topic, type, decision,
3956          decisionMode, answer, text, linkId, securityLabelNumber);
3957    }
3958
3959    public String fhirType() {
3960      return "Contract.term.offer";
3961
3962    }
3963
3964  }
3965
3966  @Block()
3967  public static class ContractPartyComponent extends BackboneElement implements IBaseBackboneElement {
3968    /**
3969     * Participant in the offer.
3970     */
3971    @Child(name = "reference", type = { Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class,
3972        Device.class, Group.class,
3973        Organization.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3974    @Description(shortDefinition = "Referenced entity", formalDefinition = "Participant in the offer.")
3975    protected List<Reference> reference;
3976    /**
3977     * The actual objects that are the target of the reference (Participant in the
3978     * offer.)
3979     */
3980    protected List<Resource> referenceTarget;
3981
3982    /**
3983     * How the party participates in the offer.
3984     */
3985    @Child(name = "role", type = {
3986        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
3987    @Description(shortDefinition = "Participant engagement type", formalDefinition = "How the party participates in the offer.")
3988    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-party-role")
3989    protected CodeableConcept role;
3990
3991    private static final long serialVersionUID = 128949255L;
3992
3993    /**
3994     * Constructor
3995     */
3996    public ContractPartyComponent() {
3997      super();
3998    }
3999
4000    /**
4001     * Constructor
4002     */
4003    public ContractPartyComponent(CodeableConcept role) {
4004      super();
4005      this.role = role;
4006    }
4007
4008    /**
4009     * @return {@link #reference} (Participant in the offer.)
4010     */
4011    public List<Reference> getReference() {
4012      if (this.reference == null)
4013        this.reference = new ArrayList<Reference>();
4014      return this.reference;
4015    }
4016
4017    /**
4018     * @return Returns a reference to <code>this</code> for easy method chaining
4019     */
4020    public ContractPartyComponent setReference(List<Reference> theReference) {
4021      this.reference = theReference;
4022      return this;
4023    }
4024
4025    public boolean hasReference() {
4026      if (this.reference == null)
4027        return false;
4028      for (Reference item : this.reference)
4029        if (!item.isEmpty())
4030          return true;
4031      return false;
4032    }
4033
4034    public Reference addReference() { // 3
4035      Reference t = new Reference();
4036      if (this.reference == null)
4037        this.reference = new ArrayList<Reference>();
4038      this.reference.add(t);
4039      return t;
4040    }
4041
4042    public ContractPartyComponent addReference(Reference t) { // 3
4043      if (t == null)
4044        return this;
4045      if (this.reference == null)
4046        this.reference = new ArrayList<Reference>();
4047      this.reference.add(t);
4048      return this;
4049    }
4050
4051    /**
4052     * @return The first repetition of repeating field {@link #reference}, creating
4053     *         it if it does not already exist
4054     */
4055    public Reference getReferenceFirstRep() {
4056      if (getReference().isEmpty()) {
4057        addReference();
4058      }
4059      return getReference().get(0);
4060    }
4061
4062    /**
4063     * @deprecated Use Reference#setResource(IBaseResource) instead
4064     */
4065    @Deprecated
4066    public List<Resource> getReferenceTarget() {
4067      if (this.referenceTarget == null)
4068        this.referenceTarget = new ArrayList<Resource>();
4069      return this.referenceTarget;
4070    }
4071
4072    /**
4073     * @return {@link #role} (How the party participates in the offer.)
4074     */
4075    public CodeableConcept getRole() {
4076      if (this.role == null)
4077        if (Configuration.errorOnAutoCreate())
4078          throw new Error("Attempt to auto-create ContractPartyComponent.role");
4079        else if (Configuration.doAutoCreate())
4080          this.role = new CodeableConcept(); // cc
4081      return this.role;
4082    }
4083
4084    public boolean hasRole() {
4085      return this.role != null && !this.role.isEmpty();
4086    }
4087
4088    /**
4089     * @param value {@link #role} (How the party participates in the offer.)
4090     */
4091    public ContractPartyComponent setRole(CodeableConcept value) {
4092      this.role = value;
4093      return this;
4094    }
4095
4096    protected void listChildren(List<Property> children) {
4097      super.listChildren(children);
4098      children.add(new Property("reference",
4099          "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
4100          "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference));
4101      children.add(new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role));
4102    }
4103
4104    @Override
4105    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4106      switch (_hash) {
4107      case -925155509:
4108        /* reference */ return new Property("reference",
4109            "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
4110            "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference);
4111      case 3506294:
4112        /* role */ return new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1,
4113            role);
4114      default:
4115        return super.getNamedProperty(_hash, _name, _checkValid);
4116      }
4117
4118    }
4119
4120    @Override
4121    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4122      switch (hash) {
4123      case -925155509:
4124        /* reference */ return this.reference == null ? new Base[0]
4125            : this.reference.toArray(new Base[this.reference.size()]); // Reference
4126      case 3506294:
4127        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
4128      default:
4129        return super.getProperty(hash, name, checkValid);
4130      }
4131
4132    }
4133
4134    @Override
4135    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4136      switch (hash) {
4137      case -925155509: // reference
4138        this.getReference().add(castToReference(value)); // Reference
4139        return value;
4140      case 3506294: // role
4141        this.role = castToCodeableConcept(value); // CodeableConcept
4142        return value;
4143      default:
4144        return super.setProperty(hash, name, value);
4145      }
4146
4147    }
4148
4149    @Override
4150    public Base setProperty(String name, Base value) throws FHIRException {
4151      if (name.equals("reference")) {
4152        this.getReference().add(castToReference(value));
4153      } else if (name.equals("role")) {
4154        this.role = castToCodeableConcept(value); // CodeableConcept
4155      } else
4156        return super.setProperty(name, value);
4157      return value;
4158    }
4159
4160    @Override
4161    public Base makeProperty(int hash, String name) throws FHIRException {
4162      switch (hash) {
4163      case -925155509:
4164        return addReference();
4165      case 3506294:
4166        return getRole();
4167      default:
4168        return super.makeProperty(hash, name);
4169      }
4170
4171    }
4172
4173    @Override
4174    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4175      switch (hash) {
4176      case -925155509:
4177        /* reference */ return new String[] { "Reference" };
4178      case 3506294:
4179        /* role */ return new String[] { "CodeableConcept" };
4180      default:
4181        return super.getTypesForProperty(hash, name);
4182      }
4183
4184    }
4185
4186    @Override
4187    public Base addChild(String name) throws FHIRException {
4188      if (name.equals("reference")) {
4189        return addReference();
4190      } else if (name.equals("role")) {
4191        this.role = new CodeableConcept();
4192        return this.role;
4193      } else
4194        return super.addChild(name);
4195    }
4196
4197    public ContractPartyComponent copy() {
4198      ContractPartyComponent dst = new ContractPartyComponent();
4199      copyValues(dst);
4200      return dst;
4201    }
4202
4203    public void copyValues(ContractPartyComponent dst) {
4204      super.copyValues(dst);
4205      if (reference != null) {
4206        dst.reference = new ArrayList<Reference>();
4207        for (Reference i : reference)
4208          dst.reference.add(i.copy());
4209      }
4210      ;
4211      dst.role = role == null ? null : role.copy();
4212    }
4213
4214    @Override
4215    public boolean equalsDeep(Base other_) {
4216      if (!super.equalsDeep(other_))
4217        return false;
4218      if (!(other_ instanceof ContractPartyComponent))
4219        return false;
4220      ContractPartyComponent o = (ContractPartyComponent) other_;
4221      return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
4222    }
4223
4224    @Override
4225    public boolean equalsShallow(Base other_) {
4226      if (!super.equalsShallow(other_))
4227        return false;
4228      if (!(other_ instanceof ContractPartyComponent))
4229        return false;
4230      ContractPartyComponent o = (ContractPartyComponent) other_;
4231      return true;
4232    }
4233
4234    public boolean isEmpty() {
4235      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
4236    }
4237
4238    public String fhirType() {
4239      return "Contract.term.offer.party";
4240
4241    }
4242
4243  }
4244
4245  @Block()
4246  public static class AnswerComponent extends BackboneElement implements IBaseBackboneElement {
4247    /**
4248     * Response to an offer clause or question text, which enables selection of
4249     * values to be agreed to, e.g., the period of participation, the date of
4250     * occupancy of a rental, warrently duration, or whether biospecimen may be used
4251     * for further research.
4252     */
4253    @Child(name = "value", type = { BooleanType.class, DecimalType.class, IntegerType.class, DateType.class,
4254        DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class,
4255        Quantity.class, Reference.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4256    @Description(shortDefinition = "The actual answer response", formalDefinition = "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.")
4257    protected Type value;
4258
4259    private static final long serialVersionUID = -732981989L;
4260
4261    /**
4262     * Constructor
4263     */
4264    public AnswerComponent() {
4265      super();
4266    }
4267
4268    /**
4269     * Constructor
4270     */
4271    public AnswerComponent(Type value) {
4272      super();
4273      this.value = value;
4274    }
4275
4276    /**
4277     * @return {@link #value} (Response to an offer clause or question text, which
4278     *         enables selection of values to be agreed to, e.g., the period of
4279     *         participation, the date of occupancy of a rental, warrently duration,
4280     *         or whether biospecimen may be used for further research.)
4281     */
4282    public Type getValue() {
4283      return this.value;
4284    }
4285
4286    /**
4287     * @return {@link #value} (Response to an offer clause or question text, which
4288     *         enables selection of values to be agreed to, e.g., the period of
4289     *         participation, the date of occupancy of a rental, warrently duration,
4290     *         or whether biospecimen may be used for further research.)
4291     */
4292    public BooleanType getValueBooleanType() throws FHIRException {
4293      if (this.value == null)
4294        this.value = new BooleanType();
4295      if (!(this.value instanceof BooleanType))
4296        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
4297            + this.value.getClass().getName() + " was encountered");
4298      return (BooleanType) this.value;
4299    }
4300
4301    public boolean hasValueBooleanType() {
4302      return this != null && this.value instanceof BooleanType;
4303    }
4304
4305    /**
4306     * @return {@link #value} (Response to an offer clause or question text, which
4307     *         enables selection of values to be agreed to, e.g., the period of
4308     *         participation, the date of occupancy of a rental, warrently duration,
4309     *         or whether biospecimen may be used for further research.)
4310     */
4311    public DecimalType getValueDecimalType() throws FHIRException {
4312      if (this.value == null)
4313        this.value = new DecimalType();
4314      if (!(this.value instanceof DecimalType))
4315        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
4316            + this.value.getClass().getName() + " was encountered");
4317      return (DecimalType) this.value;
4318    }
4319
4320    public boolean hasValueDecimalType() {
4321      return this != null && this.value instanceof DecimalType;
4322    }
4323
4324    /**
4325     * @return {@link #value} (Response to an offer clause or question text, which
4326     *         enables selection of values to be agreed to, e.g., the period of
4327     *         participation, the date of occupancy of a rental, warrently duration,
4328     *         or whether biospecimen may be used for further research.)
4329     */
4330    public IntegerType getValueIntegerType() throws FHIRException {
4331      if (this.value == null)
4332        this.value = new IntegerType();
4333      if (!(this.value instanceof IntegerType))
4334        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
4335            + this.value.getClass().getName() + " was encountered");
4336      return (IntegerType) this.value;
4337    }
4338
4339    public boolean hasValueIntegerType() {
4340      return this != null && this.value instanceof IntegerType;
4341    }
4342
4343    /**
4344     * @return {@link #value} (Response to an offer clause or question text, which
4345     *         enables selection of values to be agreed to, e.g., the period of
4346     *         participation, the date of occupancy of a rental, warrently duration,
4347     *         or whether biospecimen may be used for further research.)
4348     */
4349    public DateType getValueDateType() throws FHIRException {
4350      if (this.value == null)
4351        this.value = new DateType();
4352      if (!(this.value instanceof DateType))
4353        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.value.getClass().getName()
4354            + " was encountered");
4355      return (DateType) this.value;
4356    }
4357
4358    public boolean hasValueDateType() {
4359      return this != null && this.value instanceof DateType;
4360    }
4361
4362    /**
4363     * @return {@link #value} (Response to an offer clause or question text, which
4364     *         enables selection of values to be agreed to, e.g., the period of
4365     *         participation, the date of occupancy of a rental, warrently duration,
4366     *         or whether biospecimen may be used for further research.)
4367     */
4368    public DateTimeType getValueDateTimeType() throws FHIRException {
4369      if (this.value == null)
4370        this.value = new DateTimeType();
4371      if (!(this.value instanceof DateTimeType))
4372        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
4373            + this.value.getClass().getName() + " was encountered");
4374      return (DateTimeType) this.value;
4375    }
4376
4377    public boolean hasValueDateTimeType() {
4378      return this != null && this.value instanceof DateTimeType;
4379    }
4380
4381    /**
4382     * @return {@link #value} (Response to an offer clause or question text, which
4383     *         enables selection of values to be agreed to, e.g., the period of
4384     *         participation, the date of occupancy of a rental, warrently duration,
4385     *         or whether biospecimen may be used for further research.)
4386     */
4387    public TimeType getValueTimeType() throws FHIRException {
4388      if (this.value == null)
4389        this.value = new TimeType();
4390      if (!(this.value instanceof TimeType))
4391        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
4392            + " was encountered");
4393      return (TimeType) this.value;
4394    }
4395
4396    public boolean hasValueTimeType() {
4397      return this != null && this.value instanceof TimeType;
4398    }
4399
4400    /**
4401     * @return {@link #value} (Response to an offer clause or question text, which
4402     *         enables selection of values to be agreed to, e.g., the period of
4403     *         participation, the date of occupancy of a rental, warrently duration,
4404     *         or whether biospecimen may be used for further research.)
4405     */
4406    public StringType getValueStringType() throws FHIRException {
4407      if (this.value == null)
4408        this.value = new StringType();
4409      if (!(this.value instanceof StringType))
4410        throw new FHIRException("Type mismatch: the type StringType was expected, but "
4411            + this.value.getClass().getName() + " was encountered");
4412      return (StringType) this.value;
4413    }
4414
4415    public boolean hasValueStringType() {
4416      return this != null && this.value instanceof StringType;
4417    }
4418
4419    /**
4420     * @return {@link #value} (Response to an offer clause or question text, which
4421     *         enables selection of values to be agreed to, e.g., the period of
4422     *         participation, the date of occupancy of a rental, warrently duration,
4423     *         or whether biospecimen may be used for further research.)
4424     */
4425    public UriType getValueUriType() throws FHIRException {
4426      if (this.value == null)
4427        this.value = new UriType();
4428      if (!(this.value instanceof UriType))
4429        throw new FHIRException("Type mismatch: the type UriType was expected, but " + this.value.getClass().getName()
4430            + " was encountered");
4431      return (UriType) this.value;
4432    }
4433
4434    public boolean hasValueUriType() {
4435      return this != null && this.value instanceof UriType;
4436    }
4437
4438    /**
4439     * @return {@link #value} (Response to an offer clause or question text, which
4440     *         enables selection of values to be agreed to, e.g., the period of
4441     *         participation, the date of occupancy of a rental, warrently duration,
4442     *         or whether biospecimen may be used for further research.)
4443     */
4444    public Attachment getValueAttachment() throws FHIRException {
4445      if (this.value == null)
4446        this.value = new Attachment();
4447      if (!(this.value instanceof Attachment))
4448        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
4449            + this.value.getClass().getName() + " was encountered");
4450      return (Attachment) this.value;
4451    }
4452
4453    public boolean hasValueAttachment() {
4454      return this != null && this.value instanceof Attachment;
4455    }
4456
4457    /**
4458     * @return {@link #value} (Response to an offer clause or question text, which
4459     *         enables selection of values to be agreed to, e.g., the period of
4460     *         participation, the date of occupancy of a rental, warrently duration,
4461     *         or whether biospecimen may be used for further research.)
4462     */
4463    public Coding getValueCoding() throws FHIRException {
4464      if (this.value == null)
4465        this.value = new Coding();
4466      if (!(this.value instanceof Coding))
4467        throw new FHIRException(
4468            "Type mismatch: the type Coding was expected, but " + this.value.getClass().getName() + " was encountered");
4469      return (Coding) this.value;
4470    }
4471
4472    public boolean hasValueCoding() {
4473      return this != null && this.value instanceof Coding;
4474    }
4475
4476    /**
4477     * @return {@link #value} (Response to an offer clause or question text, which
4478     *         enables selection of values to be agreed to, e.g., the period of
4479     *         participation, the date of occupancy of a rental, warrently duration,
4480     *         or whether biospecimen may be used for further research.)
4481     */
4482    public Quantity getValueQuantity() throws FHIRException {
4483      if (this.value == null)
4484        this.value = new Quantity();
4485      if (!(this.value instanceof Quantity))
4486        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
4487            + " was encountered");
4488      return (Quantity) this.value;
4489    }
4490
4491    public boolean hasValueQuantity() {
4492      return this != null && this.value instanceof Quantity;
4493    }
4494
4495    /**
4496     * @return {@link #value} (Response to an offer clause or question text, which
4497     *         enables selection of values to be agreed to, e.g., the period of
4498     *         participation, the date of occupancy of a rental, warrently duration,
4499     *         or whether biospecimen may be used for further research.)
4500     */
4501    public Reference getValueReference() throws FHIRException {
4502      if (this.value == null)
4503        this.value = new Reference();
4504      if (!(this.value instanceof Reference))
4505        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
4506            + " was encountered");
4507      return (Reference) this.value;
4508    }
4509
4510    public boolean hasValueReference() {
4511      return this != null && this.value instanceof Reference;
4512    }
4513
4514    public boolean hasValue() {
4515      return this.value != null && !this.value.isEmpty();
4516    }
4517
4518    /**
4519     * @param value {@link #value} (Response to an offer clause or question text,
4520     *              which enables selection of values to be agreed to, e.g., the
4521     *              period of participation, the date of occupancy of a rental,
4522     *              warrently duration, or whether biospecimen may be used for
4523     *              further research.)
4524     */
4525    public AnswerComponent setValue(Type value) {
4526      if (value != null
4527          && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType
4528              || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType
4529              || value instanceof StringType || value instanceof UriType || value instanceof Attachment
4530              || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
4531        throw new Error("Not the right type for Contract.term.offer.answer.value[x]: " + value.fhirType());
4532      this.value = value;
4533      return this;
4534    }
4535
4536    protected void listChildren(List<Property> children) {
4537      super.listChildren(children);
4538      children.add(new Property("value[x]",
4539          "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4540          "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4541          0, 1, value));
4542    }
4543
4544    @Override
4545    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4546      switch (_hash) {
4547      case -1410166417:
4548        /* value[x] */ return new Property("value[x]",
4549            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4550            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4551            0, 1, value);
4552      case 111972721:
4553        /* value */ return new Property("value[x]",
4554            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4555            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4556            0, 1, value);
4557      case 733421943:
4558        /* valueBoolean */ return new Property("value[x]",
4559            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4560            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4561            0, 1, value);
4562      case -2083993440:
4563        /* valueDecimal */ return new Property("value[x]",
4564            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4565            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4566            0, 1, value);
4567      case -1668204915:
4568        /* valueInteger */ return new Property("value[x]",
4569            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4570            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4571            0, 1, value);
4572      case -766192449:
4573        /* valueDate */ return new Property("value[x]",
4574            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4575            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4576            0, 1, value);
4577      case 1047929900:
4578        /* valueDateTime */ return new Property("value[x]",
4579            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4580            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4581            0, 1, value);
4582      case -765708322:
4583        /* valueTime */ return new Property("value[x]",
4584            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4585            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4586            0, 1, value);
4587      case -1424603934:
4588        /* valueString */ return new Property("value[x]",
4589            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4590            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4591            0, 1, value);
4592      case -1410172357:
4593        /* valueUri */ return new Property("value[x]",
4594            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4595            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4596            0, 1, value);
4597      case -475566732:
4598        /* valueAttachment */ return new Property("value[x]",
4599            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4600            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4601            0, 1, value);
4602      case -1887705029:
4603        /* valueCoding */ return new Property("value[x]",
4604            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4605            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4606            0, 1, value);
4607      case -2029823716:
4608        /* valueQuantity */ return new Property("value[x]",
4609            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4610            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4611            0, 1, value);
4612      case 1755241690:
4613        /* valueReference */ return new Property("value[x]",
4614            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4615            "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.",
4616            0, 1, value);
4617      default:
4618        return super.getNamedProperty(_hash, _name, _checkValid);
4619      }
4620
4621    }
4622
4623    @Override
4624    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4625      switch (hash) {
4626      case 111972721:
4627        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
4628      default:
4629        return super.getProperty(hash, name, checkValid);
4630      }
4631
4632    }
4633
4634    @Override
4635    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4636      switch (hash) {
4637      case 111972721: // value
4638        this.value = castToType(value); // Type
4639        return value;
4640      default:
4641        return super.setProperty(hash, name, value);
4642      }
4643
4644    }
4645
4646    @Override
4647    public Base setProperty(String name, Base value) throws FHIRException {
4648      if (name.equals("value[x]")) {
4649        this.value = castToType(value); // Type
4650      } else
4651        return super.setProperty(name, value);
4652      return value;
4653    }
4654
4655    @Override
4656    public Base makeProperty(int hash, String name) throws FHIRException {
4657      switch (hash) {
4658      case -1410166417:
4659        return getValue();
4660      case 111972721:
4661        return getValue();
4662      default:
4663        return super.makeProperty(hash, name);
4664      }
4665
4666    }
4667
4668    @Override
4669    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4670      switch (hash) {
4671      case 111972721:
4672        /* value */ return new String[] { "boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri",
4673            "Attachment", "Coding", "Quantity", "Reference" };
4674      default:
4675        return super.getTypesForProperty(hash, name);
4676      }
4677
4678    }
4679
4680    @Override
4681    public Base addChild(String name) throws FHIRException {
4682      if (name.equals("valueBoolean")) {
4683        this.value = new BooleanType();
4684        return this.value;
4685      } else if (name.equals("valueDecimal")) {
4686        this.value = new DecimalType();
4687        return this.value;
4688      } else if (name.equals("valueInteger")) {
4689        this.value = new IntegerType();
4690        return this.value;
4691      } else if (name.equals("valueDate")) {
4692        this.value = new DateType();
4693        return this.value;
4694      } else if (name.equals("valueDateTime")) {
4695        this.value = new DateTimeType();
4696        return this.value;
4697      } else if (name.equals("valueTime")) {
4698        this.value = new TimeType();
4699        return this.value;
4700      } else if (name.equals("valueString")) {
4701        this.value = new StringType();
4702        return this.value;
4703      } else if (name.equals("valueUri")) {
4704        this.value = new UriType();
4705        return this.value;
4706      } else if (name.equals("valueAttachment")) {
4707        this.value = new Attachment();
4708        return this.value;
4709      } else if (name.equals("valueCoding")) {
4710        this.value = new Coding();
4711        return this.value;
4712      } else if (name.equals("valueQuantity")) {
4713        this.value = new Quantity();
4714        return this.value;
4715      } else if (name.equals("valueReference")) {
4716        this.value = new Reference();
4717        return this.value;
4718      } else
4719        return super.addChild(name);
4720    }
4721
4722    public AnswerComponent copy() {
4723      AnswerComponent dst = new AnswerComponent();
4724      copyValues(dst);
4725      return dst;
4726    }
4727
4728    public void copyValues(AnswerComponent dst) {
4729      super.copyValues(dst);
4730      dst.value = value == null ? null : value.copy();
4731    }
4732
4733    @Override
4734    public boolean equalsDeep(Base other_) {
4735      if (!super.equalsDeep(other_))
4736        return false;
4737      if (!(other_ instanceof AnswerComponent))
4738        return false;
4739      AnswerComponent o = (AnswerComponent) other_;
4740      return compareDeep(value, o.value, true);
4741    }
4742
4743    @Override
4744    public boolean equalsShallow(Base other_) {
4745      if (!super.equalsShallow(other_))
4746        return false;
4747      if (!(other_ instanceof AnswerComponent))
4748        return false;
4749      AnswerComponent o = (AnswerComponent) other_;
4750      return true;
4751    }
4752
4753    public boolean isEmpty() {
4754      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
4755    }
4756
4757    public String fhirType() {
4758      return "Contract.term.offer.answer";
4759
4760    }
4761
4762  }
4763
4764  @Block()
4765  public static class ContractAssetComponent extends BackboneElement implements IBaseBackboneElement {
4766    /**
4767     * Differentiates the kind of the asset .
4768     */
4769    @Child(name = "scope", type = {
4770        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
4771    @Description(shortDefinition = "Range of asset", formalDefinition = "Differentiates the kind of the asset .")
4772    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assetscope")
4773    protected CodeableConcept scope;
4774
4775    /**
4776     * Target entity type about which the term may be concerned.
4777     */
4778    @Child(name = "type", type = {
4779        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4780    @Description(shortDefinition = "Asset category", formalDefinition = "Target entity type about which the term may be concerned.")
4781    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assettype")
4782    protected List<CodeableConcept> type;
4783
4784    /**
4785     * Associated entities.
4786     */
4787    @Child(name = "typeReference", type = {
4788        Reference.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4789    @Description(shortDefinition = "Associated entities", formalDefinition = "Associated entities.")
4790    protected List<Reference> typeReference;
4791    /**
4792     * The actual objects that are the target of the reference (Associated
4793     * entities.)
4794     */
4795    protected List<Resource> typeReferenceTarget;
4796
4797    /**
4798     * May be a subtype or part of an offered asset.
4799     */
4800    @Child(name = "subtype", type = {
4801        CodeableConcept.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4802    @Description(shortDefinition = "Asset sub-category", formalDefinition = "May be a subtype or part of an offered asset.")
4803    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assetsubtype")
4804    protected List<CodeableConcept> subtype;
4805
4806    /**
4807     * Specifies the applicability of the term to an asset resource instance, and
4808     * instances it refers to orinstances that refer to it, and/or are owned by the
4809     * offeree.
4810     */
4811    @Child(name = "relationship", type = {
4812        Coding.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
4813    @Description(shortDefinition = "Kinship of the asset", formalDefinition = "Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.")
4814    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/consent-content-class")
4815    protected Coding relationship;
4816
4817    /**
4818     * Circumstance of the asset.
4819     */
4820    @Child(name = "context", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4821    @Description(shortDefinition = "Circumstance of the asset", formalDefinition = "Circumstance of the asset.")
4822    protected List<AssetContextComponent> context;
4823
4824    /**
4825     * Description of the quality and completeness of the asset that imay be a
4826     * factor in its valuation.
4827     */
4828    @Child(name = "condition", type = {
4829        StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
4830    @Description(shortDefinition = "Quality desctiption of asset", formalDefinition = "Description of the quality and completeness of the asset that imay be a factor in its valuation.")
4831    protected StringType condition;
4832
4833    /**
4834     * Type of Asset availability for use or ownership.
4835     */
4836    @Child(name = "periodType", type = {
4837        CodeableConcept.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4838    @Description(shortDefinition = "Asset availability types", formalDefinition = "Type of Asset availability for use or ownership.")
4839    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/asset-availability")
4840    protected List<CodeableConcept> periodType;
4841
4842    /**
4843     * Asset relevant contractual time period.
4844     */
4845    @Child(name = "period", type = {
4846        Period.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4847    @Description(shortDefinition = "Time period of the asset", formalDefinition = "Asset relevant contractual time period.")
4848    protected List<Period> period;
4849
4850    /**
4851     * Time period of asset use.
4852     */
4853    @Child(name = "usePeriod", type = {
4854        Period.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4855    @Description(shortDefinition = "Time period", formalDefinition = "Time period of asset use.")
4856    protected List<Period> usePeriod;
4857
4858    /**
4859     * Clause or question text (Prose Object) concerning the asset in a linked form,
4860     * such as a QuestionnaireResponse used in the formation of the contract.
4861     */
4862    @Child(name = "text", type = { StringType.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
4863    @Description(shortDefinition = "Asset clause or question text", formalDefinition = "Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.")
4864    protected StringType text;
4865
4866    /**
4867     * Id [identifier??] of the clause or question text about the asset in the
4868     * referenced form or QuestionnaireResponse.
4869     */
4870    @Child(name = "linkId", type = {
4871        StringType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4872    @Description(shortDefinition = "Pointer to asset text", formalDefinition = "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.")
4873    protected List<StringType> linkId;
4874
4875    /**
4876     * Response to assets.
4877     */
4878    @Child(name = "answer", type = {
4879        AnswerComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4880    @Description(shortDefinition = "Response to assets", formalDefinition = "Response to assets.")
4881    protected List<AnswerComponent> answer;
4882
4883    /**
4884     * Security labels that protects the asset.
4885     */
4886    @Child(name = "securityLabelNumber", type = {
4887        UnsignedIntType.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4888    @Description(shortDefinition = "Asset restriction numbers", formalDefinition = "Security labels that protects the asset.")
4889    protected List<UnsignedIntType> securityLabelNumber;
4890
4891    /**
4892     * Contract Valued Item List.
4893     */
4894    @Child(name = "valuedItem", type = {}, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4895    @Description(shortDefinition = "Contract Valued Item List", formalDefinition = "Contract Valued Item List.")
4896    protected List<ValuedItemComponent> valuedItem;
4897
4898    private static final long serialVersionUID = -1080398792L;
4899
4900    /**
4901     * Constructor
4902     */
4903    public ContractAssetComponent() {
4904      super();
4905    }
4906
4907    /**
4908     * @return {@link #scope} (Differentiates the kind of the asset .)
4909     */
4910    public CodeableConcept getScope() {
4911      if (this.scope == null)
4912        if (Configuration.errorOnAutoCreate())
4913          throw new Error("Attempt to auto-create ContractAssetComponent.scope");
4914        else if (Configuration.doAutoCreate())
4915          this.scope = new CodeableConcept(); // cc
4916      return this.scope;
4917    }
4918
4919    public boolean hasScope() {
4920      return this.scope != null && !this.scope.isEmpty();
4921    }
4922
4923    /**
4924     * @param value {@link #scope} (Differentiates the kind of the asset .)
4925     */
4926    public ContractAssetComponent setScope(CodeableConcept value) {
4927      this.scope = value;
4928      return this;
4929    }
4930
4931    /**
4932     * @return {@link #type} (Target entity type about which the term may be
4933     *         concerned.)
4934     */
4935    public List<CodeableConcept> getType() {
4936      if (this.type == null)
4937        this.type = new ArrayList<CodeableConcept>();
4938      return this.type;
4939    }
4940
4941    /**
4942     * @return Returns a reference to <code>this</code> for easy method chaining
4943     */
4944    public ContractAssetComponent setType(List<CodeableConcept> theType) {
4945      this.type = theType;
4946      return this;
4947    }
4948
4949    public boolean hasType() {
4950      if (this.type == null)
4951        return false;
4952      for (CodeableConcept item : this.type)
4953        if (!item.isEmpty())
4954          return true;
4955      return false;
4956    }
4957
4958    public CodeableConcept addType() { // 3
4959      CodeableConcept t = new CodeableConcept();
4960      if (this.type == null)
4961        this.type = new ArrayList<CodeableConcept>();
4962      this.type.add(t);
4963      return t;
4964    }
4965
4966    public ContractAssetComponent addType(CodeableConcept t) { // 3
4967      if (t == null)
4968        return this;
4969      if (this.type == null)
4970        this.type = new ArrayList<CodeableConcept>();
4971      this.type.add(t);
4972      return this;
4973    }
4974
4975    /**
4976     * @return The first repetition of repeating field {@link #type}, creating it if
4977     *         it does not already exist
4978     */
4979    public CodeableConcept getTypeFirstRep() {
4980      if (getType().isEmpty()) {
4981        addType();
4982      }
4983      return getType().get(0);
4984    }
4985
4986    /**
4987     * @return {@link #typeReference} (Associated entities.)
4988     */
4989    public List<Reference> getTypeReference() {
4990      if (this.typeReference == null)
4991        this.typeReference = new ArrayList<Reference>();
4992      return this.typeReference;
4993    }
4994
4995    /**
4996     * @return Returns a reference to <code>this</code> for easy method chaining
4997     */
4998    public ContractAssetComponent setTypeReference(List<Reference> theTypeReference) {
4999      this.typeReference = theTypeReference;
5000      return this;
5001    }
5002
5003    public boolean hasTypeReference() {
5004      if (this.typeReference == null)
5005        return false;
5006      for (Reference item : this.typeReference)
5007        if (!item.isEmpty())
5008          return true;
5009      return false;
5010    }
5011
5012    public Reference addTypeReference() { // 3
5013      Reference t = new Reference();
5014      if (this.typeReference == null)
5015        this.typeReference = new ArrayList<Reference>();
5016      this.typeReference.add(t);
5017      return t;
5018    }
5019
5020    public ContractAssetComponent addTypeReference(Reference t) { // 3
5021      if (t == null)
5022        return this;
5023      if (this.typeReference == null)
5024        this.typeReference = new ArrayList<Reference>();
5025      this.typeReference.add(t);
5026      return this;
5027    }
5028
5029    /**
5030     * @return The first repetition of repeating field {@link #typeReference},
5031     *         creating it if it does not already exist
5032     */
5033    public Reference getTypeReferenceFirstRep() {
5034      if (getTypeReference().isEmpty()) {
5035        addTypeReference();
5036      }
5037      return getTypeReference().get(0);
5038    }
5039
5040    /**
5041     * @deprecated Use Reference#setResource(IBaseResource) instead
5042     */
5043    @Deprecated
5044    public List<Resource> getTypeReferenceTarget() {
5045      if (this.typeReferenceTarget == null)
5046        this.typeReferenceTarget = new ArrayList<Resource>();
5047      return this.typeReferenceTarget;
5048    }
5049
5050    /**
5051     * @return {@link #subtype} (May be a subtype or part of an offered asset.)
5052     */
5053    public List<CodeableConcept> getSubtype() {
5054      if (this.subtype == null)
5055        this.subtype = new ArrayList<CodeableConcept>();
5056      return this.subtype;
5057    }
5058
5059    /**
5060     * @return Returns a reference to <code>this</code> for easy method chaining
5061     */
5062    public ContractAssetComponent setSubtype(List<CodeableConcept> theSubtype) {
5063      this.subtype = theSubtype;
5064      return this;
5065    }
5066
5067    public boolean hasSubtype() {
5068      if (this.subtype == null)
5069        return false;
5070      for (CodeableConcept item : this.subtype)
5071        if (!item.isEmpty())
5072          return true;
5073      return false;
5074    }
5075
5076    public CodeableConcept addSubtype() { // 3
5077      CodeableConcept t = new CodeableConcept();
5078      if (this.subtype == null)
5079        this.subtype = new ArrayList<CodeableConcept>();
5080      this.subtype.add(t);
5081      return t;
5082    }
5083
5084    public ContractAssetComponent addSubtype(CodeableConcept t) { // 3
5085      if (t == null)
5086        return this;
5087      if (this.subtype == null)
5088        this.subtype = new ArrayList<CodeableConcept>();
5089      this.subtype.add(t);
5090      return this;
5091    }
5092
5093    /**
5094     * @return The first repetition of repeating field {@link #subtype}, creating it
5095     *         if it does not already exist
5096     */
5097    public CodeableConcept getSubtypeFirstRep() {
5098      if (getSubtype().isEmpty()) {
5099        addSubtype();
5100      }
5101      return getSubtype().get(0);
5102    }
5103
5104    /**
5105     * @return {@link #relationship} (Specifies the applicability of the term to an
5106     *         asset resource instance, and instances it refers to orinstances that
5107     *         refer to it, and/or are owned by the offeree.)
5108     */
5109    public Coding getRelationship() {
5110      if (this.relationship == null)
5111        if (Configuration.errorOnAutoCreate())
5112          throw new Error("Attempt to auto-create ContractAssetComponent.relationship");
5113        else if (Configuration.doAutoCreate())
5114          this.relationship = new Coding(); // cc
5115      return this.relationship;
5116    }
5117
5118    public boolean hasRelationship() {
5119      return this.relationship != null && !this.relationship.isEmpty();
5120    }
5121
5122    /**
5123     * @param value {@link #relationship} (Specifies the applicability of the term
5124     *              to an asset resource instance, and instances it refers to
5125     *              orinstances that refer to it, and/or are owned by the offeree.)
5126     */
5127    public ContractAssetComponent setRelationship(Coding value) {
5128      this.relationship = value;
5129      return this;
5130    }
5131
5132    /**
5133     * @return {@link #context} (Circumstance of the asset.)
5134     */
5135    public List<AssetContextComponent> getContext() {
5136      if (this.context == null)
5137        this.context = new ArrayList<AssetContextComponent>();
5138      return this.context;
5139    }
5140
5141    /**
5142     * @return Returns a reference to <code>this</code> for easy method chaining
5143     */
5144    public ContractAssetComponent setContext(List<AssetContextComponent> theContext) {
5145      this.context = theContext;
5146      return this;
5147    }
5148
5149    public boolean hasContext() {
5150      if (this.context == null)
5151        return false;
5152      for (AssetContextComponent item : this.context)
5153        if (!item.isEmpty())
5154          return true;
5155      return false;
5156    }
5157
5158    public AssetContextComponent addContext() { // 3
5159      AssetContextComponent t = new AssetContextComponent();
5160      if (this.context == null)
5161        this.context = new ArrayList<AssetContextComponent>();
5162      this.context.add(t);
5163      return t;
5164    }
5165
5166    public ContractAssetComponent addContext(AssetContextComponent t) { // 3
5167      if (t == null)
5168        return this;
5169      if (this.context == null)
5170        this.context = new ArrayList<AssetContextComponent>();
5171      this.context.add(t);
5172      return this;
5173    }
5174
5175    /**
5176     * @return The first repetition of repeating field {@link #context}, creating it
5177     *         if it does not already exist
5178     */
5179    public AssetContextComponent getContextFirstRep() {
5180      if (getContext().isEmpty()) {
5181        addContext();
5182      }
5183      return getContext().get(0);
5184    }
5185
5186    /**
5187     * @return {@link #condition} (Description of the quality and completeness of
5188     *         the asset that imay be a factor in its valuation.). This is the
5189     *         underlying object with id, value and extensions. The accessor
5190     *         "getCondition" gives direct access to the value
5191     */
5192    public StringType getConditionElement() {
5193      if (this.condition == null)
5194        if (Configuration.errorOnAutoCreate())
5195          throw new Error("Attempt to auto-create ContractAssetComponent.condition");
5196        else if (Configuration.doAutoCreate())
5197          this.condition = new StringType(); // bb
5198      return this.condition;
5199    }
5200
5201    public boolean hasConditionElement() {
5202      return this.condition != null && !this.condition.isEmpty();
5203    }
5204
5205    public boolean hasCondition() {
5206      return this.condition != null && !this.condition.isEmpty();
5207    }
5208
5209    /**
5210     * @param value {@link #condition} (Description of the quality and completeness
5211     *              of the asset that imay be a factor in its valuation.). This is
5212     *              the underlying object with id, value and extensions. The
5213     *              accessor "getCondition" gives direct access to the value
5214     */
5215    public ContractAssetComponent setConditionElement(StringType value) {
5216      this.condition = value;
5217      return this;
5218    }
5219
5220    /**
5221     * @return Description of the quality and completeness of the asset that imay be
5222     *         a factor in its valuation.
5223     */
5224    public String getCondition() {
5225      return this.condition == null ? null : this.condition.getValue();
5226    }
5227
5228    /**
5229     * @param value Description of the quality and completeness of the asset that
5230     *              imay be a factor in its valuation.
5231     */
5232    public ContractAssetComponent setCondition(String value) {
5233      if (Utilities.noString(value))
5234        this.condition = null;
5235      else {
5236        if (this.condition == null)
5237          this.condition = new StringType();
5238        this.condition.setValue(value);
5239      }
5240      return this;
5241    }
5242
5243    /**
5244     * @return {@link #periodType} (Type of Asset availability for use or
5245     *         ownership.)
5246     */
5247    public List<CodeableConcept> getPeriodType() {
5248      if (this.periodType == null)
5249        this.periodType = new ArrayList<CodeableConcept>();
5250      return this.periodType;
5251    }
5252
5253    /**
5254     * @return Returns a reference to <code>this</code> for easy method chaining
5255     */
5256    public ContractAssetComponent setPeriodType(List<CodeableConcept> thePeriodType) {
5257      this.periodType = thePeriodType;
5258      return this;
5259    }
5260
5261    public boolean hasPeriodType() {
5262      if (this.periodType == null)
5263        return false;
5264      for (CodeableConcept item : this.periodType)
5265        if (!item.isEmpty())
5266          return true;
5267      return false;
5268    }
5269
5270    public CodeableConcept addPeriodType() { // 3
5271      CodeableConcept t = new CodeableConcept();
5272      if (this.periodType == null)
5273        this.periodType = new ArrayList<CodeableConcept>();
5274      this.periodType.add(t);
5275      return t;
5276    }
5277
5278    public ContractAssetComponent addPeriodType(CodeableConcept t) { // 3
5279      if (t == null)
5280        return this;
5281      if (this.periodType == null)
5282        this.periodType = new ArrayList<CodeableConcept>();
5283      this.periodType.add(t);
5284      return this;
5285    }
5286
5287    /**
5288     * @return The first repetition of repeating field {@link #periodType}, creating
5289     *         it if it does not already exist
5290     */
5291    public CodeableConcept getPeriodTypeFirstRep() {
5292      if (getPeriodType().isEmpty()) {
5293        addPeriodType();
5294      }
5295      return getPeriodType().get(0);
5296    }
5297
5298    /**
5299     * @return {@link #period} (Asset relevant contractual time period.)
5300     */
5301    public List<Period> getPeriod() {
5302      if (this.period == null)
5303        this.period = new ArrayList<Period>();
5304      return this.period;
5305    }
5306
5307    /**
5308     * @return Returns a reference to <code>this</code> for easy method chaining
5309     */
5310    public ContractAssetComponent setPeriod(List<Period> thePeriod) {
5311      this.period = thePeriod;
5312      return this;
5313    }
5314
5315    public boolean hasPeriod() {
5316      if (this.period == null)
5317        return false;
5318      for (Period item : this.period)
5319        if (!item.isEmpty())
5320          return true;
5321      return false;
5322    }
5323
5324    public Period addPeriod() { // 3
5325      Period t = new Period();
5326      if (this.period == null)
5327        this.period = new ArrayList<Period>();
5328      this.period.add(t);
5329      return t;
5330    }
5331
5332    public ContractAssetComponent addPeriod(Period t) { // 3
5333      if (t == null)
5334        return this;
5335      if (this.period == null)
5336        this.period = new ArrayList<Period>();
5337      this.period.add(t);
5338      return this;
5339    }
5340
5341    /**
5342     * @return The first repetition of repeating field {@link #period}, creating it
5343     *         if it does not already exist
5344     */
5345    public Period getPeriodFirstRep() {
5346      if (getPeriod().isEmpty()) {
5347        addPeriod();
5348      }
5349      return getPeriod().get(0);
5350    }
5351
5352    /**
5353     * @return {@link #usePeriod} (Time period of asset use.)
5354     */
5355    public List<Period> getUsePeriod() {
5356      if (this.usePeriod == null)
5357        this.usePeriod = new ArrayList<Period>();
5358      return this.usePeriod;
5359    }
5360
5361    /**
5362     * @return Returns a reference to <code>this</code> for easy method chaining
5363     */
5364    public ContractAssetComponent setUsePeriod(List<Period> theUsePeriod) {
5365      this.usePeriod = theUsePeriod;
5366      return this;
5367    }
5368
5369    public boolean hasUsePeriod() {
5370      if (this.usePeriod == null)
5371        return false;
5372      for (Period item : this.usePeriod)
5373        if (!item.isEmpty())
5374          return true;
5375      return false;
5376    }
5377
5378    public Period addUsePeriod() { // 3
5379      Period t = new Period();
5380      if (this.usePeriod == null)
5381        this.usePeriod = new ArrayList<Period>();
5382      this.usePeriod.add(t);
5383      return t;
5384    }
5385
5386    public ContractAssetComponent addUsePeriod(Period t) { // 3
5387      if (t == null)
5388        return this;
5389      if (this.usePeriod == null)
5390        this.usePeriod = new ArrayList<Period>();
5391      this.usePeriod.add(t);
5392      return this;
5393    }
5394
5395    /**
5396     * @return The first repetition of repeating field {@link #usePeriod}, creating
5397     *         it if it does not already exist
5398     */
5399    public Period getUsePeriodFirstRep() {
5400      if (getUsePeriod().isEmpty()) {
5401        addUsePeriod();
5402      }
5403      return getUsePeriod().get(0);
5404    }
5405
5406    /**
5407     * @return {@link #text} (Clause or question text (Prose Object) concerning the
5408     *         asset in a linked form, such as a QuestionnaireResponse used in the
5409     *         formation of the contract.). This is the underlying object with id,
5410     *         value and extensions. The accessor "getText" gives direct access to
5411     *         the value
5412     */
5413    public StringType getTextElement() {
5414      if (this.text == null)
5415        if (Configuration.errorOnAutoCreate())
5416          throw new Error("Attempt to auto-create ContractAssetComponent.text");
5417        else if (Configuration.doAutoCreate())
5418          this.text = new StringType(); // bb
5419      return this.text;
5420    }
5421
5422    public boolean hasTextElement() {
5423      return this.text != null && !this.text.isEmpty();
5424    }
5425
5426    public boolean hasText() {
5427      return this.text != null && !this.text.isEmpty();
5428    }
5429
5430    /**
5431     * @param value {@link #text} (Clause or question text (Prose Object) concerning
5432     *              the asset in a linked form, such as a QuestionnaireResponse used
5433     *              in the formation of the contract.). This is the underlying
5434     *              object with id, value and extensions. The accessor "getText"
5435     *              gives direct access to the value
5436     */
5437    public ContractAssetComponent setTextElement(StringType value) {
5438      this.text = value;
5439      return this;
5440    }
5441
5442    /**
5443     * @return Clause or question text (Prose Object) concerning the asset in a
5444     *         linked form, such as a QuestionnaireResponse used in the formation of
5445     *         the contract.
5446     */
5447    public String getText() {
5448      return this.text == null ? null : this.text.getValue();
5449    }
5450
5451    /**
5452     * @param value Clause or question text (Prose Object) concerning the asset in a
5453     *              linked form, such as a QuestionnaireResponse used in the
5454     *              formation of the contract.
5455     */
5456    public ContractAssetComponent setText(String value) {
5457      if (Utilities.noString(value))
5458        this.text = null;
5459      else {
5460        if (this.text == null)
5461          this.text = new StringType();
5462        this.text.setValue(value);
5463      }
5464      return this;
5465    }
5466
5467    /**
5468     * @return {@link #linkId} (Id [identifier??] of the clause or question text
5469     *         about the asset in the referenced form or QuestionnaireResponse.)
5470     */
5471    public List<StringType> getLinkId() {
5472      if (this.linkId == null)
5473        this.linkId = new ArrayList<StringType>();
5474      return this.linkId;
5475    }
5476
5477    /**
5478     * @return Returns a reference to <code>this</code> for easy method chaining
5479     */
5480    public ContractAssetComponent setLinkId(List<StringType> theLinkId) {
5481      this.linkId = theLinkId;
5482      return this;
5483    }
5484
5485    public boolean hasLinkId() {
5486      if (this.linkId == null)
5487        return false;
5488      for (StringType item : this.linkId)
5489        if (!item.isEmpty())
5490          return true;
5491      return false;
5492    }
5493
5494    /**
5495     * @return {@link #linkId} (Id [identifier??] of the clause or question text
5496     *         about the asset in the referenced form or QuestionnaireResponse.)
5497     */
5498    public StringType addLinkIdElement() {// 2
5499      StringType t = new StringType();
5500      if (this.linkId == null)
5501        this.linkId = new ArrayList<StringType>();
5502      this.linkId.add(t);
5503      return t;
5504    }
5505
5506    /**
5507     * @param value {@link #linkId} (Id [identifier??] of the clause or question
5508     *              text about the asset in the referenced form or
5509     *              QuestionnaireResponse.)
5510     */
5511    public ContractAssetComponent addLinkId(String value) { // 1
5512      StringType t = new StringType();
5513      t.setValue(value);
5514      if (this.linkId == null)
5515        this.linkId = new ArrayList<StringType>();
5516      this.linkId.add(t);
5517      return this;
5518    }
5519
5520    /**
5521     * @param value {@link #linkId} (Id [identifier??] of the clause or question
5522     *              text about the asset in the referenced form or
5523     *              QuestionnaireResponse.)
5524     */
5525    public boolean hasLinkId(String value) {
5526      if (this.linkId == null)
5527        return false;
5528      for (StringType v : this.linkId)
5529        if (v.getValue().equals(value)) // string
5530          return true;
5531      return false;
5532    }
5533
5534    /**
5535     * @return {@link #answer} (Response to assets.)
5536     */
5537    public List<AnswerComponent> getAnswer() {
5538      if (this.answer == null)
5539        this.answer = new ArrayList<AnswerComponent>();
5540      return this.answer;
5541    }
5542
5543    /**
5544     * @return Returns a reference to <code>this</code> for easy method chaining
5545     */
5546    public ContractAssetComponent setAnswer(List<AnswerComponent> theAnswer) {
5547      this.answer = theAnswer;
5548      return this;
5549    }
5550
5551    public boolean hasAnswer() {
5552      if (this.answer == null)
5553        return false;
5554      for (AnswerComponent item : this.answer)
5555        if (!item.isEmpty())
5556          return true;
5557      return false;
5558    }
5559
5560    public AnswerComponent addAnswer() { // 3
5561      AnswerComponent t = new AnswerComponent();
5562      if (this.answer == null)
5563        this.answer = new ArrayList<AnswerComponent>();
5564      this.answer.add(t);
5565      return t;
5566    }
5567
5568    public ContractAssetComponent addAnswer(AnswerComponent t) { // 3
5569      if (t == null)
5570        return this;
5571      if (this.answer == null)
5572        this.answer = new ArrayList<AnswerComponent>();
5573      this.answer.add(t);
5574      return this;
5575    }
5576
5577    /**
5578     * @return The first repetition of repeating field {@link #answer}, creating it
5579     *         if it does not already exist
5580     */
5581    public AnswerComponent getAnswerFirstRep() {
5582      if (getAnswer().isEmpty()) {
5583        addAnswer();
5584      }
5585      return getAnswer().get(0);
5586    }
5587
5588    /**
5589     * @return {@link #securityLabelNumber} (Security labels that protects the
5590     *         asset.)
5591     */
5592    public List<UnsignedIntType> getSecurityLabelNumber() {
5593      if (this.securityLabelNumber == null)
5594        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
5595      return this.securityLabelNumber;
5596    }
5597
5598    /**
5599     * @return Returns a reference to <code>this</code> for easy method chaining
5600     */
5601    public ContractAssetComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
5602      this.securityLabelNumber = theSecurityLabelNumber;
5603      return this;
5604    }
5605
5606    public boolean hasSecurityLabelNumber() {
5607      if (this.securityLabelNumber == null)
5608        return false;
5609      for (UnsignedIntType item : this.securityLabelNumber)
5610        if (!item.isEmpty())
5611          return true;
5612      return false;
5613    }
5614
5615    /**
5616     * @return {@link #securityLabelNumber} (Security labels that protects the
5617     *         asset.)
5618     */
5619    public UnsignedIntType addSecurityLabelNumberElement() {// 2
5620      UnsignedIntType t = new UnsignedIntType();
5621      if (this.securityLabelNumber == null)
5622        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
5623      this.securityLabelNumber.add(t);
5624      return t;
5625    }
5626
5627    /**
5628     * @param value {@link #securityLabelNumber} (Security labels that protects the
5629     *              asset.)
5630     */
5631    public ContractAssetComponent addSecurityLabelNumber(int value) { // 1
5632      UnsignedIntType t = new UnsignedIntType();
5633      t.setValue(value);
5634      if (this.securityLabelNumber == null)
5635        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
5636      this.securityLabelNumber.add(t);
5637      return this;
5638    }
5639
5640    /**
5641     * @param value {@link #securityLabelNumber} (Security labels that protects the
5642     *              asset.)
5643     */
5644    public boolean hasSecurityLabelNumber(int value) {
5645      if (this.securityLabelNumber == null)
5646        return false;
5647      for (UnsignedIntType v : this.securityLabelNumber)
5648        if (v.getValue().equals(value)) // unsignedInt
5649          return true;
5650      return false;
5651    }
5652
5653    /**
5654     * @return {@link #valuedItem} (Contract Valued Item List.)
5655     */
5656    public List<ValuedItemComponent> getValuedItem() {
5657      if (this.valuedItem == null)
5658        this.valuedItem = new ArrayList<ValuedItemComponent>();
5659      return this.valuedItem;
5660    }
5661
5662    /**
5663     * @return Returns a reference to <code>this</code> for easy method chaining
5664     */
5665    public ContractAssetComponent setValuedItem(List<ValuedItemComponent> theValuedItem) {
5666      this.valuedItem = theValuedItem;
5667      return this;
5668    }
5669
5670    public boolean hasValuedItem() {
5671      if (this.valuedItem == null)
5672        return false;
5673      for (ValuedItemComponent item : this.valuedItem)
5674        if (!item.isEmpty())
5675          return true;
5676      return false;
5677    }
5678
5679    public ValuedItemComponent addValuedItem() { // 3
5680      ValuedItemComponent t = new ValuedItemComponent();
5681      if (this.valuedItem == null)
5682        this.valuedItem = new ArrayList<ValuedItemComponent>();
5683      this.valuedItem.add(t);
5684      return t;
5685    }
5686
5687    public ContractAssetComponent addValuedItem(ValuedItemComponent t) { // 3
5688      if (t == null)
5689        return this;
5690      if (this.valuedItem == null)
5691        this.valuedItem = new ArrayList<ValuedItemComponent>();
5692      this.valuedItem.add(t);
5693      return this;
5694    }
5695
5696    /**
5697     * @return The first repetition of repeating field {@link #valuedItem}, creating
5698     *         it if it does not already exist
5699     */
5700    public ValuedItemComponent getValuedItemFirstRep() {
5701      if (getValuedItem().isEmpty()) {
5702        addValuedItem();
5703      }
5704      return getValuedItem().get(0);
5705    }
5706
5707    protected void listChildren(List<Property> children) {
5708      super.listChildren(children);
5709      children.add(new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope));
5710      children.add(new Property("type", "CodeableConcept", "Target entity type about which the term may be concerned.",
5711          0, java.lang.Integer.MAX_VALUE, type));
5712      children.add(new Property("typeReference", "Reference(Any)", "Associated entities.", 0,
5713          java.lang.Integer.MAX_VALUE, typeReference));
5714      children.add(new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.", 0,
5715          java.lang.Integer.MAX_VALUE, subtype));
5716      children.add(new Property("relationship", "Coding",
5717          "Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.",
5718          0, 1, relationship));
5719      children.add(new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context));
5720      children.add(new Property("condition", "string",
5721          "Description of the quality and completeness of the asset that imay be a factor in its valuation.", 0, 1,
5722          condition));
5723      children.add(new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0,
5724          java.lang.Integer.MAX_VALUE, periodType));
5725      children.add(new Property("period", "Period", "Asset relevant contractual time period.", 0,
5726          java.lang.Integer.MAX_VALUE, period));
5727      children.add(
5728          new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod));
5729      children.add(new Property("text", "string",
5730          "Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.",
5731          0, 1, text));
5732      children.add(new Property("linkId", "string",
5733          "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.",
5734          0, java.lang.Integer.MAX_VALUE, linkId));
5735      children.add(new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0,
5736          java.lang.Integer.MAX_VALUE, answer));
5737      children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0,
5738          java.lang.Integer.MAX_VALUE, securityLabelNumber));
5739      children.add(
5740          new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
5741    }
5742
5743    @Override
5744    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5745      switch (_hash) {
5746      case 109264468:
5747        /* scope */ return new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1,
5748            scope);
5749      case 3575610:
5750        /* type */ return new Property("type", "CodeableConcept",
5751            "Target entity type about which the term may be concerned.", 0, java.lang.Integer.MAX_VALUE, type);
5752      case 2074825009:
5753        /* typeReference */ return new Property("typeReference", "Reference(Any)", "Associated entities.", 0,
5754            java.lang.Integer.MAX_VALUE, typeReference);
5755      case -1867567750:
5756        /* subtype */ return new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.",
5757            0, java.lang.Integer.MAX_VALUE, subtype);
5758      case -261851592:
5759        /* relationship */ return new Property("relationship", "Coding",
5760            "Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.",
5761            0, 1, relationship);
5762      case 951530927:
5763        /* context */ return new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE,
5764            context);
5765      case -861311717:
5766        /* condition */ return new Property("condition", "string",
5767            "Description of the quality and completeness of the asset that imay be a factor in its valuation.", 0, 1,
5768            condition);
5769      case 384348315:
5770        /* periodType */ return new Property("periodType", "CodeableConcept",
5771            "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType);
5772      case -991726143:
5773        /* period */ return new Property("period", "Period", "Asset relevant contractual time period.", 0,
5774            java.lang.Integer.MAX_VALUE, period);
5775      case -628382168:
5776        /* usePeriod */ return new Property("usePeriod", "Period", "Time period of asset use.", 0,
5777            java.lang.Integer.MAX_VALUE, usePeriod);
5778      case 3556653:
5779        /* text */ return new Property("text", "string",
5780            "Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.",
5781            0, 1, text);
5782      case -1102667083:
5783        /* linkId */ return new Property("linkId", "string",
5784            "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.",
5785            0, java.lang.Integer.MAX_VALUE, linkId);
5786      case -1412808770:
5787        /* answer */ return new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0,
5788            java.lang.Integer.MAX_VALUE, answer);
5789      case -149460995:
5790        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
5791            "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
5792      case 2046675654:
5793        /* valuedItem */ return new Property("valuedItem", "", "Contract Valued Item List.", 0,
5794            java.lang.Integer.MAX_VALUE, valuedItem);
5795      default:
5796        return super.getNamedProperty(_hash, _name, _checkValid);
5797      }
5798
5799    }
5800
5801    @Override
5802    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5803      switch (hash) {
5804      case 109264468:
5805        /* scope */ return this.scope == null ? new Base[0] : new Base[] { this.scope }; // CodeableConcept
5806      case 3575610:
5807        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
5808      case 2074825009:
5809        /* typeReference */ return this.typeReference == null ? new Base[0]
5810            : this.typeReference.toArray(new Base[this.typeReference.size()]); // Reference
5811      case -1867567750:
5812        /* subtype */ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
5813      case -261851592:
5814        /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // Coding
5815      case 951530927:
5816        /* context */ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // AssetContextComponent
5817      case -861311717:
5818        /* condition */ return this.condition == null ? new Base[0] : new Base[] { this.condition }; // StringType
5819      case 384348315:
5820        /* periodType */ return this.periodType == null ? new Base[0]
5821            : this.periodType.toArray(new Base[this.periodType.size()]); // CodeableConcept
5822      case -991726143:
5823        /* period */ return this.period == null ? new Base[0] : this.period.toArray(new Base[this.period.size()]); // Period
5824      case -628382168:
5825        /* usePeriod */ return this.usePeriod == null ? new Base[0]
5826            : this.usePeriod.toArray(new Base[this.usePeriod.size()]); // Period
5827      case 3556653:
5828        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
5829      case -1102667083:
5830        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
5831      case -1412808770:
5832        /* answer */ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
5833      case -149460995:
5834        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
5835            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
5836      case 2046675654:
5837        /* valuedItem */ return this.valuedItem == null ? new Base[0]
5838            : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
5839      default:
5840        return super.getProperty(hash, name, checkValid);
5841      }
5842
5843    }
5844
5845    @Override
5846    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5847      switch (hash) {
5848      case 109264468: // scope
5849        this.scope = castToCodeableConcept(value); // CodeableConcept
5850        return value;
5851      case 3575610: // type
5852        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
5853        return value;
5854      case 2074825009: // typeReference
5855        this.getTypeReference().add(castToReference(value)); // Reference
5856        return value;
5857      case -1867567750: // subtype
5858        this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept
5859        return value;
5860      case -261851592: // relationship
5861        this.relationship = castToCoding(value); // Coding
5862        return value;
5863      case 951530927: // context
5864        this.getContext().add((AssetContextComponent) value); // AssetContextComponent
5865        return value;
5866      case -861311717: // condition
5867        this.condition = castToString(value); // StringType
5868        return value;
5869      case 384348315: // periodType
5870        this.getPeriodType().add(castToCodeableConcept(value)); // CodeableConcept
5871        return value;
5872      case -991726143: // period
5873        this.getPeriod().add(castToPeriod(value)); // Period
5874        return value;
5875      case -628382168: // usePeriod
5876        this.getUsePeriod().add(castToPeriod(value)); // Period
5877        return value;
5878      case 3556653: // text
5879        this.text = castToString(value); // StringType
5880        return value;
5881      case -1102667083: // linkId
5882        this.getLinkId().add(castToString(value)); // StringType
5883        return value;
5884      case -1412808770: // answer
5885        this.getAnswer().add((AnswerComponent) value); // AnswerComponent
5886        return value;
5887      case -149460995: // securityLabelNumber
5888        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
5889        return value;
5890      case 2046675654: // valuedItem
5891        this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
5892        return value;
5893      default:
5894        return super.setProperty(hash, name, value);
5895      }
5896
5897    }
5898
5899    @Override
5900    public Base setProperty(String name, Base value) throws FHIRException {
5901      if (name.equals("scope")) {
5902        this.scope = castToCodeableConcept(value); // CodeableConcept
5903      } else if (name.equals("type")) {
5904        this.getType().add(castToCodeableConcept(value));
5905      } else if (name.equals("typeReference")) {
5906        this.getTypeReference().add(castToReference(value));
5907      } else if (name.equals("subtype")) {
5908        this.getSubtype().add(castToCodeableConcept(value));
5909      } else if (name.equals("relationship")) {
5910        this.relationship = castToCoding(value); // Coding
5911      } else if (name.equals("context")) {
5912        this.getContext().add((AssetContextComponent) value);
5913      } else if (name.equals("condition")) {
5914        this.condition = castToString(value); // StringType
5915      } else if (name.equals("periodType")) {
5916        this.getPeriodType().add(castToCodeableConcept(value));
5917      } else if (name.equals("period")) {
5918        this.getPeriod().add(castToPeriod(value));
5919      } else if (name.equals("usePeriod")) {
5920        this.getUsePeriod().add(castToPeriod(value));
5921      } else if (name.equals("text")) {
5922        this.text = castToString(value); // StringType
5923      } else if (name.equals("linkId")) {
5924        this.getLinkId().add(castToString(value));
5925      } else if (name.equals("answer")) {
5926        this.getAnswer().add((AnswerComponent) value);
5927      } else if (name.equals("securityLabelNumber")) {
5928        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
5929      } else if (name.equals("valuedItem")) {
5930        this.getValuedItem().add((ValuedItemComponent) value);
5931      } else
5932        return super.setProperty(name, value);
5933      return value;
5934    }
5935
5936    @Override
5937    public Base makeProperty(int hash, String name) throws FHIRException {
5938      switch (hash) {
5939      case 109264468:
5940        return getScope();
5941      case 3575610:
5942        return addType();
5943      case 2074825009:
5944        return addTypeReference();
5945      case -1867567750:
5946        return addSubtype();
5947      case -261851592:
5948        return getRelationship();
5949      case 951530927:
5950        return addContext();
5951      case -861311717:
5952        return getConditionElement();
5953      case 384348315:
5954        return addPeriodType();
5955      case -991726143:
5956        return addPeriod();
5957      case -628382168:
5958        return addUsePeriod();
5959      case 3556653:
5960        return getTextElement();
5961      case -1102667083:
5962        return addLinkIdElement();
5963      case -1412808770:
5964        return addAnswer();
5965      case -149460995:
5966        return addSecurityLabelNumberElement();
5967      case 2046675654:
5968        return addValuedItem();
5969      default:
5970        return super.makeProperty(hash, name);
5971      }
5972
5973    }
5974
5975    @Override
5976    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5977      switch (hash) {
5978      case 109264468:
5979        /* scope */ return new String[] { "CodeableConcept" };
5980      case 3575610:
5981        /* type */ return new String[] { "CodeableConcept" };
5982      case 2074825009:
5983        /* typeReference */ return new String[] { "Reference" };
5984      case -1867567750:
5985        /* subtype */ return new String[] { "CodeableConcept" };
5986      case -261851592:
5987        /* relationship */ return new String[] { "Coding" };
5988      case 951530927:
5989        /* context */ return new String[] {};
5990      case -861311717:
5991        /* condition */ return new String[] { "string" };
5992      case 384348315:
5993        /* periodType */ return new String[] { "CodeableConcept" };
5994      case -991726143:
5995        /* period */ return new String[] { "Period" };
5996      case -628382168:
5997        /* usePeriod */ return new String[] { "Period" };
5998      case 3556653:
5999        /* text */ return new String[] { "string" };
6000      case -1102667083:
6001        /* linkId */ return new String[] { "string" };
6002      case -1412808770:
6003        /* answer */ return new String[] { "@Contract.term.offer.answer" };
6004      case -149460995:
6005        /* securityLabelNumber */ return new String[] { "unsignedInt" };
6006      case 2046675654:
6007        /* valuedItem */ return new String[] {};
6008      default:
6009        return super.getTypesForProperty(hash, name);
6010      }
6011
6012    }
6013
6014    @Override
6015    public Base addChild(String name) throws FHIRException {
6016      if (name.equals("scope")) {
6017        this.scope = new CodeableConcept();
6018        return this.scope;
6019      } else if (name.equals("type")) {
6020        return addType();
6021      } else if (name.equals("typeReference")) {
6022        return addTypeReference();
6023      } else if (name.equals("subtype")) {
6024        return addSubtype();
6025      } else if (name.equals("relationship")) {
6026        this.relationship = new Coding();
6027        return this.relationship;
6028      } else if (name.equals("context")) {
6029        return addContext();
6030      } else if (name.equals("condition")) {
6031        throw new FHIRException("Cannot call addChild on a singleton property Contract.condition");
6032      } else if (name.equals("periodType")) {
6033        return addPeriodType();
6034      } else if (name.equals("period")) {
6035        return addPeriod();
6036      } else if (name.equals("usePeriod")) {
6037        return addUsePeriod();
6038      } else if (name.equals("text")) {
6039        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
6040      } else if (name.equals("linkId")) {
6041        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
6042      } else if (name.equals("answer")) {
6043        return addAnswer();
6044      } else if (name.equals("securityLabelNumber")) {
6045        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
6046      } else if (name.equals("valuedItem")) {
6047        return addValuedItem();
6048      } else
6049        return super.addChild(name);
6050    }
6051
6052    public ContractAssetComponent copy() {
6053      ContractAssetComponent dst = new ContractAssetComponent();
6054      copyValues(dst);
6055      return dst;
6056    }
6057
6058    public void copyValues(ContractAssetComponent dst) {
6059      super.copyValues(dst);
6060      dst.scope = scope == null ? null : scope.copy();
6061      if (type != null) {
6062        dst.type = new ArrayList<CodeableConcept>();
6063        for (CodeableConcept i : type)
6064          dst.type.add(i.copy());
6065      }
6066      ;
6067      if (typeReference != null) {
6068        dst.typeReference = new ArrayList<Reference>();
6069        for (Reference i : typeReference)
6070          dst.typeReference.add(i.copy());
6071      }
6072      ;
6073      if (subtype != null) {
6074        dst.subtype = new ArrayList<CodeableConcept>();
6075        for (CodeableConcept i : subtype)
6076          dst.subtype.add(i.copy());
6077      }
6078      ;
6079      dst.relationship = relationship == null ? null : relationship.copy();
6080      if (context != null) {
6081        dst.context = new ArrayList<AssetContextComponent>();
6082        for (AssetContextComponent i : context)
6083          dst.context.add(i.copy());
6084      }
6085      ;
6086      dst.condition = condition == null ? null : condition.copy();
6087      if (periodType != null) {
6088        dst.periodType = new ArrayList<CodeableConcept>();
6089        for (CodeableConcept i : periodType)
6090          dst.periodType.add(i.copy());
6091      }
6092      ;
6093      if (period != null) {
6094        dst.period = new ArrayList<Period>();
6095        for (Period i : period)
6096          dst.period.add(i.copy());
6097      }
6098      ;
6099      if (usePeriod != null) {
6100        dst.usePeriod = new ArrayList<Period>();
6101        for (Period i : usePeriod)
6102          dst.usePeriod.add(i.copy());
6103      }
6104      ;
6105      dst.text = text == null ? null : text.copy();
6106      if (linkId != null) {
6107        dst.linkId = new ArrayList<StringType>();
6108        for (StringType i : linkId)
6109          dst.linkId.add(i.copy());
6110      }
6111      ;
6112      if (answer != null) {
6113        dst.answer = new ArrayList<AnswerComponent>();
6114        for (AnswerComponent i : answer)
6115          dst.answer.add(i.copy());
6116      }
6117      ;
6118      if (securityLabelNumber != null) {
6119        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
6120        for (UnsignedIntType i : securityLabelNumber)
6121          dst.securityLabelNumber.add(i.copy());
6122      }
6123      ;
6124      if (valuedItem != null) {
6125        dst.valuedItem = new ArrayList<ValuedItemComponent>();
6126        for (ValuedItemComponent i : valuedItem)
6127          dst.valuedItem.add(i.copy());
6128      }
6129      ;
6130    }
6131
6132    @Override
6133    public boolean equalsDeep(Base other_) {
6134      if (!super.equalsDeep(other_))
6135        return false;
6136      if (!(other_ instanceof ContractAssetComponent))
6137        return false;
6138      ContractAssetComponent o = (ContractAssetComponent) other_;
6139      return compareDeep(scope, o.scope, true) && compareDeep(type, o.type, true)
6140          && compareDeep(typeReference, o.typeReference, true) && compareDeep(subtype, o.subtype, true)
6141          && compareDeep(relationship, o.relationship, true) && compareDeep(context, o.context, true)
6142          && compareDeep(condition, o.condition, true) && compareDeep(periodType, o.periodType, true)
6143          && compareDeep(period, o.period, true) && compareDeep(usePeriod, o.usePeriod, true)
6144          && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
6145          && compareDeep(answer, o.answer, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
6146          && compareDeep(valuedItem, o.valuedItem, true);
6147    }
6148
6149    @Override
6150    public boolean equalsShallow(Base other_) {
6151      if (!super.equalsShallow(other_))
6152        return false;
6153      if (!(other_ instanceof ContractAssetComponent))
6154        return false;
6155      ContractAssetComponent o = (ContractAssetComponent) other_;
6156      return compareValues(condition, o.condition, true) && compareValues(text, o.text, true)
6157          && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true);
6158    }
6159
6160    public boolean isEmpty() {
6161      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(scope, type, typeReference, subtype, relationship,
6162          context, condition, periodType, period, usePeriod, text, linkId, answer, securityLabelNumber, valuedItem);
6163    }
6164
6165    public String fhirType() {
6166      return "Contract.term.asset";
6167
6168    }
6169
6170  }
6171
6172  @Block()
6173  public static class AssetContextComponent extends BackboneElement implements IBaseBackboneElement {
6174    /**
6175     * Asset context reference may include the creator, custodian, or owning Person
6176     * or Organization (e.g., bank, repository), location held, e.g., building,
6177     * jurisdiction.
6178     */
6179    @Child(name = "reference", type = {
6180        Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
6181    @Description(shortDefinition = "Creator,custodian or owner", formalDefinition = "Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.")
6182    protected Reference reference;
6183
6184    /**
6185     * The actual object that is the target of the reference (Asset context
6186     * reference may include the creator, custodian, or owning Person or
6187     * Organization (e.g., bank, repository), location held, e.g., building,
6188     * jurisdiction.)
6189     */
6190    protected Resource referenceTarget;
6191
6192    /**
6193     * Coded representation of the context generally or of the Referenced entity,
6194     * such as the asset holder type or location.
6195     */
6196    @Child(name = "code", type = {
6197        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6198    @Description(shortDefinition = "Codeable asset context", formalDefinition = "Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.")
6199    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assetcontext")
6200    protected List<CodeableConcept> code;
6201
6202    /**
6203     * Context description.
6204     */
6205    @Child(name = "text", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6206    @Description(shortDefinition = "Context description", formalDefinition = "Context description.")
6207    protected StringType text;
6208
6209    private static final long serialVersionUID = -634115628L;
6210
6211    /**
6212     * Constructor
6213     */
6214    public AssetContextComponent() {
6215      super();
6216    }
6217
6218    /**
6219     * @return {@link #reference} (Asset context reference may include the creator,
6220     *         custodian, or owning Person or Organization (e.g., bank, repository),
6221     *         location held, e.g., building, jurisdiction.)
6222     */
6223    public Reference getReference() {
6224      if (this.reference == null)
6225        if (Configuration.errorOnAutoCreate())
6226          throw new Error("Attempt to auto-create AssetContextComponent.reference");
6227        else if (Configuration.doAutoCreate())
6228          this.reference = new Reference(); // cc
6229      return this.reference;
6230    }
6231
6232    public boolean hasReference() {
6233      return this.reference != null && !this.reference.isEmpty();
6234    }
6235
6236    /**
6237     * @param value {@link #reference} (Asset context reference may include the
6238     *              creator, custodian, or owning Person or Organization (e.g.,
6239     *              bank, repository), location held, e.g., building, jurisdiction.)
6240     */
6241    public AssetContextComponent setReference(Reference value) {
6242      this.reference = value;
6243      return this;
6244    }
6245
6246    /**
6247     * @return {@link #reference} The actual object that is the target of the
6248     *         reference. The reference library doesn't populate this, but you can
6249     *         use it to hold the resource if you resolve it. (Asset context
6250     *         reference may include the creator, custodian, or owning Person or
6251     *         Organization (e.g., bank, repository), location held, e.g., building,
6252     *         jurisdiction.)
6253     */
6254    public Resource getReferenceTarget() {
6255      return this.referenceTarget;
6256    }
6257
6258    /**
6259     * @param value {@link #reference} The actual object that is the target of the
6260     *              reference. The reference library doesn't use these, but you can
6261     *              use it to hold the resource if you resolve it. (Asset context
6262     *              reference may include the creator, custodian, or owning Person
6263     *              or Organization (e.g., bank, repository), location held, e.g.,
6264     *              building, jurisdiction.)
6265     */
6266    public AssetContextComponent setReferenceTarget(Resource value) {
6267      this.referenceTarget = value;
6268      return this;
6269    }
6270
6271    /**
6272     * @return {@link #code} (Coded representation of the context generally or of
6273     *         the Referenced entity, such as the asset holder type or location.)
6274     */
6275    public List<CodeableConcept> getCode() {
6276      if (this.code == null)
6277        this.code = new ArrayList<CodeableConcept>();
6278      return this.code;
6279    }
6280
6281    /**
6282     * @return Returns a reference to <code>this</code> for easy method chaining
6283     */
6284    public AssetContextComponent setCode(List<CodeableConcept> theCode) {
6285      this.code = theCode;
6286      return this;
6287    }
6288
6289    public boolean hasCode() {
6290      if (this.code == null)
6291        return false;
6292      for (CodeableConcept item : this.code)
6293        if (!item.isEmpty())
6294          return true;
6295      return false;
6296    }
6297
6298    public CodeableConcept addCode() { // 3
6299      CodeableConcept t = new CodeableConcept();
6300      if (this.code == null)
6301        this.code = new ArrayList<CodeableConcept>();
6302      this.code.add(t);
6303      return t;
6304    }
6305
6306    public AssetContextComponent addCode(CodeableConcept t) { // 3
6307      if (t == null)
6308        return this;
6309      if (this.code == null)
6310        this.code = new ArrayList<CodeableConcept>();
6311      this.code.add(t);
6312      return this;
6313    }
6314
6315    /**
6316     * @return The first repetition of repeating field {@link #code}, creating it if
6317     *         it does not already exist
6318     */
6319    public CodeableConcept getCodeFirstRep() {
6320      if (getCode().isEmpty()) {
6321        addCode();
6322      }
6323      return getCode().get(0);
6324    }
6325
6326    /**
6327     * @return {@link #text} (Context description.). This is the underlying object
6328     *         with id, value and extensions. The accessor "getText" gives direct
6329     *         access to the value
6330     */
6331    public StringType getTextElement() {
6332      if (this.text == null)
6333        if (Configuration.errorOnAutoCreate())
6334          throw new Error("Attempt to auto-create AssetContextComponent.text");
6335        else if (Configuration.doAutoCreate())
6336          this.text = new StringType(); // bb
6337      return this.text;
6338    }
6339
6340    public boolean hasTextElement() {
6341      return this.text != null && !this.text.isEmpty();
6342    }
6343
6344    public boolean hasText() {
6345      return this.text != null && !this.text.isEmpty();
6346    }
6347
6348    /**
6349     * @param value {@link #text} (Context description.). This is the underlying
6350     *              object with id, value and extensions. The accessor "getText"
6351     *              gives direct access to the value
6352     */
6353    public AssetContextComponent setTextElement(StringType value) {
6354      this.text = value;
6355      return this;
6356    }
6357
6358    /**
6359     * @return Context description.
6360     */
6361    public String getText() {
6362      return this.text == null ? null : this.text.getValue();
6363    }
6364
6365    /**
6366     * @param value Context description.
6367     */
6368    public AssetContextComponent setText(String value) {
6369      if (Utilities.noString(value))
6370        this.text = null;
6371      else {
6372        if (this.text == null)
6373          this.text = new StringType();
6374        this.text.setValue(value);
6375      }
6376      return this;
6377    }
6378
6379    protected void listChildren(List<Property> children) {
6380      super.listChildren(children);
6381      children.add(new Property("reference", "Reference(Any)",
6382          "Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.",
6383          0, 1, reference));
6384      children.add(new Property("code", "CodeableConcept",
6385          "Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.",
6386          0, java.lang.Integer.MAX_VALUE, code));
6387      children.add(new Property("text", "string", "Context description.", 0, 1, text));
6388    }
6389
6390    @Override
6391    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6392      switch (_hash) {
6393      case -925155509:
6394        /* reference */ return new Property("reference", "Reference(Any)",
6395            "Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.",
6396            0, 1, reference);
6397      case 3059181:
6398        /* code */ return new Property("code", "CodeableConcept",
6399            "Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.",
6400            0, java.lang.Integer.MAX_VALUE, code);
6401      case 3556653:
6402        /* text */ return new Property("text", "string", "Context description.", 0, 1, text);
6403      default:
6404        return super.getNamedProperty(_hash, _name, _checkValid);
6405      }
6406
6407    }
6408
6409    @Override
6410    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6411      switch (hash) {
6412      case -925155509:
6413        /* reference */ return this.reference == null ? new Base[0] : new Base[] { this.reference }; // Reference
6414      case 3059181:
6415        /* code */ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
6416      case 3556653:
6417        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
6418      default:
6419        return super.getProperty(hash, name, checkValid);
6420      }
6421
6422    }
6423
6424    @Override
6425    public Base setProperty(int hash, String name, Base value) throws FHIRException {
6426      switch (hash) {
6427      case -925155509: // reference
6428        this.reference = castToReference(value); // Reference
6429        return value;
6430      case 3059181: // code
6431        this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
6432        return value;
6433      case 3556653: // text
6434        this.text = castToString(value); // StringType
6435        return value;
6436      default:
6437        return super.setProperty(hash, name, value);
6438      }
6439
6440    }
6441
6442    @Override
6443    public Base setProperty(String name, Base value) throws FHIRException {
6444      if (name.equals("reference")) {
6445        this.reference = castToReference(value); // Reference
6446      } else if (name.equals("code")) {
6447        this.getCode().add(castToCodeableConcept(value));
6448      } else if (name.equals("text")) {
6449        this.text = castToString(value); // StringType
6450      } else
6451        return super.setProperty(name, value);
6452      return value;
6453    }
6454
6455    @Override
6456    public Base makeProperty(int hash, String name) throws FHIRException {
6457      switch (hash) {
6458      case -925155509:
6459        return getReference();
6460      case 3059181:
6461        return addCode();
6462      case 3556653:
6463        return getTextElement();
6464      default:
6465        return super.makeProperty(hash, name);
6466      }
6467
6468    }
6469
6470    @Override
6471    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6472      switch (hash) {
6473      case -925155509:
6474        /* reference */ return new String[] { "Reference" };
6475      case 3059181:
6476        /* code */ return new String[] { "CodeableConcept" };
6477      case 3556653:
6478        /* text */ return new String[] { "string" };
6479      default:
6480        return super.getTypesForProperty(hash, name);
6481      }
6482
6483    }
6484
6485    @Override
6486    public Base addChild(String name) throws FHIRException {
6487      if (name.equals("reference")) {
6488        this.reference = new Reference();
6489        return this.reference;
6490      } else if (name.equals("code")) {
6491        return addCode();
6492      } else if (name.equals("text")) {
6493        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
6494      } else
6495        return super.addChild(name);
6496    }
6497
6498    public AssetContextComponent copy() {
6499      AssetContextComponent dst = new AssetContextComponent();
6500      copyValues(dst);
6501      return dst;
6502    }
6503
6504    public void copyValues(AssetContextComponent dst) {
6505      super.copyValues(dst);
6506      dst.reference = reference == null ? null : reference.copy();
6507      if (code != null) {
6508        dst.code = new ArrayList<CodeableConcept>();
6509        for (CodeableConcept i : code)
6510          dst.code.add(i.copy());
6511      }
6512      ;
6513      dst.text = text == null ? null : text.copy();
6514    }
6515
6516    @Override
6517    public boolean equalsDeep(Base other_) {
6518      if (!super.equalsDeep(other_))
6519        return false;
6520      if (!(other_ instanceof AssetContextComponent))
6521        return false;
6522      AssetContextComponent o = (AssetContextComponent) other_;
6523      return compareDeep(reference, o.reference, true) && compareDeep(code, o.code, true)
6524          && compareDeep(text, o.text, true);
6525    }
6526
6527    @Override
6528    public boolean equalsShallow(Base other_) {
6529      if (!super.equalsShallow(other_))
6530        return false;
6531      if (!(other_ instanceof AssetContextComponent))
6532        return false;
6533      AssetContextComponent o = (AssetContextComponent) other_;
6534      return compareValues(text, o.text, true);
6535    }
6536
6537    public boolean isEmpty() {
6538      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, code, text);
6539    }
6540
6541    public String fhirType() {
6542      return "Contract.term.asset.context";
6543
6544    }
6545
6546  }
6547
6548  @Block()
6549  public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
6550    /**
6551     * Specific type of Contract Valued Item that may be priced.
6552     */
6553    @Child(name = "entity", type = { CodeableConcept.class,
6554        Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
6555    @Description(shortDefinition = "Contract Valued Item Type", formalDefinition = "Specific type of Contract Valued Item that may be priced.")
6556    protected Type entity;
6557
6558    /**
6559     * Identifies a Contract Valued Item instance.
6560     */
6561    @Child(name = "identifier", type = {
6562        Identifier.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6563    @Description(shortDefinition = "Contract Valued Item Number", formalDefinition = "Identifies a Contract Valued Item instance.")
6564    protected Identifier identifier;
6565
6566    /**
6567     * Indicates the time during which this Contract ValuedItem information is
6568     * effective.
6569     */
6570    @Child(name = "effectiveTime", type = {
6571        DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6572    @Description(shortDefinition = "Contract Valued Item Effective Tiem", formalDefinition = "Indicates the time during which this Contract ValuedItem information is effective.")
6573    protected DateTimeType effectiveTime;
6574
6575    /**
6576     * Specifies the units by which the Contract Valued Item is measured or counted,
6577     * and quantifies the countable or measurable Contract Valued Item instances.
6578     */
6579    @Child(name = "quantity", type = { Quantity.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
6580    @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.")
6581    protected Quantity quantity;
6582
6583    /**
6584     * A Contract Valued Item unit valuation measure.
6585     */
6586    @Child(name = "unitPrice", type = { Money.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
6587    @Description(shortDefinition = "Contract Valued Item fee, charge, or cost", formalDefinition = "A Contract Valued Item unit valuation measure.")
6588    protected Money unitPrice;
6589
6590    /**
6591     * A real number that represents a multiplier used in determining the overall
6592     * value of the Contract Valued Item delivered. The concept of a Factor allows
6593     * for a discount or surcharge multiplier to be applied to a monetary amount.
6594     */
6595    @Child(name = "factor", type = {
6596        DecimalType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
6597    @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.")
6598    protected DecimalType factor;
6599
6600    /**
6601     * An amount that expresses the weighting (based on difficulty, cost and/or
6602     * resource intensiveness) associated with the Contract Valued Item delivered.
6603     * The concept of Points allows for assignment of point values for a Contract
6604     * Valued Item, such that a monetary amount can be assigned to each point.
6605     */
6606    @Child(name = "points", type = {
6607        DecimalType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
6608    @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.")
6609    protected DecimalType points;
6610
6611    /**
6612     * Expresses the product of the Contract Valued Item unitQuantity and the
6613     * unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per
6614     * Point) * factor Number * points = net Amount. Quantity, factor and points are
6615     * assumed to be 1 if not supplied.
6616     */
6617    @Child(name = "net", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
6618    @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.")
6619    protected Money net;
6620
6621    /**
6622     * Terms of valuation.
6623     */
6624    @Child(name = "payment", type = {
6625        StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
6626    @Description(shortDefinition = "Terms of valuation", formalDefinition = "Terms of valuation.")
6627    protected StringType payment;
6628
6629    /**
6630     * When payment is due.
6631     */
6632    @Child(name = "paymentDate", type = {
6633        DateTimeType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
6634    @Description(shortDefinition = "When payment is due", formalDefinition = "When payment is due.")
6635    protected DateTimeType paymentDate;
6636
6637    /**
6638     * Who will make payment.
6639     */
6640    @Child(name = "responsible", type = { Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
6641        RelatedPerson.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
6642    @Description(shortDefinition = "Who will make payment", formalDefinition = "Who will make payment.")
6643    protected Reference responsible;
6644
6645    /**
6646     * The actual object that is the target of the reference (Who will make
6647     * payment.)
6648     */
6649    protected Resource responsibleTarget;
6650
6651    /**
6652     * Who will receive payment.
6653     */
6654    @Child(name = "recipient", type = { Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
6655        RelatedPerson.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
6656    @Description(shortDefinition = "Who will receive payment", formalDefinition = "Who will receive payment.")
6657    protected Reference recipient;
6658
6659    /**
6660     * The actual object that is the target of the reference (Who will receive
6661     * payment.)
6662     */
6663    protected Resource recipientTarget;
6664
6665    /**
6666     * Id of the clause or question text related to the context of this valuedItem
6667     * in the referenced form or QuestionnaireResponse.
6668     */
6669    @Child(name = "linkId", type = {
6670        StringType.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6671    @Description(shortDefinition = "Pointer to specific item", formalDefinition = "Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.")
6672    protected List<StringType> linkId;
6673
6674    /**
6675     * A set of security labels that define which terms are controlled by this
6676     * condition.
6677     */
6678    @Child(name = "securityLabelNumber", type = {
6679        UnsignedIntType.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6680    @Description(shortDefinition = "Security Labels that define affected terms", formalDefinition = "A set of security labels that define which terms are controlled by this condition.")
6681    protected List<UnsignedIntType> securityLabelNumber;
6682
6683    private static final long serialVersionUID = 1894951601L;
6684
6685    /**
6686     * Constructor
6687     */
6688    public ValuedItemComponent() {
6689      super();
6690    }
6691
6692    /**
6693     * @return {@link #entity} (Specific type of Contract Valued Item that may be
6694     *         priced.)
6695     */
6696    public Type getEntity() {
6697      return this.entity;
6698    }
6699
6700    /**
6701     * @return {@link #entity} (Specific type of Contract Valued Item that may be
6702     *         priced.)
6703     */
6704    public CodeableConcept getEntityCodeableConcept() throws FHIRException {
6705      if (this.entity == null)
6706        this.entity = new CodeableConcept();
6707      if (!(this.entity instanceof CodeableConcept))
6708        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
6709            + this.entity.getClass().getName() + " was encountered");
6710      return (CodeableConcept) this.entity;
6711    }
6712
6713    public boolean hasEntityCodeableConcept() {
6714      return this != null && this.entity instanceof CodeableConcept;
6715    }
6716
6717    /**
6718     * @return {@link #entity} (Specific type of Contract Valued Item that may be
6719     *         priced.)
6720     */
6721    public Reference getEntityReference() throws FHIRException {
6722      if (this.entity == null)
6723        this.entity = new Reference();
6724      if (!(this.entity instanceof Reference))
6725        throw new FHIRException("Type mismatch: the type Reference was expected, but "
6726            + this.entity.getClass().getName() + " was encountered");
6727      return (Reference) this.entity;
6728    }
6729
6730    public boolean hasEntityReference() {
6731      return this != null && this.entity instanceof Reference;
6732    }
6733
6734    public boolean hasEntity() {
6735      return this.entity != null && !this.entity.isEmpty();
6736    }
6737
6738    /**
6739     * @param value {@link #entity} (Specific type of Contract Valued Item that may
6740     *              be priced.)
6741     */
6742    public ValuedItemComponent setEntity(Type value) {
6743      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
6744        throw new Error("Not the right type for Contract.term.asset.valuedItem.entity[x]: " + value.fhirType());
6745      this.entity = value;
6746      return this;
6747    }
6748
6749    /**
6750     * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
6751     */
6752    public Identifier getIdentifier() {
6753      if (this.identifier == null)
6754        if (Configuration.errorOnAutoCreate())
6755          throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
6756        else if (Configuration.doAutoCreate())
6757          this.identifier = new Identifier(); // cc
6758      return this.identifier;
6759    }
6760
6761    public boolean hasIdentifier() {
6762      return this.identifier != null && !this.identifier.isEmpty();
6763    }
6764
6765    /**
6766     * @param value {@link #identifier} (Identifies a Contract Valued Item
6767     *              instance.)
6768     */
6769    public ValuedItemComponent setIdentifier(Identifier value) {
6770      this.identifier = value;
6771      return this;
6772    }
6773
6774    /**
6775     * @return {@link #effectiveTime} (Indicates the time during which this Contract
6776     *         ValuedItem information is effective.). This is the underlying object
6777     *         with id, value and extensions. The accessor "getEffectiveTime" gives
6778     *         direct access to the value
6779     */
6780    public DateTimeType getEffectiveTimeElement() {
6781      if (this.effectiveTime == null)
6782        if (Configuration.errorOnAutoCreate())
6783          throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
6784        else if (Configuration.doAutoCreate())
6785          this.effectiveTime = new DateTimeType(); // bb
6786      return this.effectiveTime;
6787    }
6788
6789    public boolean hasEffectiveTimeElement() {
6790      return this.effectiveTime != null && !this.effectiveTime.isEmpty();
6791    }
6792
6793    public boolean hasEffectiveTime() {
6794      return this.effectiveTime != null && !this.effectiveTime.isEmpty();
6795    }
6796
6797    /**
6798     * @param value {@link #effectiveTime} (Indicates the time during which this
6799     *              Contract ValuedItem information is effective.). This is the
6800     *              underlying object with id, value and extensions. The accessor
6801     *              "getEffectiveTime" gives direct access to the value
6802     */
6803    public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) {
6804      this.effectiveTime = value;
6805      return this;
6806    }
6807
6808    /**
6809     * @return Indicates the time during which this Contract ValuedItem information
6810     *         is effective.
6811     */
6812    public Date getEffectiveTime() {
6813      return this.effectiveTime == null ? null : this.effectiveTime.getValue();
6814    }
6815
6816    /**
6817     * @param value Indicates the time during which this Contract ValuedItem
6818     *              information is effective.
6819     */
6820    public ValuedItemComponent setEffectiveTime(Date value) {
6821      if (value == null)
6822        this.effectiveTime = null;
6823      else {
6824        if (this.effectiveTime == null)
6825          this.effectiveTime = new DateTimeType();
6826        this.effectiveTime.setValue(value);
6827      }
6828      return this;
6829    }
6830
6831    /**
6832     * @return {@link #quantity} (Specifies the units by which the Contract Valued
6833     *         Item is measured or counted, and quantifies the countable or
6834     *         measurable Contract Valued Item instances.)
6835     */
6836    public Quantity getQuantity() {
6837      if (this.quantity == null)
6838        if (Configuration.errorOnAutoCreate())
6839          throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
6840        else if (Configuration.doAutoCreate())
6841          this.quantity = new Quantity(); // cc
6842      return this.quantity;
6843    }
6844
6845    public boolean hasQuantity() {
6846      return this.quantity != null && !this.quantity.isEmpty();
6847    }
6848
6849    /**
6850     * @param value {@link #quantity} (Specifies the units by which the Contract
6851     *              Valued Item is measured or counted, and quantifies the countable
6852     *              or measurable Contract Valued Item instances.)
6853     */
6854    public ValuedItemComponent setQuantity(Quantity value) {
6855      this.quantity = value;
6856      return this;
6857    }
6858
6859    /**
6860     * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
6861     */
6862    public Money getUnitPrice() {
6863      if (this.unitPrice == null)
6864        if (Configuration.errorOnAutoCreate())
6865          throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
6866        else if (Configuration.doAutoCreate())
6867          this.unitPrice = new Money(); // cc
6868      return this.unitPrice;
6869    }
6870
6871    public boolean hasUnitPrice() {
6872      return this.unitPrice != null && !this.unitPrice.isEmpty();
6873    }
6874
6875    /**
6876     * @param value {@link #unitPrice} (A Contract Valued Item unit valuation
6877     *              measure.)
6878     */
6879    public ValuedItemComponent setUnitPrice(Money value) {
6880      this.unitPrice = value;
6881      return this;
6882    }
6883
6884    /**
6885     * @return {@link #factor} (A real number that represents a multiplier used in
6886     *         determining the overall value of the Contract Valued Item delivered.
6887     *         The concept of a Factor allows for a discount or surcharge multiplier
6888     *         to be applied to a monetary amount.). This is the underlying object
6889     *         with id, value and extensions. The accessor "getFactor" gives direct
6890     *         access to the value
6891     */
6892    public DecimalType getFactorElement() {
6893      if (this.factor == null)
6894        if (Configuration.errorOnAutoCreate())
6895          throw new Error("Attempt to auto-create ValuedItemComponent.factor");
6896        else if (Configuration.doAutoCreate())
6897          this.factor = new DecimalType(); // bb
6898      return this.factor;
6899    }
6900
6901    public boolean hasFactorElement() {
6902      return this.factor != null && !this.factor.isEmpty();
6903    }
6904
6905    public boolean hasFactor() {
6906      return this.factor != null && !this.factor.isEmpty();
6907    }
6908
6909    /**
6910     * @param value {@link #factor} (A real number that represents a multiplier used
6911     *              in determining the overall value of the Contract Valued Item
6912     *              delivered. The concept of a Factor allows for a discount or
6913     *              surcharge multiplier to be applied to a monetary amount.). This
6914     *              is the underlying object with id, value and extensions. The
6915     *              accessor "getFactor" gives direct access to the value
6916     */
6917    public ValuedItemComponent setFactorElement(DecimalType value) {
6918      this.factor = value;
6919      return this;
6920    }
6921
6922    /**
6923     * @return A real number that represents a multiplier used in determining the
6924     *         overall value of the Contract Valued Item delivered. The concept of a
6925     *         Factor allows for a discount or surcharge multiplier to be applied to
6926     *         a monetary amount.
6927     */
6928    public BigDecimal getFactor() {
6929      return this.factor == null ? null : this.factor.getValue();
6930    }
6931
6932    /**
6933     * @param value A real number that represents a multiplier used in determining
6934     *              the overall value of the Contract Valued Item delivered. The
6935     *              concept of a Factor allows for a discount or surcharge
6936     *              multiplier to be applied to a monetary amount.
6937     */
6938    public ValuedItemComponent setFactor(BigDecimal value) {
6939      if (value == null)
6940        this.factor = null;
6941      else {
6942        if (this.factor == null)
6943          this.factor = new DecimalType();
6944        this.factor.setValue(value);
6945      }
6946      return this;
6947    }
6948
6949    /**
6950     * @param value A real number that represents a multiplier used in determining
6951     *              the overall value of the Contract Valued Item delivered. The
6952     *              concept of a Factor allows for a discount or surcharge
6953     *              multiplier to be applied to a monetary amount.
6954     */
6955    public ValuedItemComponent setFactor(long value) {
6956      this.factor = new DecimalType();
6957      this.factor.setValue(value);
6958      return this;
6959    }
6960
6961    /**
6962     * @param value A real number that represents a multiplier used in determining
6963     *              the overall value of the Contract Valued Item delivered. The
6964     *              concept of a Factor allows for a discount or surcharge
6965     *              multiplier to be applied to a monetary amount.
6966     */
6967    public ValuedItemComponent setFactor(double value) {
6968      this.factor = new DecimalType();
6969      this.factor.setValue(value);
6970      return this;
6971    }
6972
6973    /**
6974     * @return {@link #points} (An amount that expresses the weighting (based on
6975     *         difficulty, cost and/or resource intensiveness) associated with the
6976     *         Contract Valued Item delivered. The concept of Points allows for
6977     *         assignment of point values for a Contract Valued Item, such that a
6978     *         monetary amount can be assigned to each point.). This is the
6979     *         underlying object with id, value and extensions. The accessor
6980     *         "getPoints" gives direct access to the value
6981     */
6982    public DecimalType getPointsElement() {
6983      if (this.points == null)
6984        if (Configuration.errorOnAutoCreate())
6985          throw new Error("Attempt to auto-create ValuedItemComponent.points");
6986        else if (Configuration.doAutoCreate())
6987          this.points = new DecimalType(); // bb
6988      return this.points;
6989    }
6990
6991    public boolean hasPointsElement() {
6992      return this.points != null && !this.points.isEmpty();
6993    }
6994
6995    public boolean hasPoints() {
6996      return this.points != null && !this.points.isEmpty();
6997    }
6998
6999    /**
7000     * @param value {@link #points} (An amount that expresses the weighting (based
7001     *              on difficulty, cost and/or resource intensiveness) associated
7002     *              with the Contract Valued Item delivered. The concept of Points
7003     *              allows for assignment of point values for a Contract Valued
7004     *              Item, such that a monetary amount can be assigned to each
7005     *              point.). This is the underlying object with id, value and
7006     *              extensions. The accessor "getPoints" gives direct access to the
7007     *              value
7008     */
7009    public ValuedItemComponent setPointsElement(DecimalType value) {
7010      this.points = value;
7011      return this;
7012    }
7013
7014    /**
7015     * @return An amount that expresses the weighting (based on difficulty, cost
7016     *         and/or resource intensiveness) associated with the Contract Valued
7017     *         Item delivered. The concept of Points allows for assignment of point
7018     *         values for a Contract Valued Item, such that a monetary amount can be
7019     *         assigned to each point.
7020     */
7021    public BigDecimal getPoints() {
7022      return this.points == null ? null : this.points.getValue();
7023    }
7024
7025    /**
7026     * @param value An amount that expresses the weighting (based on difficulty,
7027     *              cost and/or resource intensiveness) associated with the Contract
7028     *              Valued Item delivered. The concept of Points allows for
7029     *              assignment of point values for a Contract Valued Item, such that
7030     *              a monetary amount can be assigned to each point.
7031     */
7032    public ValuedItemComponent setPoints(BigDecimal value) {
7033      if (value == null)
7034        this.points = null;
7035      else {
7036        if (this.points == null)
7037          this.points = new DecimalType();
7038        this.points.setValue(value);
7039      }
7040      return this;
7041    }
7042
7043    /**
7044     * @param value An amount that expresses the weighting (based on difficulty,
7045     *              cost and/or resource intensiveness) associated with the Contract
7046     *              Valued Item delivered. The concept of Points allows for
7047     *              assignment of point values for a Contract Valued Item, such that
7048     *              a monetary amount can be assigned to each point.
7049     */
7050    public ValuedItemComponent setPoints(long value) {
7051      this.points = new DecimalType();
7052      this.points.setValue(value);
7053      return this;
7054    }
7055
7056    /**
7057     * @param value An amount that expresses the weighting (based on difficulty,
7058     *              cost and/or resource intensiveness) associated with the Contract
7059     *              Valued Item delivered. The concept of Points allows for
7060     *              assignment of point values for a Contract Valued Item, such that
7061     *              a monetary amount can be assigned to each point.
7062     */
7063    public ValuedItemComponent setPoints(double value) {
7064      this.points = new DecimalType();
7065      this.points.setValue(value);
7066      return this;
7067    }
7068
7069    /**
7070     * @return {@link #net} (Expresses the product of the Contract Valued Item
7071     *         unitQuantity and the unitPriceAmt. For example, the formula: unit
7072     *         Quantity * unit Price (Cost per Point) * factor Number * points = net
7073     *         Amount. Quantity, factor and points are assumed to be 1 if not
7074     *         supplied.)
7075     */
7076    public Money getNet() {
7077      if (this.net == null)
7078        if (Configuration.errorOnAutoCreate())
7079          throw new Error("Attempt to auto-create ValuedItemComponent.net");
7080        else if (Configuration.doAutoCreate())
7081          this.net = new Money(); // cc
7082      return this.net;
7083    }
7084
7085    public boolean hasNet() {
7086      return this.net != null && !this.net.isEmpty();
7087    }
7088
7089    /**
7090     * @param value {@link #net} (Expresses the product of the Contract Valued Item
7091     *              unitQuantity and the unitPriceAmt. For example, the formula:
7092     *              unit Quantity * unit Price (Cost per Point) * factor Number *
7093     *              points = net Amount. Quantity, factor and points are assumed to
7094     *              be 1 if not supplied.)
7095     */
7096    public ValuedItemComponent setNet(Money value) {
7097      this.net = value;
7098      return this;
7099    }
7100
7101    /**
7102     * @return {@link #payment} (Terms of valuation.). This is the underlying object
7103     *         with id, value and extensions. The accessor "getPayment" gives direct
7104     *         access to the value
7105     */
7106    public StringType getPaymentElement() {
7107      if (this.payment == null)
7108        if (Configuration.errorOnAutoCreate())
7109          throw new Error("Attempt to auto-create ValuedItemComponent.payment");
7110        else if (Configuration.doAutoCreate())
7111          this.payment = new StringType(); // bb
7112      return this.payment;
7113    }
7114
7115    public boolean hasPaymentElement() {
7116      return this.payment != null && !this.payment.isEmpty();
7117    }
7118
7119    public boolean hasPayment() {
7120      return this.payment != null && !this.payment.isEmpty();
7121    }
7122
7123    /**
7124     * @param value {@link #payment} (Terms of valuation.). This is the underlying
7125     *              object with id, value and extensions. The accessor "getPayment"
7126     *              gives direct access to the value
7127     */
7128    public ValuedItemComponent setPaymentElement(StringType value) {
7129      this.payment = value;
7130      return this;
7131    }
7132
7133    /**
7134     * @return Terms of valuation.
7135     */
7136    public String getPayment() {
7137      return this.payment == null ? null : this.payment.getValue();
7138    }
7139
7140    /**
7141     * @param value Terms of valuation.
7142     */
7143    public ValuedItemComponent setPayment(String value) {
7144      if (Utilities.noString(value))
7145        this.payment = null;
7146      else {
7147        if (this.payment == null)
7148          this.payment = new StringType();
7149        this.payment.setValue(value);
7150      }
7151      return this;
7152    }
7153
7154    /**
7155     * @return {@link #paymentDate} (When payment is due.). This is the underlying
7156     *         object with id, value and extensions. The accessor "getPaymentDate"
7157     *         gives direct access to the value
7158     */
7159    public DateTimeType getPaymentDateElement() {
7160      if (this.paymentDate == null)
7161        if (Configuration.errorOnAutoCreate())
7162          throw new Error("Attempt to auto-create ValuedItemComponent.paymentDate");
7163        else if (Configuration.doAutoCreate())
7164          this.paymentDate = new DateTimeType(); // bb
7165      return this.paymentDate;
7166    }
7167
7168    public boolean hasPaymentDateElement() {
7169      return this.paymentDate != null && !this.paymentDate.isEmpty();
7170    }
7171
7172    public boolean hasPaymentDate() {
7173      return this.paymentDate != null && !this.paymentDate.isEmpty();
7174    }
7175
7176    /**
7177     * @param value {@link #paymentDate} (When payment is due.). This is the
7178     *              underlying object with id, value and extensions. The accessor
7179     *              "getPaymentDate" gives direct access to the value
7180     */
7181    public ValuedItemComponent setPaymentDateElement(DateTimeType value) {
7182      this.paymentDate = value;
7183      return this;
7184    }
7185
7186    /**
7187     * @return When payment is due.
7188     */
7189    public Date getPaymentDate() {
7190      return this.paymentDate == null ? null : this.paymentDate.getValue();
7191    }
7192
7193    /**
7194     * @param value When payment is due.
7195     */
7196    public ValuedItemComponent setPaymentDate(Date value) {
7197      if (value == null)
7198        this.paymentDate = null;
7199      else {
7200        if (this.paymentDate == null)
7201          this.paymentDate = new DateTimeType();
7202        this.paymentDate.setValue(value);
7203      }
7204      return this;
7205    }
7206
7207    /**
7208     * @return {@link #responsible} (Who will make payment.)
7209     */
7210    public Reference getResponsible() {
7211      if (this.responsible == null)
7212        if (Configuration.errorOnAutoCreate())
7213          throw new Error("Attempt to auto-create ValuedItemComponent.responsible");
7214        else if (Configuration.doAutoCreate())
7215          this.responsible = new Reference(); // cc
7216      return this.responsible;
7217    }
7218
7219    public boolean hasResponsible() {
7220      return this.responsible != null && !this.responsible.isEmpty();
7221    }
7222
7223    /**
7224     * @param value {@link #responsible} (Who will make payment.)
7225     */
7226    public ValuedItemComponent setResponsible(Reference value) {
7227      this.responsible = value;
7228      return this;
7229    }
7230
7231    /**
7232     * @return {@link #responsible} The actual object that is the target of the
7233     *         reference. The reference library doesn't populate this, but you can
7234     *         use it to hold the resource if you resolve it. (Who will make
7235     *         payment.)
7236     */
7237    public Resource getResponsibleTarget() {
7238      return this.responsibleTarget;
7239    }
7240
7241    /**
7242     * @param value {@link #responsible} The actual object that is the target of the
7243     *              reference. The reference library doesn't use these, but you can
7244     *              use it to hold the resource if you resolve it. (Who will make
7245     *              payment.)
7246     */
7247    public ValuedItemComponent setResponsibleTarget(Resource value) {
7248      this.responsibleTarget = value;
7249      return this;
7250    }
7251
7252    /**
7253     * @return {@link #recipient} (Who will receive payment.)
7254     */
7255    public Reference getRecipient() {
7256      if (this.recipient == null)
7257        if (Configuration.errorOnAutoCreate())
7258          throw new Error("Attempt to auto-create ValuedItemComponent.recipient");
7259        else if (Configuration.doAutoCreate())
7260          this.recipient = new Reference(); // cc
7261      return this.recipient;
7262    }
7263
7264    public boolean hasRecipient() {
7265      return this.recipient != null && !this.recipient.isEmpty();
7266    }
7267
7268    /**
7269     * @param value {@link #recipient} (Who will receive payment.)
7270     */
7271    public ValuedItemComponent setRecipient(Reference value) {
7272      this.recipient = value;
7273      return this;
7274    }
7275
7276    /**
7277     * @return {@link #recipient} The actual object that is the target of the
7278     *         reference. The reference library doesn't populate this, but you can
7279     *         use it to hold the resource if you resolve it. (Who will receive
7280     *         payment.)
7281     */
7282    public Resource getRecipientTarget() {
7283      return this.recipientTarget;
7284    }
7285
7286    /**
7287     * @param value {@link #recipient} The actual object that is the target of the
7288     *              reference. The reference library doesn't use these, but you can
7289     *              use it to hold the resource if you resolve it. (Who will receive
7290     *              payment.)
7291     */
7292    public ValuedItemComponent setRecipientTarget(Resource value) {
7293      this.recipientTarget = value;
7294      return this;
7295    }
7296
7297    /**
7298     * @return {@link #linkId} (Id of the clause or question text related to the
7299     *         context of this valuedItem in the referenced form or
7300     *         QuestionnaireResponse.)
7301     */
7302    public List<StringType> getLinkId() {
7303      if (this.linkId == null)
7304        this.linkId = new ArrayList<StringType>();
7305      return this.linkId;
7306    }
7307
7308    /**
7309     * @return Returns a reference to <code>this</code> for easy method chaining
7310     */
7311    public ValuedItemComponent setLinkId(List<StringType> theLinkId) {
7312      this.linkId = theLinkId;
7313      return this;
7314    }
7315
7316    public boolean hasLinkId() {
7317      if (this.linkId == null)
7318        return false;
7319      for (StringType item : this.linkId)
7320        if (!item.isEmpty())
7321          return true;
7322      return false;
7323    }
7324
7325    /**
7326     * @return {@link #linkId} (Id of the clause or question text related to the
7327     *         context of this valuedItem in the referenced form or
7328     *         QuestionnaireResponse.)
7329     */
7330    public StringType addLinkIdElement() {// 2
7331      StringType t = new StringType();
7332      if (this.linkId == null)
7333        this.linkId = new ArrayList<StringType>();
7334      this.linkId.add(t);
7335      return t;
7336    }
7337
7338    /**
7339     * @param value {@link #linkId} (Id of the clause or question text related to
7340     *              the context of this valuedItem in the referenced form or
7341     *              QuestionnaireResponse.)
7342     */
7343    public ValuedItemComponent addLinkId(String value) { // 1
7344      StringType t = new StringType();
7345      t.setValue(value);
7346      if (this.linkId == null)
7347        this.linkId = new ArrayList<StringType>();
7348      this.linkId.add(t);
7349      return this;
7350    }
7351
7352    /**
7353     * @param value {@link #linkId} (Id of the clause or question text related to
7354     *              the context of this valuedItem in the referenced form or
7355     *              QuestionnaireResponse.)
7356     */
7357    public boolean hasLinkId(String value) {
7358      if (this.linkId == null)
7359        return false;
7360      for (StringType v : this.linkId)
7361        if (v.getValue().equals(value)) // string
7362          return true;
7363      return false;
7364    }
7365
7366    /**
7367     * @return {@link #securityLabelNumber} (A set of security labels that define
7368     *         which terms are controlled by this condition.)
7369     */
7370    public List<UnsignedIntType> getSecurityLabelNumber() {
7371      if (this.securityLabelNumber == null)
7372        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7373      return this.securityLabelNumber;
7374    }
7375
7376    /**
7377     * @return Returns a reference to <code>this</code> for easy method chaining
7378     */
7379    public ValuedItemComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
7380      this.securityLabelNumber = theSecurityLabelNumber;
7381      return this;
7382    }
7383
7384    public boolean hasSecurityLabelNumber() {
7385      if (this.securityLabelNumber == null)
7386        return false;
7387      for (UnsignedIntType item : this.securityLabelNumber)
7388        if (!item.isEmpty())
7389          return true;
7390      return false;
7391    }
7392
7393    /**
7394     * @return {@link #securityLabelNumber} (A set of security labels that define
7395     *         which terms are controlled by this condition.)
7396     */
7397    public UnsignedIntType addSecurityLabelNumberElement() {// 2
7398      UnsignedIntType t = new UnsignedIntType();
7399      if (this.securityLabelNumber == null)
7400        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7401      this.securityLabelNumber.add(t);
7402      return t;
7403    }
7404
7405    /**
7406     * @param value {@link #securityLabelNumber} (A set of security labels that
7407     *              define which terms are controlled by this condition.)
7408     */
7409    public ValuedItemComponent addSecurityLabelNumber(int value) { // 1
7410      UnsignedIntType t = new UnsignedIntType();
7411      t.setValue(value);
7412      if (this.securityLabelNumber == null)
7413        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7414      this.securityLabelNumber.add(t);
7415      return this;
7416    }
7417
7418    /**
7419     * @param value {@link #securityLabelNumber} (A set of security labels that
7420     *              define which terms are controlled by this condition.)
7421     */
7422    public boolean hasSecurityLabelNumber(int value) {
7423      if (this.securityLabelNumber == null)
7424        return false;
7425      for (UnsignedIntType v : this.securityLabelNumber)
7426        if (v.getValue().equals(value)) // unsignedInt
7427          return true;
7428      return false;
7429    }
7430
7431    protected void listChildren(List<Property> children) {
7432      super.listChildren(children);
7433      children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)",
7434          "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
7435      children.add(
7436          new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
7437      children.add(new Property("effectiveTime", "dateTime",
7438          "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
7439      children.add(new Property("quantity", "SimpleQuantity",
7440          "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.",
7441          0, 1, quantity));
7442      children
7443          .add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
7444      children.add(new Property("factor", "decimal",
7445          "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.",
7446          0, 1, factor));
7447      children.add(new Property("points", "decimal",
7448          "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.",
7449          0, 1, points));
7450      children.add(new Property("net", "Money",
7451          "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.",
7452          0, 1, net));
7453      children.add(new Property("payment", "string", "Terms of valuation.", 0, 1, payment));
7454      children.add(new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate));
7455      children.add(
7456          new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
7457              "Who will make payment.", 0, 1, responsible));
7458      children
7459          .add(new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
7460              "Who will receive payment.", 0, 1, recipient));
7461      children.add(new Property("linkId", "string",
7462          "Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.",
7463          0, java.lang.Integer.MAX_VALUE, linkId));
7464      children.add(new Property("securityLabelNumber", "unsignedInt",
7465          "A set of security labels that define which terms are controlled by this condition.", 0,
7466          java.lang.Integer.MAX_VALUE, securityLabelNumber));
7467    }
7468
7469    @Override
7470    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7471      switch (_hash) {
7472      case -740568643:
7473        /* entity[x] */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7474            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7475      case -1298275357:
7476        /* entity */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7477            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7478      case 924197182:
7479        /* entityCodeableConcept */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7480            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7481      case -356635992:
7482        /* entityReference */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7483            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7484      case -1618432855:
7485        /* identifier */ return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.",
7486            0, 1, identifier);
7487      case -929905388:
7488        /* effectiveTime */ return new Property("effectiveTime", "dateTime",
7489            "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
7490      case -1285004149:
7491        /* quantity */ return new Property("quantity", "SimpleQuantity",
7492            "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.",
7493            0, 1, quantity);
7494      case -486196699:
7495        /* unitPrice */ return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0,
7496            1, unitPrice);
7497      case -1282148017:
7498        /* factor */ return new Property("factor", "decimal",
7499            "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.",
7500            0, 1, factor);
7501      case -982754077:
7502        /* points */ return new Property("points", "decimal",
7503            "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.",
7504            0, 1, points);
7505      case 108957:
7506        /* net */ return new Property("net", "Money",
7507            "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.",
7508            0, 1, net);
7509      case -786681338:
7510        /* payment */ return new Property("payment", "string", "Terms of valuation.", 0, 1, payment);
7511      case -1540873516:
7512        /* paymentDate */ return new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate);
7513      case 1847674614:
7514        /* responsible */ return new Property("responsible",
7515            "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0,
7516            1, responsible);
7517      case 820081177:
7518        /* recipient */ return new Property("recipient",
7519            "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.",
7520            0, 1, recipient);
7521      case -1102667083:
7522        /* linkId */ return new Property("linkId", "string",
7523            "Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.",
7524            0, java.lang.Integer.MAX_VALUE, linkId);
7525      case -149460995:
7526        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
7527            "A set of security labels that define which terms are controlled by this condition.", 0,
7528            java.lang.Integer.MAX_VALUE, securityLabelNumber);
7529      default:
7530        return super.getNamedProperty(_hash, _name, _checkValid);
7531      }
7532
7533    }
7534
7535    @Override
7536    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7537      switch (hash) {
7538      case -1298275357:
7539        /* entity */ return this.entity == null ? new Base[0] : new Base[] { this.entity }; // Type
7540      case -1618432855:
7541        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
7542      case -929905388:
7543        /* effectiveTime */ return this.effectiveTime == null ? new Base[0] : new Base[] { this.effectiveTime }; // DateTimeType
7544      case -1285004149:
7545        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
7546      case -486196699:
7547        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
7548      case -1282148017:
7549        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
7550      case -982754077:
7551        /* points */ return this.points == null ? new Base[0] : new Base[] { this.points }; // DecimalType
7552      case 108957:
7553        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
7554      case -786681338:
7555        /* payment */ return this.payment == null ? new Base[0] : new Base[] { this.payment }; // StringType
7556      case -1540873516:
7557        /* paymentDate */ return this.paymentDate == null ? new Base[0] : new Base[] { this.paymentDate }; // DateTimeType
7558      case 1847674614:
7559        /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // Reference
7560      case 820081177:
7561        /* recipient */ return this.recipient == null ? new Base[0] : new Base[] { this.recipient }; // Reference
7562      case -1102667083:
7563        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
7564      case -149460995:
7565        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
7566            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
7567      default:
7568        return super.getProperty(hash, name, checkValid);
7569      }
7570
7571    }
7572
7573    @Override
7574    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7575      switch (hash) {
7576      case -1298275357: // entity
7577        this.entity = castToType(value); // Type
7578        return value;
7579      case -1618432855: // identifier
7580        this.identifier = castToIdentifier(value); // Identifier
7581        return value;
7582      case -929905388: // effectiveTime
7583        this.effectiveTime = castToDateTime(value); // DateTimeType
7584        return value;
7585      case -1285004149: // quantity
7586        this.quantity = castToQuantity(value); // Quantity
7587        return value;
7588      case -486196699: // unitPrice
7589        this.unitPrice = castToMoney(value); // Money
7590        return value;
7591      case -1282148017: // factor
7592        this.factor = castToDecimal(value); // DecimalType
7593        return value;
7594      case -982754077: // points
7595        this.points = castToDecimal(value); // DecimalType
7596        return value;
7597      case 108957: // net
7598        this.net = castToMoney(value); // Money
7599        return value;
7600      case -786681338: // payment
7601        this.payment = castToString(value); // StringType
7602        return value;
7603      case -1540873516: // paymentDate
7604        this.paymentDate = castToDateTime(value); // DateTimeType
7605        return value;
7606      case 1847674614: // responsible
7607        this.responsible = castToReference(value); // Reference
7608        return value;
7609      case 820081177: // recipient
7610        this.recipient = castToReference(value); // Reference
7611        return value;
7612      case -1102667083: // linkId
7613        this.getLinkId().add(castToString(value)); // StringType
7614        return value;
7615      case -149460995: // securityLabelNumber
7616        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
7617        return value;
7618      default:
7619        return super.setProperty(hash, name, value);
7620      }
7621
7622    }
7623
7624    @Override
7625    public Base setProperty(String name, Base value) throws FHIRException {
7626      if (name.equals("entity[x]")) {
7627        this.entity = castToType(value); // Type
7628      } else if (name.equals("identifier")) {
7629        this.identifier = castToIdentifier(value); // Identifier
7630      } else if (name.equals("effectiveTime")) {
7631        this.effectiveTime = castToDateTime(value); // DateTimeType
7632      } else if (name.equals("quantity")) {
7633        this.quantity = castToQuantity(value); // Quantity
7634      } else if (name.equals("unitPrice")) {
7635        this.unitPrice = castToMoney(value); // Money
7636      } else if (name.equals("factor")) {
7637        this.factor = castToDecimal(value); // DecimalType
7638      } else if (name.equals("points")) {
7639        this.points = castToDecimal(value); // DecimalType
7640      } else if (name.equals("net")) {
7641        this.net = castToMoney(value); // Money
7642      } else if (name.equals("payment")) {
7643        this.payment = castToString(value); // StringType
7644      } else if (name.equals("paymentDate")) {
7645        this.paymentDate = castToDateTime(value); // DateTimeType
7646      } else if (name.equals("responsible")) {
7647        this.responsible = castToReference(value); // Reference
7648      } else if (name.equals("recipient")) {
7649        this.recipient = castToReference(value); // Reference
7650      } else if (name.equals("linkId")) {
7651        this.getLinkId().add(castToString(value));
7652      } else if (name.equals("securityLabelNumber")) {
7653        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
7654      } else
7655        return super.setProperty(name, value);
7656      return value;
7657    }
7658
7659    @Override
7660    public Base makeProperty(int hash, String name) throws FHIRException {
7661      switch (hash) {
7662      case -740568643:
7663        return getEntity();
7664      case -1298275357:
7665        return getEntity();
7666      case -1618432855:
7667        return getIdentifier();
7668      case -929905388:
7669        return getEffectiveTimeElement();
7670      case -1285004149:
7671        return getQuantity();
7672      case -486196699:
7673        return getUnitPrice();
7674      case -1282148017:
7675        return getFactorElement();
7676      case -982754077:
7677        return getPointsElement();
7678      case 108957:
7679        return getNet();
7680      case -786681338:
7681        return getPaymentElement();
7682      case -1540873516:
7683        return getPaymentDateElement();
7684      case 1847674614:
7685        return getResponsible();
7686      case 820081177:
7687        return getRecipient();
7688      case -1102667083:
7689        return addLinkIdElement();
7690      case -149460995:
7691        return addSecurityLabelNumberElement();
7692      default:
7693        return super.makeProperty(hash, name);
7694      }
7695
7696    }
7697
7698    @Override
7699    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7700      switch (hash) {
7701      case -1298275357:
7702        /* entity */ return new String[] { "CodeableConcept", "Reference" };
7703      case -1618432855:
7704        /* identifier */ return new String[] { "Identifier" };
7705      case -929905388:
7706        /* effectiveTime */ return new String[] { "dateTime" };
7707      case -1285004149:
7708        /* quantity */ return new String[] { "SimpleQuantity" };
7709      case -486196699:
7710        /* unitPrice */ return new String[] { "Money" };
7711      case -1282148017:
7712        /* factor */ return new String[] { "decimal" };
7713      case -982754077:
7714        /* points */ return new String[] { "decimal" };
7715      case 108957:
7716        /* net */ return new String[] { "Money" };
7717      case -786681338:
7718        /* payment */ return new String[] { "string" };
7719      case -1540873516:
7720        /* paymentDate */ return new String[] { "dateTime" };
7721      case 1847674614:
7722        /* responsible */ return new String[] { "Reference" };
7723      case 820081177:
7724        /* recipient */ return new String[] { "Reference" };
7725      case -1102667083:
7726        /* linkId */ return new String[] { "string" };
7727      case -149460995:
7728        /* securityLabelNumber */ return new String[] { "unsignedInt" };
7729      default:
7730        return super.getTypesForProperty(hash, name);
7731      }
7732
7733    }
7734
7735    @Override
7736    public Base addChild(String name) throws FHIRException {
7737      if (name.equals("entityCodeableConcept")) {
7738        this.entity = new CodeableConcept();
7739        return this.entity;
7740      } else if (name.equals("entityReference")) {
7741        this.entity = new Reference();
7742        return this.entity;
7743      } else if (name.equals("identifier")) {
7744        this.identifier = new Identifier();
7745        return this.identifier;
7746      } else if (name.equals("effectiveTime")) {
7747        throw new FHIRException("Cannot call addChild on a singleton property Contract.effectiveTime");
7748      } else if (name.equals("quantity")) {
7749        this.quantity = new Quantity();
7750        return this.quantity;
7751      } else if (name.equals("unitPrice")) {
7752        this.unitPrice = new Money();
7753        return this.unitPrice;
7754      } else if (name.equals("factor")) {
7755        throw new FHIRException("Cannot call addChild on a singleton property Contract.factor");
7756      } else if (name.equals("points")) {
7757        throw new FHIRException("Cannot call addChild on a singleton property Contract.points");
7758      } else if (name.equals("net")) {
7759        this.net = new Money();
7760        return this.net;
7761      } else if (name.equals("payment")) {
7762        throw new FHIRException("Cannot call addChild on a singleton property Contract.payment");
7763      } else if (name.equals("paymentDate")) {
7764        throw new FHIRException("Cannot call addChild on a singleton property Contract.paymentDate");
7765      } else if (name.equals("responsible")) {
7766        this.responsible = new Reference();
7767        return this.responsible;
7768      } else if (name.equals("recipient")) {
7769        this.recipient = new Reference();
7770        return this.recipient;
7771      } else if (name.equals("linkId")) {
7772        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
7773      } else if (name.equals("securityLabelNumber")) {
7774        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
7775      } else
7776        return super.addChild(name);
7777    }
7778
7779    public ValuedItemComponent copy() {
7780      ValuedItemComponent dst = new ValuedItemComponent();
7781      copyValues(dst);
7782      return dst;
7783    }
7784
7785    public void copyValues(ValuedItemComponent dst) {
7786      super.copyValues(dst);
7787      dst.entity = entity == null ? null : entity.copy();
7788      dst.identifier = identifier == null ? null : identifier.copy();
7789      dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
7790      dst.quantity = quantity == null ? null : quantity.copy();
7791      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7792      dst.factor = factor == null ? null : factor.copy();
7793      dst.points = points == null ? null : points.copy();
7794      dst.net = net == null ? null : net.copy();
7795      dst.payment = payment == null ? null : payment.copy();
7796      dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
7797      dst.responsible = responsible == null ? null : responsible.copy();
7798      dst.recipient = recipient == null ? null : recipient.copy();
7799      if (linkId != null) {
7800        dst.linkId = new ArrayList<StringType>();
7801        for (StringType i : linkId)
7802          dst.linkId.add(i.copy());
7803      }
7804      ;
7805      if (securityLabelNumber != null) {
7806        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
7807        for (UnsignedIntType i : securityLabelNumber)
7808          dst.securityLabelNumber.add(i.copy());
7809      }
7810      ;
7811    }
7812
7813    @Override
7814    public boolean equalsDeep(Base other_) {
7815      if (!super.equalsDeep(other_))
7816        return false;
7817      if (!(other_ instanceof ValuedItemComponent))
7818        return false;
7819      ValuedItemComponent o = (ValuedItemComponent) other_;
7820      return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true)
7821          && compareDeep(effectiveTime, o.effectiveTime, true) && compareDeep(quantity, o.quantity, true)
7822          && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
7823          && compareDeep(points, o.points, true) && compareDeep(net, o.net, true)
7824          && compareDeep(payment, o.payment, true) && compareDeep(paymentDate, o.paymentDate, true)
7825          && compareDeep(responsible, o.responsible, true) && compareDeep(recipient, o.recipient, true)
7826          && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
7827    }
7828
7829    @Override
7830    public boolean equalsShallow(Base other_) {
7831      if (!super.equalsShallow(other_))
7832        return false;
7833      if (!(other_ instanceof ValuedItemComponent))
7834        return false;
7835      ValuedItemComponent o = (ValuedItemComponent) other_;
7836      return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
7837          && compareValues(points, o.points, true) && compareValues(payment, o.payment, true)
7838          && compareValues(paymentDate, o.paymentDate, true) && compareValues(linkId, o.linkId, true)
7839          && compareValues(securityLabelNumber, o.securityLabelNumber, true);
7840    }
7841
7842    public boolean isEmpty() {
7843      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime, quantity,
7844          unitPrice, factor, points, net, payment, paymentDate, responsible, recipient, linkId, securityLabelNumber);
7845    }
7846
7847    public String fhirType() {
7848      return "Contract.term.asset.valuedItem";
7849
7850    }
7851
7852  }
7853
7854  @Block()
7855  public static class ActionComponent extends BackboneElement implements IBaseBackboneElement {
7856    /**
7857     * True if the term prohibits the action.
7858     */
7859    @Child(name = "doNotPerform", type = {
7860        BooleanType.class }, order = 1, min = 0, max = 1, modifier = true, summary = false)
7861    @Description(shortDefinition = "True if the term prohibits the  action", formalDefinition = "True if the term prohibits the  action.")
7862    protected BooleanType doNotPerform;
7863
7864    /**
7865     * Activity or service obligation to be done or not done, performed or not
7866     * performed, effectuated or not by this Contract term.
7867     */
7868    @Child(name = "type", type = {
7869        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
7870    @Description(shortDefinition = "Type or form of the action", formalDefinition = "Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.")
7871    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-action")
7872    protected CodeableConcept type;
7873
7874    /**
7875     * Entity of the action.
7876     */
7877    @Child(name = "subject", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7878    @Description(shortDefinition = "Entity of the action", formalDefinition = "Entity of the action.")
7879    protected List<ActionSubjectComponent> subject;
7880
7881    /**
7882     * Reason or purpose for the action stipulated by this Contract Provision.
7883     */
7884    @Child(name = "intent", type = {
7885        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
7886    @Description(shortDefinition = "Purpose for the Contract Term Action", formalDefinition = "Reason or purpose for the action stipulated by this Contract Provision.")
7887    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
7888    protected CodeableConcept intent;
7889
7890    /**
7891     * Id [identifier??] of the clause or question text related to this action in
7892     * the referenced form or QuestionnaireResponse.
7893     */
7894    @Child(name = "linkId", type = {
7895        StringType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7896    @Description(shortDefinition = "Pointer to specific item", formalDefinition = "Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.")
7897    protected List<StringType> linkId;
7898
7899    /**
7900     * Current state of the term action.
7901     */
7902    @Child(name = "status", type = {
7903        CodeableConcept.class }, order = 6, min = 1, max = 1, modifier = false, summary = false)
7904    @Description(shortDefinition = "State of the action", formalDefinition = "Current state of the term action.")
7905    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-actionstatus")
7906    protected CodeableConcept status;
7907
7908    /**
7909     * Encounter or Episode with primary association to specified term activity.
7910     */
7911    @Child(name = "context", type = { Encounter.class,
7912        EpisodeOfCare.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
7913    @Description(shortDefinition = "Episode associated with action", formalDefinition = "Encounter or Episode with primary association to specified term activity.")
7914    protected Reference context;
7915
7916    /**
7917     * The actual object that is the target of the reference (Encounter or Episode
7918     * with primary association to specified term activity.)
7919     */
7920    protected Resource contextTarget;
7921
7922    /**
7923     * Id [identifier??] of the clause or question text related to the requester of
7924     * this action in the referenced form or QuestionnaireResponse.
7925     */
7926    @Child(name = "contextLinkId", type = {
7927        StringType.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7928    @Description(shortDefinition = "Pointer to specific item", formalDefinition = "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.")
7929    protected List<StringType> contextLinkId;
7930
7931    /**
7932     * When action happens.
7933     */
7934    @Child(name = "occurrence", type = { DateTimeType.class, Period.class,
7935        Timing.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
7936    @Description(shortDefinition = "When action happens", formalDefinition = "When action happens.")
7937    protected Type occurrence;
7938
7939    /**
7940     * Who or what initiated the action and has responsibility for its activation.
7941     */
7942    @Child(name = "requester", type = { Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class,
7943        Device.class, Group.class,
7944        Organization.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7945    @Description(shortDefinition = "Who asked for action", formalDefinition = "Who or what initiated the action and has responsibility for its activation.")
7946    protected List<Reference> requester;
7947    /**
7948     * The actual objects that are the target of the reference (Who or what
7949     * initiated the action and has responsibility for its activation.)
7950     */
7951    protected List<Resource> requesterTarget;
7952
7953    /**
7954     * Id [identifier??] of the clause or question text related to the requester of
7955     * this action in the referenced form or QuestionnaireResponse.
7956     */
7957    @Child(name = "requesterLinkId", type = {
7958        StringType.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7959    @Description(shortDefinition = "Pointer to specific item", formalDefinition = "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.")
7960    protected List<StringType> requesterLinkId;
7961
7962    /**
7963     * The type of individual that is desired or required to perform or not perform
7964     * the action.
7965     */
7966    @Child(name = "performerType", type = {
7967        CodeableConcept.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7968    @Description(shortDefinition = "Kind of service performer", formalDefinition = "The type of individual that is desired or required to perform or not perform the action.")
7969    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provenance-agent-type")
7970    protected List<CodeableConcept> performerType;
7971
7972    /**
7973     * The type of role or competency of an individual desired or required to
7974     * perform or not perform the action.
7975     */
7976    @Child(name = "performerRole", type = {
7977        CodeableConcept.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
7978    @Description(shortDefinition = "Competency of the performer", formalDefinition = "The type of role or competency of an individual desired or required to perform or not perform the action.")
7979    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provenance-agent-role")
7980    protected CodeableConcept performerRole;
7981
7982    /**
7983     * Indicates who or what is being asked to perform (or not perform) the ction.
7984     */
7985    @Child(name = "performer", type = { RelatedPerson.class, Patient.class, Practitioner.class, PractitionerRole.class,
7986        CareTeam.class, Device.class, Substance.class, Organization.class,
7987        Location.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
7988    @Description(shortDefinition = "Actor that wil execute (or not) the action", formalDefinition = "Indicates who or what is being asked to perform (or not perform) the ction.")
7989    protected Reference performer;
7990
7991    /**
7992     * The actual object that is the target of the reference (Indicates who or what
7993     * is being asked to perform (or not perform) the ction.)
7994     */
7995    protected Resource performerTarget;
7996
7997    /**
7998     * Id [identifier??] of the clause or question text related to the reason type
7999     * or reference of this action in the referenced form or QuestionnaireResponse.
8000     */
8001    @Child(name = "performerLinkId", type = {
8002        StringType.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8003    @Description(shortDefinition = "Pointer to specific item", formalDefinition = "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.")
8004    protected List<StringType> performerLinkId;
8005
8006    /**
8007     * Rationale for the action to be performed or not performed. Describes why the
8008     * action is permitted or prohibited.
8009     */
8010    @Child(name = "reasonCode", type = {
8011        CodeableConcept.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8012    @Description(shortDefinition = "Why is action (not) needed?", formalDefinition = "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.")
8013    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
8014    protected List<CodeableConcept> reasonCode;
8015
8016    /**
8017     * Indicates another resource whose existence justifies permitting or not
8018     * permitting this action.
8019     */
8020    @Child(name = "reasonReference", type = { Condition.class, Observation.class, DiagnosticReport.class,
8021        DocumentReference.class, Questionnaire.class,
8022        QuestionnaireResponse.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8023    @Description(shortDefinition = "Why is action (not) needed?", formalDefinition = "Indicates another resource whose existence justifies permitting or not permitting this action.")
8024    protected List<Reference> reasonReference;
8025    /**
8026     * The actual objects that are the target of the reference (Indicates another
8027     * resource whose existence justifies permitting or not permitting this action.)
8028     */
8029    protected List<Resource> reasonReferenceTarget;
8030
8031    /**
8032     * Describes why the action is to be performed or not performed in textual form.
8033     */
8034    @Child(name = "reason", type = {
8035        StringType.class }, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8036    @Description(shortDefinition = "Why action is to be performed", formalDefinition = "Describes why the action is to be performed or not performed in textual form.")
8037    protected List<StringType> reason;
8038
8039    /**
8040     * Id [identifier??] of the clause or question text related to the reason type
8041     * or reference of this action in the referenced form or QuestionnaireResponse.
8042     */
8043    @Child(name = "reasonLinkId", type = {
8044        StringType.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8045    @Description(shortDefinition = "Pointer to specific item", formalDefinition = "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.")
8046    protected List<StringType> reasonLinkId;
8047
8048    /**
8049     * Comments made about the term action made by the requester, performer, subject
8050     * or other participants.
8051     */
8052    @Child(name = "note", type = {
8053        Annotation.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8054    @Description(shortDefinition = "Comments about the action", formalDefinition = "Comments made about the term action made by the requester, performer, subject or other participants.")
8055    protected List<Annotation> note;
8056
8057    /**
8058     * Security labels that protects the action.
8059     */
8060    @Child(name = "securityLabelNumber", type = {
8061        UnsignedIntType.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8062    @Description(shortDefinition = "Action restriction numbers", formalDefinition = "Security labels that protects the action.")
8063    protected List<UnsignedIntType> securityLabelNumber;
8064
8065    private static final long serialVersionUID = -178728180L;
8066
8067    /**
8068     * Constructor
8069     */
8070    public ActionComponent() {
8071      super();
8072    }
8073
8074    /**
8075     * Constructor
8076     */
8077    public ActionComponent(CodeableConcept type, CodeableConcept intent, CodeableConcept status) {
8078      super();
8079      this.type = type;
8080      this.intent = intent;
8081      this.status = status;
8082    }
8083
8084    /**
8085     * @return {@link #doNotPerform} (True if the term prohibits the action.). This
8086     *         is the underlying object with id, value and extensions. The accessor
8087     *         "getDoNotPerform" gives direct access to the value
8088     */
8089    public BooleanType getDoNotPerformElement() {
8090      if (this.doNotPerform == null)
8091        if (Configuration.errorOnAutoCreate())
8092          throw new Error("Attempt to auto-create ActionComponent.doNotPerform");
8093        else if (Configuration.doAutoCreate())
8094          this.doNotPerform = new BooleanType(); // bb
8095      return this.doNotPerform;
8096    }
8097
8098    public boolean hasDoNotPerformElement() {
8099      return this.doNotPerform != null && !this.doNotPerform.isEmpty();
8100    }
8101
8102    public boolean hasDoNotPerform() {
8103      return this.doNotPerform != null && !this.doNotPerform.isEmpty();
8104    }
8105
8106    /**
8107     * @param value {@link #doNotPerform} (True if the term prohibits the action.).
8108     *              This is the underlying object with id, value and extensions. The
8109     *              accessor "getDoNotPerform" gives direct access to the value
8110     */
8111    public ActionComponent setDoNotPerformElement(BooleanType value) {
8112      this.doNotPerform = value;
8113      return this;
8114    }
8115
8116    /**
8117     * @return True if the term prohibits the action.
8118     */
8119    public boolean getDoNotPerform() {
8120      return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
8121    }
8122
8123    /**
8124     * @param value True if the term prohibits the action.
8125     */
8126    public ActionComponent setDoNotPerform(boolean value) {
8127      if (this.doNotPerform == null)
8128        this.doNotPerform = new BooleanType();
8129      this.doNotPerform.setValue(value);
8130      return this;
8131    }
8132
8133    /**
8134     * @return {@link #type} (Activity or service obligation to be done or not done,
8135     *         performed or not performed, effectuated or not by this Contract
8136     *         term.)
8137     */
8138    public CodeableConcept getType() {
8139      if (this.type == null)
8140        if (Configuration.errorOnAutoCreate())
8141          throw new Error("Attempt to auto-create ActionComponent.type");
8142        else if (Configuration.doAutoCreate())
8143          this.type = new CodeableConcept(); // cc
8144      return this.type;
8145    }
8146
8147    public boolean hasType() {
8148      return this.type != null && !this.type.isEmpty();
8149    }
8150
8151    /**
8152     * @param value {@link #type} (Activity or service obligation to be done or not
8153     *              done, performed or not performed, effectuated or not by this
8154     *              Contract term.)
8155     */
8156    public ActionComponent setType(CodeableConcept value) {
8157      this.type = value;
8158      return this;
8159    }
8160
8161    /**
8162     * @return {@link #subject} (Entity of the action.)
8163     */
8164    public List<ActionSubjectComponent> getSubject() {
8165      if (this.subject == null)
8166        this.subject = new ArrayList<ActionSubjectComponent>();
8167      return this.subject;
8168    }
8169
8170    /**
8171     * @return Returns a reference to <code>this</code> for easy method chaining
8172     */
8173    public ActionComponent setSubject(List<ActionSubjectComponent> theSubject) {
8174      this.subject = theSubject;
8175      return this;
8176    }
8177
8178    public boolean hasSubject() {
8179      if (this.subject == null)
8180        return false;
8181      for (ActionSubjectComponent item : this.subject)
8182        if (!item.isEmpty())
8183          return true;
8184      return false;
8185    }
8186
8187    public ActionSubjectComponent addSubject() { // 3
8188      ActionSubjectComponent t = new ActionSubjectComponent();
8189      if (this.subject == null)
8190        this.subject = new ArrayList<ActionSubjectComponent>();
8191      this.subject.add(t);
8192      return t;
8193    }
8194
8195    public ActionComponent addSubject(ActionSubjectComponent t) { // 3
8196      if (t == null)
8197        return this;
8198      if (this.subject == null)
8199        this.subject = new ArrayList<ActionSubjectComponent>();
8200      this.subject.add(t);
8201      return this;
8202    }
8203
8204    /**
8205     * @return The first repetition of repeating field {@link #subject}, creating it
8206     *         if it does not already exist
8207     */
8208    public ActionSubjectComponent getSubjectFirstRep() {
8209      if (getSubject().isEmpty()) {
8210        addSubject();
8211      }
8212      return getSubject().get(0);
8213    }
8214
8215    /**
8216     * @return {@link #intent} (Reason or purpose for the action stipulated by this
8217     *         Contract Provision.)
8218     */
8219    public CodeableConcept getIntent() {
8220      if (this.intent == null)
8221        if (Configuration.errorOnAutoCreate())
8222          throw new Error("Attempt to auto-create ActionComponent.intent");
8223        else if (Configuration.doAutoCreate())
8224          this.intent = new CodeableConcept(); // cc
8225      return this.intent;
8226    }
8227
8228    public boolean hasIntent() {
8229      return this.intent != null && !this.intent.isEmpty();
8230    }
8231
8232    /**
8233     * @param value {@link #intent} (Reason or purpose for the action stipulated by
8234     *              this Contract Provision.)
8235     */
8236    public ActionComponent setIntent(CodeableConcept value) {
8237      this.intent = value;
8238      return this;
8239    }
8240
8241    /**
8242     * @return {@link #linkId} (Id [identifier??] of the clause or question text
8243     *         related to this action in the referenced form or
8244     *         QuestionnaireResponse.)
8245     */
8246    public List<StringType> getLinkId() {
8247      if (this.linkId == null)
8248        this.linkId = new ArrayList<StringType>();
8249      return this.linkId;
8250    }
8251
8252    /**
8253     * @return Returns a reference to <code>this</code> for easy method chaining
8254     */
8255    public ActionComponent setLinkId(List<StringType> theLinkId) {
8256      this.linkId = theLinkId;
8257      return this;
8258    }
8259
8260    public boolean hasLinkId() {
8261      if (this.linkId == null)
8262        return false;
8263      for (StringType item : this.linkId)
8264        if (!item.isEmpty())
8265          return true;
8266      return false;
8267    }
8268
8269    /**
8270     * @return {@link #linkId} (Id [identifier??] of the clause or question text
8271     *         related to this action in the referenced form or
8272     *         QuestionnaireResponse.)
8273     */
8274    public StringType addLinkIdElement() {// 2
8275      StringType t = new StringType();
8276      if (this.linkId == null)
8277        this.linkId = new ArrayList<StringType>();
8278      this.linkId.add(t);
8279      return t;
8280    }
8281
8282    /**
8283     * @param value {@link #linkId} (Id [identifier??] of the clause or question
8284     *              text related to this action in the referenced form or
8285     *              QuestionnaireResponse.)
8286     */
8287    public ActionComponent addLinkId(String value) { // 1
8288      StringType t = new StringType();
8289      t.setValue(value);
8290      if (this.linkId == null)
8291        this.linkId = new ArrayList<StringType>();
8292      this.linkId.add(t);
8293      return this;
8294    }
8295
8296    /**
8297     * @param value {@link #linkId} (Id [identifier??] of the clause or question
8298     *              text related to this action in the referenced form or
8299     *              QuestionnaireResponse.)
8300     */
8301    public boolean hasLinkId(String value) {
8302      if (this.linkId == null)
8303        return false;
8304      for (StringType v : this.linkId)
8305        if (v.getValue().equals(value)) // string
8306          return true;
8307      return false;
8308    }
8309
8310    /**
8311     * @return {@link #status} (Current state of the term action.)
8312     */
8313    public CodeableConcept getStatus() {
8314      if (this.status == null)
8315        if (Configuration.errorOnAutoCreate())
8316          throw new Error("Attempt to auto-create ActionComponent.status");
8317        else if (Configuration.doAutoCreate())
8318          this.status = new CodeableConcept(); // cc
8319      return this.status;
8320    }
8321
8322    public boolean hasStatus() {
8323      return this.status != null && !this.status.isEmpty();
8324    }
8325
8326    /**
8327     * @param value {@link #status} (Current state of the term action.)
8328     */
8329    public ActionComponent setStatus(CodeableConcept value) {
8330      this.status = value;
8331      return this;
8332    }
8333
8334    /**
8335     * @return {@link #context} (Encounter or Episode with primary association to
8336     *         specified term activity.)
8337     */
8338    public Reference getContext() {
8339      if (this.context == null)
8340        if (Configuration.errorOnAutoCreate())
8341          throw new Error("Attempt to auto-create ActionComponent.context");
8342        else if (Configuration.doAutoCreate())
8343          this.context = new Reference(); // cc
8344      return this.context;
8345    }
8346
8347    public boolean hasContext() {
8348      return this.context != null && !this.context.isEmpty();
8349    }
8350
8351    /**
8352     * @param value {@link #context} (Encounter or Episode with primary association
8353     *              to specified term activity.)
8354     */
8355    public ActionComponent setContext(Reference value) {
8356      this.context = value;
8357      return this;
8358    }
8359
8360    /**
8361     * @return {@link #context} The actual object that is the target of the
8362     *         reference. The reference library doesn't populate this, but you can
8363     *         use it to hold the resource if you resolve it. (Encounter or Episode
8364     *         with primary association to specified term activity.)
8365     */
8366    public Resource getContextTarget() {
8367      return this.contextTarget;
8368    }
8369
8370    /**
8371     * @param value {@link #context} The actual object that is the target of the
8372     *              reference. The reference library doesn't use these, but you can
8373     *              use it to hold the resource if you resolve it. (Encounter or
8374     *              Episode with primary association to specified term activity.)
8375     */
8376    public ActionComponent setContextTarget(Resource value) {
8377      this.contextTarget = value;
8378      return this;
8379    }
8380
8381    /**
8382     * @return {@link #contextLinkId} (Id [identifier??] of the clause or question
8383     *         text related to the requester of this action in the referenced form
8384     *         or QuestionnaireResponse.)
8385     */
8386    public List<StringType> getContextLinkId() {
8387      if (this.contextLinkId == null)
8388        this.contextLinkId = new ArrayList<StringType>();
8389      return this.contextLinkId;
8390    }
8391
8392    /**
8393     * @return Returns a reference to <code>this</code> for easy method chaining
8394     */
8395    public ActionComponent setContextLinkId(List<StringType> theContextLinkId) {
8396      this.contextLinkId = theContextLinkId;
8397      return this;
8398    }
8399
8400    public boolean hasContextLinkId() {
8401      if (this.contextLinkId == null)
8402        return false;
8403      for (StringType item : this.contextLinkId)
8404        if (!item.isEmpty())
8405          return true;
8406      return false;
8407    }
8408
8409    /**
8410     * @return {@link #contextLinkId} (Id [identifier??] of the clause or question
8411     *         text related to the requester of this action in the referenced form
8412     *         or QuestionnaireResponse.)
8413     */
8414    public StringType addContextLinkIdElement() {// 2
8415      StringType t = new StringType();
8416      if (this.contextLinkId == null)
8417        this.contextLinkId = new ArrayList<StringType>();
8418      this.contextLinkId.add(t);
8419      return t;
8420    }
8421
8422    /**
8423     * @param value {@link #contextLinkId} (Id [identifier??] of the clause or
8424     *              question text related to the requester of this action in the
8425     *              referenced form or QuestionnaireResponse.)
8426     */
8427    public ActionComponent addContextLinkId(String value) { // 1
8428      StringType t = new StringType();
8429      t.setValue(value);
8430      if (this.contextLinkId == null)
8431        this.contextLinkId = new ArrayList<StringType>();
8432      this.contextLinkId.add(t);
8433      return this;
8434    }
8435
8436    /**
8437     * @param value {@link #contextLinkId} (Id [identifier??] of the clause or
8438     *              question text related to the requester of this action in the
8439     *              referenced form or QuestionnaireResponse.)
8440     */
8441    public boolean hasContextLinkId(String value) {
8442      if (this.contextLinkId == null)
8443        return false;
8444      for (StringType v : this.contextLinkId)
8445        if (v.getValue().equals(value)) // string
8446          return true;
8447      return false;
8448    }
8449
8450    /**
8451     * @return {@link #occurrence} (When action happens.)
8452     */
8453    public Type getOccurrence() {
8454      return this.occurrence;
8455    }
8456
8457    /**
8458     * @return {@link #occurrence} (When action happens.)
8459     */
8460    public DateTimeType getOccurrenceDateTimeType() throws FHIRException {
8461      if (this.occurrence == null)
8462        this.occurrence = new DateTimeType();
8463      if (!(this.occurrence instanceof DateTimeType))
8464        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
8465            + this.occurrence.getClass().getName() + " was encountered");
8466      return (DateTimeType) this.occurrence;
8467    }
8468
8469    public boolean hasOccurrenceDateTimeType() {
8470      return this != null && this.occurrence instanceof DateTimeType;
8471    }
8472
8473    /**
8474     * @return {@link #occurrence} (When action happens.)
8475     */
8476    public Period getOccurrencePeriod() throws FHIRException {
8477      if (this.occurrence == null)
8478        this.occurrence = new Period();
8479      if (!(this.occurrence instanceof Period))
8480        throw new FHIRException("Type mismatch: the type Period was expected, but "
8481            + this.occurrence.getClass().getName() + " was encountered");
8482      return (Period) this.occurrence;
8483    }
8484
8485    public boolean hasOccurrencePeriod() {
8486      return this != null && this.occurrence instanceof Period;
8487    }
8488
8489    /**
8490     * @return {@link #occurrence} (When action happens.)
8491     */
8492    public Timing getOccurrenceTiming() throws FHIRException {
8493      if (this.occurrence == null)
8494        this.occurrence = new Timing();
8495      if (!(this.occurrence instanceof Timing))
8496        throw new FHIRException("Type mismatch: the type Timing was expected, but "
8497            + this.occurrence.getClass().getName() + " was encountered");
8498      return (Timing) this.occurrence;
8499    }
8500
8501    public boolean hasOccurrenceTiming() {
8502      return this != null && this.occurrence instanceof Timing;
8503    }
8504
8505    public boolean hasOccurrence() {
8506      return this.occurrence != null && !this.occurrence.isEmpty();
8507    }
8508
8509    /**
8510     * @param value {@link #occurrence} (When action happens.)
8511     */
8512    public ActionComponent setOccurrence(Type value) {
8513      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
8514        throw new Error("Not the right type for Contract.term.action.occurrence[x]: " + value.fhirType());
8515      this.occurrence = value;
8516      return this;
8517    }
8518
8519    /**
8520     * @return {@link #requester} (Who or what initiated the action and has
8521     *         responsibility for its activation.)
8522     */
8523    public List<Reference> getRequester() {
8524      if (this.requester == null)
8525        this.requester = new ArrayList<Reference>();
8526      return this.requester;
8527    }
8528
8529    /**
8530     * @return Returns a reference to <code>this</code> for easy method chaining
8531     */
8532    public ActionComponent setRequester(List<Reference> theRequester) {
8533      this.requester = theRequester;
8534      return this;
8535    }
8536
8537    public boolean hasRequester() {
8538      if (this.requester == null)
8539        return false;
8540      for (Reference item : this.requester)
8541        if (!item.isEmpty())
8542          return true;
8543      return false;
8544    }
8545
8546    public Reference addRequester() { // 3
8547      Reference t = new Reference();
8548      if (this.requester == null)
8549        this.requester = new ArrayList<Reference>();
8550      this.requester.add(t);
8551      return t;
8552    }
8553
8554    public ActionComponent addRequester(Reference t) { // 3
8555      if (t == null)
8556        return this;
8557      if (this.requester == null)
8558        this.requester = new ArrayList<Reference>();
8559      this.requester.add(t);
8560      return this;
8561    }
8562
8563    /**
8564     * @return The first repetition of repeating field {@link #requester}, creating
8565     *         it if it does not already exist
8566     */
8567    public Reference getRequesterFirstRep() {
8568      if (getRequester().isEmpty()) {
8569        addRequester();
8570      }
8571      return getRequester().get(0);
8572    }
8573
8574    /**
8575     * @deprecated Use Reference#setResource(IBaseResource) instead
8576     */
8577    @Deprecated
8578    public List<Resource> getRequesterTarget() {
8579      if (this.requesterTarget == null)
8580        this.requesterTarget = new ArrayList<Resource>();
8581      return this.requesterTarget;
8582    }
8583
8584    /**
8585     * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question
8586     *         text related to the requester of this action in the referenced form
8587     *         or QuestionnaireResponse.)
8588     */
8589    public List<StringType> getRequesterLinkId() {
8590      if (this.requesterLinkId == null)
8591        this.requesterLinkId = new ArrayList<StringType>();
8592      return this.requesterLinkId;
8593    }
8594
8595    /**
8596     * @return Returns a reference to <code>this</code> for easy method chaining
8597     */
8598    public ActionComponent setRequesterLinkId(List<StringType> theRequesterLinkId) {
8599      this.requesterLinkId = theRequesterLinkId;
8600      return this;
8601    }
8602
8603    public boolean hasRequesterLinkId() {
8604      if (this.requesterLinkId == null)
8605        return false;
8606      for (StringType item : this.requesterLinkId)
8607        if (!item.isEmpty())
8608          return true;
8609      return false;
8610    }
8611
8612    /**
8613     * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question
8614     *         text related to the requester of this action in the referenced form
8615     *         or QuestionnaireResponse.)
8616     */
8617    public StringType addRequesterLinkIdElement() {// 2
8618      StringType t = new StringType();
8619      if (this.requesterLinkId == null)
8620        this.requesterLinkId = new ArrayList<StringType>();
8621      this.requesterLinkId.add(t);
8622      return t;
8623    }
8624
8625    /**
8626     * @param value {@link #requesterLinkId} (Id [identifier??] of the clause or
8627     *              question text related to the requester of this action in the
8628     *              referenced form or QuestionnaireResponse.)
8629     */
8630    public ActionComponent addRequesterLinkId(String value) { // 1
8631      StringType t = new StringType();
8632      t.setValue(value);
8633      if (this.requesterLinkId == null)
8634        this.requesterLinkId = new ArrayList<StringType>();
8635      this.requesterLinkId.add(t);
8636      return this;
8637    }
8638
8639    /**
8640     * @param value {@link #requesterLinkId} (Id [identifier??] of the clause or
8641     *              question text related to the requester of this action in the
8642     *              referenced form or QuestionnaireResponse.)
8643     */
8644    public boolean hasRequesterLinkId(String value) {
8645      if (this.requesterLinkId == null)
8646        return false;
8647      for (StringType v : this.requesterLinkId)
8648        if (v.getValue().equals(value)) // string
8649          return true;
8650      return false;
8651    }
8652
8653    /**
8654     * @return {@link #performerType} (The type of individual that is desired or
8655     *         required to perform or not perform the action.)
8656     */
8657    public List<CodeableConcept> getPerformerType() {
8658      if (this.performerType == null)
8659        this.performerType = new ArrayList<CodeableConcept>();
8660      return this.performerType;
8661    }
8662
8663    /**
8664     * @return Returns a reference to <code>this</code> for easy method chaining
8665     */
8666    public ActionComponent setPerformerType(List<CodeableConcept> thePerformerType) {
8667      this.performerType = thePerformerType;
8668      return this;
8669    }
8670
8671    public boolean hasPerformerType() {
8672      if (this.performerType == null)
8673        return false;
8674      for (CodeableConcept item : this.performerType)
8675        if (!item.isEmpty())
8676          return true;
8677      return false;
8678    }
8679
8680    public CodeableConcept addPerformerType() { // 3
8681      CodeableConcept t = new CodeableConcept();
8682      if (this.performerType == null)
8683        this.performerType = new ArrayList<CodeableConcept>();
8684      this.performerType.add(t);
8685      return t;
8686    }
8687
8688    public ActionComponent addPerformerType(CodeableConcept t) { // 3
8689      if (t == null)
8690        return this;
8691      if (this.performerType == null)
8692        this.performerType = new ArrayList<CodeableConcept>();
8693      this.performerType.add(t);
8694      return this;
8695    }
8696
8697    /**
8698     * @return The first repetition of repeating field {@link #performerType},
8699     *         creating it if it does not already exist
8700     */
8701    public CodeableConcept getPerformerTypeFirstRep() {
8702      if (getPerformerType().isEmpty()) {
8703        addPerformerType();
8704      }
8705      return getPerformerType().get(0);
8706    }
8707
8708    /**
8709     * @return {@link #performerRole} (The type of role or competency of an
8710     *         individual desired or required to perform or not perform the action.)
8711     */
8712    public CodeableConcept getPerformerRole() {
8713      if (this.performerRole == null)
8714        if (Configuration.errorOnAutoCreate())
8715          throw new Error("Attempt to auto-create ActionComponent.performerRole");
8716        else if (Configuration.doAutoCreate())
8717          this.performerRole = new CodeableConcept(); // cc
8718      return this.performerRole;
8719    }
8720
8721    public boolean hasPerformerRole() {
8722      return this.performerRole != null && !this.performerRole.isEmpty();
8723    }
8724
8725    /**
8726     * @param value {@link #performerRole} (The type of role or competency of an
8727     *              individual desired or required to perform or not perform the
8728     *              action.)
8729     */
8730    public ActionComponent setPerformerRole(CodeableConcept value) {
8731      this.performerRole = value;
8732      return this;
8733    }
8734
8735    /**
8736     * @return {@link #performer} (Indicates who or what is being asked to perform
8737     *         (or not perform) the ction.)
8738     */
8739    public Reference getPerformer() {
8740      if (this.performer == null)
8741        if (Configuration.errorOnAutoCreate())
8742          throw new Error("Attempt to auto-create ActionComponent.performer");
8743        else if (Configuration.doAutoCreate())
8744          this.performer = new Reference(); // cc
8745      return this.performer;
8746    }
8747
8748    public boolean hasPerformer() {
8749      return this.performer != null && !this.performer.isEmpty();
8750    }
8751
8752    /**
8753     * @param value {@link #performer} (Indicates who or what is being asked to
8754     *              perform (or not perform) the ction.)
8755     */
8756    public ActionComponent setPerformer(Reference value) {
8757      this.performer = value;
8758      return this;
8759    }
8760
8761    /**
8762     * @return {@link #performer} The actual object that is the target of the
8763     *         reference. The reference library doesn't populate this, but you can
8764     *         use it to hold the resource if you resolve it. (Indicates who or what
8765     *         is being asked to perform (or not perform) the ction.)
8766     */
8767    public Resource getPerformerTarget() {
8768      return this.performerTarget;
8769    }
8770
8771    /**
8772     * @param value {@link #performer} The actual object that is the target of the
8773     *              reference. The reference library doesn't use these, but you can
8774     *              use it to hold the resource if you resolve it. (Indicates who or
8775     *              what is being asked to perform (or not perform) the ction.)
8776     */
8777    public ActionComponent setPerformerTarget(Resource value) {
8778      this.performerTarget = value;
8779      return this;
8780    }
8781
8782    /**
8783     * @return {@link #performerLinkId} (Id [identifier??] of the clause or question
8784     *         text related to the reason type or reference of this action in the
8785     *         referenced form or QuestionnaireResponse.)
8786     */
8787    public List<StringType> getPerformerLinkId() {
8788      if (this.performerLinkId == null)
8789        this.performerLinkId = new ArrayList<StringType>();
8790      return this.performerLinkId;
8791    }
8792
8793    /**
8794     * @return Returns a reference to <code>this</code> for easy method chaining
8795     */
8796    public ActionComponent setPerformerLinkId(List<StringType> thePerformerLinkId) {
8797      this.performerLinkId = thePerformerLinkId;
8798      return this;
8799    }
8800
8801    public boolean hasPerformerLinkId() {
8802      if (this.performerLinkId == null)
8803        return false;
8804      for (StringType item : this.performerLinkId)
8805        if (!item.isEmpty())
8806          return true;
8807      return false;
8808    }
8809
8810    /**
8811     * @return {@link #performerLinkId} (Id [identifier??] of the clause or question
8812     *         text related to the reason type or reference of this action in the
8813     *         referenced form or QuestionnaireResponse.)
8814     */
8815    public StringType addPerformerLinkIdElement() {// 2
8816      StringType t = new StringType();
8817      if (this.performerLinkId == null)
8818        this.performerLinkId = new ArrayList<StringType>();
8819      this.performerLinkId.add(t);
8820      return t;
8821    }
8822
8823    /**
8824     * @param value {@link #performerLinkId} (Id [identifier??] of the clause or
8825     *              question text related to the reason type or reference of this
8826     *              action in the referenced form or QuestionnaireResponse.)
8827     */
8828    public ActionComponent addPerformerLinkId(String value) { // 1
8829      StringType t = new StringType();
8830      t.setValue(value);
8831      if (this.performerLinkId == null)
8832        this.performerLinkId = new ArrayList<StringType>();
8833      this.performerLinkId.add(t);
8834      return this;
8835    }
8836
8837    /**
8838     * @param value {@link #performerLinkId} (Id [identifier??] of the clause or
8839     *              question text related to the reason type or reference of this
8840     *              action in the referenced form or QuestionnaireResponse.)
8841     */
8842    public boolean hasPerformerLinkId(String value) {
8843      if (this.performerLinkId == null)
8844        return false;
8845      for (StringType v : this.performerLinkId)
8846        if (v.getValue().equals(value)) // string
8847          return true;
8848      return false;
8849    }
8850
8851    /**
8852     * @return {@link #reasonCode} (Rationale for the action to be performed or not
8853     *         performed. Describes why the action is permitted or prohibited.)
8854     */
8855    public List<CodeableConcept> getReasonCode() {
8856      if (this.reasonCode == null)
8857        this.reasonCode = new ArrayList<CodeableConcept>();
8858      return this.reasonCode;
8859    }
8860
8861    /**
8862     * @return Returns a reference to <code>this</code> for easy method chaining
8863     */
8864    public ActionComponent setReasonCode(List<CodeableConcept> theReasonCode) {
8865      this.reasonCode = theReasonCode;
8866      return this;
8867    }
8868
8869    public boolean hasReasonCode() {
8870      if (this.reasonCode == null)
8871        return false;
8872      for (CodeableConcept item : this.reasonCode)
8873        if (!item.isEmpty())
8874          return true;
8875      return false;
8876    }
8877
8878    public CodeableConcept addReasonCode() { // 3
8879      CodeableConcept t = new CodeableConcept();
8880      if (this.reasonCode == null)
8881        this.reasonCode = new ArrayList<CodeableConcept>();
8882      this.reasonCode.add(t);
8883      return t;
8884    }
8885
8886    public ActionComponent addReasonCode(CodeableConcept t) { // 3
8887      if (t == null)
8888        return this;
8889      if (this.reasonCode == null)
8890        this.reasonCode = new ArrayList<CodeableConcept>();
8891      this.reasonCode.add(t);
8892      return this;
8893    }
8894
8895    /**
8896     * @return The first repetition of repeating field {@link #reasonCode}, creating
8897     *         it if it does not already exist
8898     */
8899    public CodeableConcept getReasonCodeFirstRep() {
8900      if (getReasonCode().isEmpty()) {
8901        addReasonCode();
8902      }
8903      return getReasonCode().get(0);
8904    }
8905
8906    /**
8907     * @return {@link #reasonReference} (Indicates another resource whose existence
8908     *         justifies permitting or not permitting this action.)
8909     */
8910    public List<Reference> getReasonReference() {
8911      if (this.reasonReference == null)
8912        this.reasonReference = new ArrayList<Reference>();
8913      return this.reasonReference;
8914    }
8915
8916    /**
8917     * @return Returns a reference to <code>this</code> for easy method chaining
8918     */
8919    public ActionComponent setReasonReference(List<Reference> theReasonReference) {
8920      this.reasonReference = theReasonReference;
8921      return this;
8922    }
8923
8924    public boolean hasReasonReference() {
8925      if (this.reasonReference == null)
8926        return false;
8927      for (Reference item : this.reasonReference)
8928        if (!item.isEmpty())
8929          return true;
8930      return false;
8931    }
8932
8933    public Reference addReasonReference() { // 3
8934      Reference t = new Reference();
8935      if (this.reasonReference == null)
8936        this.reasonReference = new ArrayList<Reference>();
8937      this.reasonReference.add(t);
8938      return t;
8939    }
8940
8941    public ActionComponent addReasonReference(Reference t) { // 3
8942      if (t == null)
8943        return this;
8944      if (this.reasonReference == null)
8945        this.reasonReference = new ArrayList<Reference>();
8946      this.reasonReference.add(t);
8947      return this;
8948    }
8949
8950    /**
8951     * @return The first repetition of repeating field {@link #reasonReference},
8952     *         creating it if it does not already exist
8953     */
8954    public Reference getReasonReferenceFirstRep() {
8955      if (getReasonReference().isEmpty()) {
8956        addReasonReference();
8957      }
8958      return getReasonReference().get(0);
8959    }
8960
8961    /**
8962     * @deprecated Use Reference#setResource(IBaseResource) instead
8963     */
8964    @Deprecated
8965    public List<Resource> getReasonReferenceTarget() {
8966      if (this.reasonReferenceTarget == null)
8967        this.reasonReferenceTarget = new ArrayList<Resource>();
8968      return this.reasonReferenceTarget;
8969    }
8970
8971    /**
8972     * @return {@link #reason} (Describes why the action is to be performed or not
8973     *         performed in textual form.)
8974     */
8975    public List<StringType> getReason() {
8976      if (this.reason == null)
8977        this.reason = new ArrayList<StringType>();
8978      return this.reason;
8979    }
8980
8981    /**
8982     * @return Returns a reference to <code>this</code> for easy method chaining
8983     */
8984    public ActionComponent setReason(List<StringType> theReason) {
8985      this.reason = theReason;
8986      return this;
8987    }
8988
8989    public boolean hasReason() {
8990      if (this.reason == null)
8991        return false;
8992      for (StringType item : this.reason)
8993        if (!item.isEmpty())
8994          return true;
8995      return false;
8996    }
8997
8998    /**
8999     * @return {@link #reason} (Describes why the action is to be performed or not
9000     *         performed in textual form.)
9001     */
9002    public StringType addReasonElement() {// 2
9003      StringType t = new StringType();
9004      if (this.reason == null)
9005        this.reason = new ArrayList<StringType>();
9006      this.reason.add(t);
9007      return t;
9008    }
9009
9010    /**
9011     * @param value {@link #reason} (Describes why the action is to be performed or
9012     *              not performed in textual form.)
9013     */
9014    public ActionComponent addReason(String value) { // 1
9015      StringType t = new StringType();
9016      t.setValue(value);
9017      if (this.reason == null)
9018        this.reason = new ArrayList<StringType>();
9019      this.reason.add(t);
9020      return this;
9021    }
9022
9023    /**
9024     * @param value {@link #reason} (Describes why the action is to be performed or
9025     *              not performed in textual form.)
9026     */
9027    public boolean hasReason(String value) {
9028      if (this.reason == null)
9029        return false;
9030      for (StringType v : this.reason)
9031        if (v.getValue().equals(value)) // string
9032          return true;
9033      return false;
9034    }
9035
9036    /**
9037     * @return {@link #reasonLinkId} (Id [identifier??] of the clause or question
9038     *         text related to the reason type or reference of this action in the
9039     *         referenced form or QuestionnaireResponse.)
9040     */
9041    public List<StringType> getReasonLinkId() {
9042      if (this.reasonLinkId == null)
9043        this.reasonLinkId = new ArrayList<StringType>();
9044      return this.reasonLinkId;
9045    }
9046
9047    /**
9048     * @return Returns a reference to <code>this</code> for easy method chaining
9049     */
9050    public ActionComponent setReasonLinkId(List<StringType> theReasonLinkId) {
9051      this.reasonLinkId = theReasonLinkId;
9052      return this;
9053    }
9054
9055    public boolean hasReasonLinkId() {
9056      if (this.reasonLinkId == null)
9057        return false;
9058      for (StringType item : this.reasonLinkId)
9059        if (!item.isEmpty())
9060          return true;
9061      return false;
9062    }
9063
9064    /**
9065     * @return {@link #reasonLinkId} (Id [identifier??] of the clause or question
9066     *         text related to the reason type or reference of this action in the
9067     *         referenced form or QuestionnaireResponse.)
9068     */
9069    public StringType addReasonLinkIdElement() {// 2
9070      StringType t = new StringType();
9071      if (this.reasonLinkId == null)
9072        this.reasonLinkId = new ArrayList<StringType>();
9073      this.reasonLinkId.add(t);
9074      return t;
9075    }
9076
9077    /**
9078     * @param value {@link #reasonLinkId} (Id [identifier??] of the clause or
9079     *              question text related to the reason type or reference of this
9080     *              action in the referenced form or QuestionnaireResponse.)
9081     */
9082    public ActionComponent addReasonLinkId(String value) { // 1
9083      StringType t = new StringType();
9084      t.setValue(value);
9085      if (this.reasonLinkId == null)
9086        this.reasonLinkId = new ArrayList<StringType>();
9087      this.reasonLinkId.add(t);
9088      return this;
9089    }
9090
9091    /**
9092     * @param value {@link #reasonLinkId} (Id [identifier??] of the clause or
9093     *              question text related to the reason type or reference of this
9094     *              action in the referenced form or QuestionnaireResponse.)
9095     */
9096    public boolean hasReasonLinkId(String value) {
9097      if (this.reasonLinkId == null)
9098        return false;
9099      for (StringType v : this.reasonLinkId)
9100        if (v.getValue().equals(value)) // string
9101          return true;
9102      return false;
9103    }
9104
9105    /**
9106     * @return {@link #note} (Comments made about the term action made by the
9107     *         requester, performer, subject or other participants.)
9108     */
9109    public List<Annotation> getNote() {
9110      if (this.note == null)
9111        this.note = new ArrayList<Annotation>();
9112      return this.note;
9113    }
9114
9115    /**
9116     * @return Returns a reference to <code>this</code> for easy method chaining
9117     */
9118    public ActionComponent setNote(List<Annotation> theNote) {
9119      this.note = theNote;
9120      return this;
9121    }
9122
9123    public boolean hasNote() {
9124      if (this.note == null)
9125        return false;
9126      for (Annotation item : this.note)
9127        if (!item.isEmpty())
9128          return true;
9129      return false;
9130    }
9131
9132    public Annotation addNote() { // 3
9133      Annotation t = new Annotation();
9134      if (this.note == null)
9135        this.note = new ArrayList<Annotation>();
9136      this.note.add(t);
9137      return t;
9138    }
9139
9140    public ActionComponent addNote(Annotation t) { // 3
9141      if (t == null)
9142        return this;
9143      if (this.note == null)
9144        this.note = new ArrayList<Annotation>();
9145      this.note.add(t);
9146      return this;
9147    }
9148
9149    /**
9150     * @return The first repetition of repeating field {@link #note}, creating it if
9151     *         it does not already exist
9152     */
9153    public Annotation getNoteFirstRep() {
9154      if (getNote().isEmpty()) {
9155        addNote();
9156      }
9157      return getNote().get(0);
9158    }
9159
9160    /**
9161     * @return {@link #securityLabelNumber} (Security labels that protects the
9162     *         action.)
9163     */
9164    public List<UnsignedIntType> getSecurityLabelNumber() {
9165      if (this.securityLabelNumber == null)
9166        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
9167      return this.securityLabelNumber;
9168    }
9169
9170    /**
9171     * @return Returns a reference to <code>this</code> for easy method chaining
9172     */
9173    public ActionComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
9174      this.securityLabelNumber = theSecurityLabelNumber;
9175      return this;
9176    }
9177
9178    public boolean hasSecurityLabelNumber() {
9179      if (this.securityLabelNumber == null)
9180        return false;
9181      for (UnsignedIntType item : this.securityLabelNumber)
9182        if (!item.isEmpty())
9183          return true;
9184      return false;
9185    }
9186
9187    /**
9188     * @return {@link #securityLabelNumber} (Security labels that protects the
9189     *         action.)
9190     */
9191    public UnsignedIntType addSecurityLabelNumberElement() {// 2
9192      UnsignedIntType t = new UnsignedIntType();
9193      if (this.securityLabelNumber == null)
9194        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
9195      this.securityLabelNumber.add(t);
9196      return t;
9197    }
9198
9199    /**
9200     * @param value {@link #securityLabelNumber} (Security labels that protects the
9201     *              action.)
9202     */
9203    public ActionComponent addSecurityLabelNumber(int value) { // 1
9204      UnsignedIntType t = new UnsignedIntType();
9205      t.setValue(value);
9206      if (this.securityLabelNumber == null)
9207        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
9208      this.securityLabelNumber.add(t);
9209      return this;
9210    }
9211
9212    /**
9213     * @param value {@link #securityLabelNumber} (Security labels that protects the
9214     *              action.)
9215     */
9216    public boolean hasSecurityLabelNumber(int value) {
9217      if (this.securityLabelNumber == null)
9218        return false;
9219      for (UnsignedIntType v : this.securityLabelNumber)
9220        if (v.getValue().equals(value)) // unsignedInt
9221          return true;
9222      return false;
9223    }
9224
9225    protected void listChildren(List<Property> children) {
9226      super.listChildren(children);
9227      children
9228          .add(new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform));
9229      children.add(new Property("type", "CodeableConcept",
9230          "Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.",
9231          0, 1, type));
9232      children.add(new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject));
9233      children.add(new Property("intent", "CodeableConcept",
9234          "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent));
9235      children.add(new Property("linkId", "string",
9236          "Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.",
9237          0, java.lang.Integer.MAX_VALUE, linkId));
9238      children.add(new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status));
9239      children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)",
9240          "Encounter or Episode with primary association to specified term activity.", 0, 1, context));
9241      children.add(new Property("contextLinkId", "string",
9242          "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9243          0, java.lang.Integer.MAX_VALUE, contextLinkId));
9244      children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence));
9245      children.add(new Property("requester",
9246          "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
9247          "Who or what initiated the action and has responsibility for its activation.", 0, java.lang.Integer.MAX_VALUE,
9248          requester));
9249      children.add(new Property("requesterLinkId", "string",
9250          "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9251          0, java.lang.Integer.MAX_VALUE, requesterLinkId));
9252      children.add(new Property("performerType", "CodeableConcept",
9253          "The type of individual that is desired or required to perform or not perform the action.", 0,
9254          java.lang.Integer.MAX_VALUE, performerType));
9255      children.add(new Property("performerRole", "CodeableConcept",
9256          "The type of role or competency of an individual desired or required to perform or not perform the action.",
9257          0, 1, performerRole));
9258      children.add(new Property("performer",
9259          "Reference(RelatedPerson|Patient|Practitioner|PractitionerRole|CareTeam|Device|Substance|Organization|Location)",
9260          "Indicates who or what is being asked to perform (or not perform) the ction.", 0, 1, performer));
9261      children.add(new Property("performerLinkId", "string",
9262          "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9263          0, java.lang.Integer.MAX_VALUE, performerLinkId));
9264      children.add(new Property("reasonCode", "CodeableConcept",
9265          "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.",
9266          0, java.lang.Integer.MAX_VALUE, reasonCode));
9267      children.add(new Property("reasonReference",
9268          "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)",
9269          "Indicates another resource whose existence justifies permitting or not permitting this action.", 0,
9270          java.lang.Integer.MAX_VALUE, reasonReference));
9271      children.add(new Property("reason", "string",
9272          "Describes why the action is to be performed or not performed in textual form.", 0,
9273          java.lang.Integer.MAX_VALUE, reason));
9274      children.add(new Property("reasonLinkId", "string",
9275          "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9276          0, java.lang.Integer.MAX_VALUE, reasonLinkId));
9277      children.add(new Property("note", "Annotation",
9278          "Comments made about the term action made by the requester, performer, subject or other participants.", 0,
9279          java.lang.Integer.MAX_VALUE, note));
9280      children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0,
9281          java.lang.Integer.MAX_VALUE, securityLabelNumber));
9282    }
9283
9284    @Override
9285    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9286      switch (_hash) {
9287      case -1788508167:
9288        /* doNotPerform */ return new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0,
9289            1, doNotPerform);
9290      case 3575610:
9291        /* type */ return new Property("type", "CodeableConcept",
9292            "Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.",
9293            0, 1, type);
9294      case -1867885268:
9295        /* subject */ return new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE,
9296            subject);
9297      case -1183762788:
9298        /* intent */ return new Property("intent", "CodeableConcept",
9299            "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent);
9300      case -1102667083:
9301        /* linkId */ return new Property("linkId", "string",
9302            "Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.",
9303            0, java.lang.Integer.MAX_VALUE, linkId);
9304      case -892481550:
9305        /* status */ return new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1,
9306            status);
9307      case 951530927:
9308        /* context */ return new Property("context", "Reference(Encounter|EpisodeOfCare)",
9309            "Encounter or Episode with primary association to specified term activity.", 0, 1, context);
9310      case -288783036:
9311        /* contextLinkId */ return new Property("contextLinkId", "string",
9312            "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9313            0, java.lang.Integer.MAX_VALUE, contextLinkId);
9314      case -2022646513:
9315        /* occurrence[x] */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1,
9316            occurrence);
9317      case 1687874001:
9318        /* occurrence */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1,
9319            occurrence);
9320      case -298443636:
9321        /* occurrenceDateTime */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.",
9322            0, 1, occurrence);
9323      case 1397156594:
9324        /* occurrencePeriod */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0,
9325            1, occurrence);
9326      case 1515218299:
9327        /* occurrenceTiming */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0,
9328            1, occurrence);
9329      case 693933948:
9330        /* requester */ return new Property("requester",
9331            "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
9332            "Who or what initiated the action and has responsibility for its activation.", 0,
9333            java.lang.Integer.MAX_VALUE, requester);
9334      case -1468032687:
9335        /* requesterLinkId */ return new Property("requesterLinkId", "string",
9336            "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9337            0, java.lang.Integer.MAX_VALUE, requesterLinkId);
9338      case -901444568:
9339        /* performerType */ return new Property("performerType", "CodeableConcept",
9340            "The type of individual that is desired or required to perform or not perform the action.", 0,
9341            java.lang.Integer.MAX_VALUE, performerType);
9342      case -901513884:
9343        /* performerRole */ return new Property("performerRole", "CodeableConcept",
9344            "The type of role or competency of an individual desired or required to perform or not perform the action.",
9345            0, 1, performerRole);
9346      case 481140686:
9347        /* performer */ return new Property("performer",
9348            "Reference(RelatedPerson|Patient|Practitioner|PractitionerRole|CareTeam|Device|Substance|Organization|Location)",
9349            "Indicates who or what is being asked to perform (or not perform) the ction.", 0, 1, performer);
9350      case 1051302947:
9351        /* performerLinkId */ return new Property("performerLinkId", "string",
9352            "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9353            0, java.lang.Integer.MAX_VALUE, performerLinkId);
9354      case 722137681:
9355        /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
9356            "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.",
9357            0, java.lang.Integer.MAX_VALUE, reasonCode);
9358      case -1146218137:
9359        /* reasonReference */ return new Property("reasonReference",
9360            "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)",
9361            "Indicates another resource whose existence justifies permitting or not permitting this action.", 0,
9362            java.lang.Integer.MAX_VALUE, reasonReference);
9363      case -934964668:
9364        /* reason */ return new Property("reason", "string",
9365            "Describes why the action is to be performed or not performed in textual form.", 0,
9366            java.lang.Integer.MAX_VALUE, reason);
9367      case -1557963239:
9368        /* reasonLinkId */ return new Property("reasonLinkId", "string",
9369            "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9370            0, java.lang.Integer.MAX_VALUE, reasonLinkId);
9371      case 3387378:
9372        /* note */ return new Property("note", "Annotation",
9373            "Comments made about the term action made by the requester, performer, subject or other participants.", 0,
9374            java.lang.Integer.MAX_VALUE, note);
9375      case -149460995:
9376        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
9377            "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
9378      default:
9379        return super.getNamedProperty(_hash, _name, _checkValid);
9380      }
9381
9382    }
9383
9384    @Override
9385    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9386      switch (hash) {
9387      case -1788508167:
9388        /* doNotPerform */ return this.doNotPerform == null ? new Base[0] : new Base[] { this.doNotPerform }; // BooleanType
9389      case 3575610:
9390        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
9391      case -1867885268:
9392        /* subject */ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // ActionSubjectComponent
9393      case -1183762788:
9394        /* intent */ return this.intent == null ? new Base[0] : new Base[] { this.intent }; // CodeableConcept
9395      case -1102667083:
9396        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
9397      case -892481550:
9398        /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // CodeableConcept
9399      case 951530927:
9400        /* context */ return this.context == null ? new Base[0] : new Base[] { this.context }; // Reference
9401      case -288783036:
9402        /* contextLinkId */ return this.contextLinkId == null ? new Base[0]
9403            : this.contextLinkId.toArray(new Base[this.contextLinkId.size()]); // StringType
9404      case 1687874001:
9405        /* occurrence */ return this.occurrence == null ? new Base[0] : new Base[] { this.occurrence }; // Type
9406      case 693933948:
9407        /* requester */ return this.requester == null ? new Base[0]
9408            : this.requester.toArray(new Base[this.requester.size()]); // Reference
9409      case -1468032687:
9410        /* requesterLinkId */ return this.requesterLinkId == null ? new Base[0]
9411            : this.requesterLinkId.toArray(new Base[this.requesterLinkId.size()]); // StringType
9412      case -901444568:
9413        /* performerType */ return this.performerType == null ? new Base[0]
9414            : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
9415      case -901513884:
9416        /* performerRole */ return this.performerRole == null ? new Base[0] : new Base[] { this.performerRole }; // CodeableConcept
9417      case 481140686:
9418        /* performer */ return this.performer == null ? new Base[0] : new Base[] { this.performer }; // Reference
9419      case 1051302947:
9420        /* performerLinkId */ return this.performerLinkId == null ? new Base[0]
9421            : this.performerLinkId.toArray(new Base[this.performerLinkId.size()]); // StringType
9422      case 722137681:
9423        /* reasonCode */ return this.reasonCode == null ? new Base[0]
9424            : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
9425      case -1146218137:
9426        /* reasonReference */ return this.reasonReference == null ? new Base[0]
9427            : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
9428      case -934964668:
9429        /* reason */ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // StringType
9430      case -1557963239:
9431        /* reasonLinkId */ return this.reasonLinkId == null ? new Base[0]
9432            : this.reasonLinkId.toArray(new Base[this.reasonLinkId.size()]); // StringType
9433      case 3387378:
9434        /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
9435      case -149460995:
9436        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
9437            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
9438      default:
9439        return super.getProperty(hash, name, checkValid);
9440      }
9441
9442    }
9443
9444    @Override
9445    public Base setProperty(int hash, String name, Base value) throws FHIRException {
9446      switch (hash) {
9447      case -1788508167: // doNotPerform
9448        this.doNotPerform = castToBoolean(value); // BooleanType
9449        return value;
9450      case 3575610: // type
9451        this.type = castToCodeableConcept(value); // CodeableConcept
9452        return value;
9453      case -1867885268: // subject
9454        this.getSubject().add((ActionSubjectComponent) value); // ActionSubjectComponent
9455        return value;
9456      case -1183762788: // intent
9457        this.intent = castToCodeableConcept(value); // CodeableConcept
9458        return value;
9459      case -1102667083: // linkId
9460        this.getLinkId().add(castToString(value)); // StringType
9461        return value;
9462      case -892481550: // status
9463        this.status = castToCodeableConcept(value); // CodeableConcept
9464        return value;
9465      case 951530927: // context
9466        this.context = castToReference(value); // Reference
9467        return value;
9468      case -288783036: // contextLinkId
9469        this.getContextLinkId().add(castToString(value)); // StringType
9470        return value;
9471      case 1687874001: // occurrence
9472        this.occurrence = castToType(value); // Type
9473        return value;
9474      case 693933948: // requester
9475        this.getRequester().add(castToReference(value)); // Reference
9476        return value;
9477      case -1468032687: // requesterLinkId
9478        this.getRequesterLinkId().add(castToString(value)); // StringType
9479        return value;
9480      case -901444568: // performerType
9481        this.getPerformerType().add(castToCodeableConcept(value)); // CodeableConcept
9482        return value;
9483      case -901513884: // performerRole
9484        this.performerRole = castToCodeableConcept(value); // CodeableConcept
9485        return value;
9486      case 481140686: // performer
9487        this.performer = castToReference(value); // Reference
9488        return value;
9489      case 1051302947: // performerLinkId
9490        this.getPerformerLinkId().add(castToString(value)); // StringType
9491        return value;
9492      case 722137681: // reasonCode
9493        this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
9494        return value;
9495      case -1146218137: // reasonReference
9496        this.getReasonReference().add(castToReference(value)); // Reference
9497        return value;
9498      case -934964668: // reason
9499        this.getReason().add(castToString(value)); // StringType
9500        return value;
9501      case -1557963239: // reasonLinkId
9502        this.getReasonLinkId().add(castToString(value)); // StringType
9503        return value;
9504      case 3387378: // note
9505        this.getNote().add(castToAnnotation(value)); // Annotation
9506        return value;
9507      case -149460995: // securityLabelNumber
9508        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
9509        return value;
9510      default:
9511        return super.setProperty(hash, name, value);
9512      }
9513
9514    }
9515
9516    @Override
9517    public Base setProperty(String name, Base value) throws FHIRException {
9518      if (name.equals("doNotPerform")) {
9519        this.doNotPerform = castToBoolean(value); // BooleanType
9520      } else if (name.equals("type")) {
9521        this.type = castToCodeableConcept(value); // CodeableConcept
9522      } else if (name.equals("subject")) {
9523        this.getSubject().add((ActionSubjectComponent) value);
9524      } else if (name.equals("intent")) {
9525        this.intent = castToCodeableConcept(value); // CodeableConcept
9526      } else if (name.equals("linkId")) {
9527        this.getLinkId().add(castToString(value));
9528      } else if (name.equals("status")) {
9529        this.status = castToCodeableConcept(value); // CodeableConcept
9530      } else if (name.equals("context")) {
9531        this.context = castToReference(value); // Reference
9532      } else if (name.equals("contextLinkId")) {
9533        this.getContextLinkId().add(castToString(value));
9534      } else if (name.equals("occurrence[x]")) {
9535        this.occurrence = castToType(value); // Type
9536      } else if (name.equals("requester")) {
9537        this.getRequester().add(castToReference(value));
9538      } else if (name.equals("requesterLinkId")) {
9539        this.getRequesterLinkId().add(castToString(value));
9540      } else if (name.equals("performerType")) {
9541        this.getPerformerType().add(castToCodeableConcept(value));
9542      } else if (name.equals("performerRole")) {
9543        this.performerRole = castToCodeableConcept(value); // CodeableConcept
9544      } else if (name.equals("performer")) {
9545        this.performer = castToReference(value); // Reference
9546      } else if (name.equals("performerLinkId")) {
9547        this.getPerformerLinkId().add(castToString(value));
9548      } else if (name.equals("reasonCode")) {
9549        this.getReasonCode().add(castToCodeableConcept(value));
9550      } else if (name.equals("reasonReference")) {
9551        this.getReasonReference().add(castToReference(value));
9552      } else if (name.equals("reason")) {
9553        this.getReason().add(castToString(value));
9554      } else if (name.equals("reasonLinkId")) {
9555        this.getReasonLinkId().add(castToString(value));
9556      } else if (name.equals("note")) {
9557        this.getNote().add(castToAnnotation(value));
9558      } else if (name.equals("securityLabelNumber")) {
9559        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
9560      } else
9561        return super.setProperty(name, value);
9562      return value;
9563    }
9564
9565    @Override
9566    public Base makeProperty(int hash, String name) throws FHIRException {
9567      switch (hash) {
9568      case -1788508167:
9569        return getDoNotPerformElement();
9570      case 3575610:
9571        return getType();
9572      case -1867885268:
9573        return addSubject();
9574      case -1183762788:
9575        return getIntent();
9576      case -1102667083:
9577        return addLinkIdElement();
9578      case -892481550:
9579        return getStatus();
9580      case 951530927:
9581        return getContext();
9582      case -288783036:
9583        return addContextLinkIdElement();
9584      case -2022646513:
9585        return getOccurrence();
9586      case 1687874001:
9587        return getOccurrence();
9588      case 693933948:
9589        return addRequester();
9590      case -1468032687:
9591        return addRequesterLinkIdElement();
9592      case -901444568:
9593        return addPerformerType();
9594      case -901513884:
9595        return getPerformerRole();
9596      case 481140686:
9597        return getPerformer();
9598      case 1051302947:
9599        return addPerformerLinkIdElement();
9600      case 722137681:
9601        return addReasonCode();
9602      case -1146218137:
9603        return addReasonReference();
9604      case -934964668:
9605        return addReasonElement();
9606      case -1557963239:
9607        return addReasonLinkIdElement();
9608      case 3387378:
9609        return addNote();
9610      case -149460995:
9611        return addSecurityLabelNumberElement();
9612      default:
9613        return super.makeProperty(hash, name);
9614      }
9615
9616    }
9617
9618    @Override
9619    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9620      switch (hash) {
9621      case -1788508167:
9622        /* doNotPerform */ return new String[] { "boolean" };
9623      case 3575610:
9624        /* type */ return new String[] { "CodeableConcept" };
9625      case -1867885268:
9626        /* subject */ return new String[] {};
9627      case -1183762788:
9628        /* intent */ return new String[] { "CodeableConcept" };
9629      case -1102667083:
9630        /* linkId */ return new String[] { "string" };
9631      case -892481550:
9632        /* status */ return new String[] { "CodeableConcept" };
9633      case 951530927:
9634        /* context */ return new String[] { "Reference" };
9635      case -288783036:
9636        /* contextLinkId */ return new String[] { "string" };
9637      case 1687874001:
9638        /* occurrence */ return new String[] { "dateTime", "Period", "Timing" };
9639      case 693933948:
9640        /* requester */ return new String[] { "Reference" };
9641      case -1468032687:
9642        /* requesterLinkId */ return new String[] { "string" };
9643      case -901444568:
9644        /* performerType */ return new String[] { "CodeableConcept" };
9645      case -901513884:
9646        /* performerRole */ return new String[] { "CodeableConcept" };
9647      case 481140686:
9648        /* performer */ return new String[] { "Reference" };
9649      case 1051302947:
9650        /* performerLinkId */ return new String[] { "string" };
9651      case 722137681:
9652        /* reasonCode */ return new String[] { "CodeableConcept" };
9653      case -1146218137:
9654        /* reasonReference */ return new String[] { "Reference" };
9655      case -934964668:
9656        /* reason */ return new String[] { "string" };
9657      case -1557963239:
9658        /* reasonLinkId */ return new String[] { "string" };
9659      case 3387378:
9660        /* note */ return new String[] { "Annotation" };
9661      case -149460995:
9662        /* securityLabelNumber */ return new String[] { "unsignedInt" };
9663      default:
9664        return super.getTypesForProperty(hash, name);
9665      }
9666
9667    }
9668
9669    @Override
9670    public Base addChild(String name) throws FHIRException {
9671      if (name.equals("doNotPerform")) {
9672        throw new FHIRException("Cannot call addChild on a singleton property Contract.doNotPerform");
9673      } else if (name.equals("type")) {
9674        this.type = new CodeableConcept();
9675        return this.type;
9676      } else if (name.equals("subject")) {
9677        return addSubject();
9678      } else if (name.equals("intent")) {
9679        this.intent = new CodeableConcept();
9680        return this.intent;
9681      } else if (name.equals("linkId")) {
9682        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
9683      } else if (name.equals("status")) {
9684        this.status = new CodeableConcept();
9685        return this.status;
9686      } else if (name.equals("context")) {
9687        this.context = new Reference();
9688        return this.context;
9689      } else if (name.equals("contextLinkId")) {
9690        throw new FHIRException("Cannot call addChild on a singleton property Contract.contextLinkId");
9691      } else if (name.equals("occurrenceDateTime")) {
9692        this.occurrence = new DateTimeType();
9693        return this.occurrence;
9694      } else if (name.equals("occurrencePeriod")) {
9695        this.occurrence = new Period();
9696        return this.occurrence;
9697      } else if (name.equals("occurrenceTiming")) {
9698        this.occurrence = new Timing();
9699        return this.occurrence;
9700      } else if (name.equals("requester")) {
9701        return addRequester();
9702      } else if (name.equals("requesterLinkId")) {
9703        throw new FHIRException("Cannot call addChild on a singleton property Contract.requesterLinkId");
9704      } else if (name.equals("performerType")) {
9705        return addPerformerType();
9706      } else if (name.equals("performerRole")) {
9707        this.performerRole = new CodeableConcept();
9708        return this.performerRole;
9709      } else if (name.equals("performer")) {
9710        this.performer = new Reference();
9711        return this.performer;
9712      } else if (name.equals("performerLinkId")) {
9713        throw new FHIRException("Cannot call addChild on a singleton property Contract.performerLinkId");
9714      } else if (name.equals("reasonCode")) {
9715        return addReasonCode();
9716      } else if (name.equals("reasonReference")) {
9717        return addReasonReference();
9718      } else if (name.equals("reason")) {
9719        throw new FHIRException("Cannot call addChild on a singleton property Contract.reason");
9720      } else if (name.equals("reasonLinkId")) {
9721        throw new FHIRException("Cannot call addChild on a singleton property Contract.reasonLinkId");
9722      } else if (name.equals("note")) {
9723        return addNote();
9724      } else if (name.equals("securityLabelNumber")) {
9725        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
9726      } else
9727        return super.addChild(name);
9728    }
9729
9730    public ActionComponent copy() {
9731      ActionComponent dst = new ActionComponent();
9732      copyValues(dst);
9733      return dst;
9734    }
9735
9736    public void copyValues(ActionComponent dst) {
9737      super.copyValues(dst);
9738      dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
9739      dst.type = type == null ? null : type.copy();
9740      if (subject != null) {
9741        dst.subject = new ArrayList<ActionSubjectComponent>();
9742        for (ActionSubjectComponent i : subject)
9743          dst.subject.add(i.copy());
9744      }
9745      ;
9746      dst.intent = intent == null ? null : intent.copy();
9747      if (linkId != null) {
9748        dst.linkId = new ArrayList<StringType>();
9749        for (StringType i : linkId)
9750          dst.linkId.add(i.copy());
9751      }
9752      ;
9753      dst.status = status == null ? null : status.copy();
9754      dst.context = context == null ? null : context.copy();
9755      if (contextLinkId != null) {
9756        dst.contextLinkId = new ArrayList<StringType>();
9757        for (StringType i : contextLinkId)
9758          dst.contextLinkId.add(i.copy());
9759      }
9760      ;
9761      dst.occurrence = occurrence == null ? null : occurrence.copy();
9762      if (requester != null) {
9763        dst.requester = new ArrayList<Reference>();
9764        for (Reference i : requester)
9765          dst.requester.add(i.copy());
9766      }
9767      ;
9768      if (requesterLinkId != null) {
9769        dst.requesterLinkId = new ArrayList<StringType>();
9770        for (StringType i : requesterLinkId)
9771          dst.requesterLinkId.add(i.copy());
9772      }
9773      ;
9774      if (performerType != null) {
9775        dst.performerType = new ArrayList<CodeableConcept>();
9776        for (CodeableConcept i : performerType)
9777          dst.performerType.add(i.copy());
9778      }
9779      ;
9780      dst.performerRole = performerRole == null ? null : performerRole.copy();
9781      dst.performer = performer == null ? null : performer.copy();
9782      if (performerLinkId != null) {
9783        dst.performerLinkId = new ArrayList<StringType>();
9784        for (StringType i : performerLinkId)
9785          dst.performerLinkId.add(i.copy());
9786      }
9787      ;
9788      if (reasonCode != null) {
9789        dst.reasonCode = new ArrayList<CodeableConcept>();
9790        for (CodeableConcept i : reasonCode)
9791          dst.reasonCode.add(i.copy());
9792      }
9793      ;
9794      if (reasonReference != null) {
9795        dst.reasonReference = new ArrayList<Reference>();
9796        for (Reference i : reasonReference)
9797          dst.reasonReference.add(i.copy());
9798      }
9799      ;
9800      if (reason != null) {
9801        dst.reason = new ArrayList<StringType>();
9802        for (StringType i : reason)
9803          dst.reason.add(i.copy());
9804      }
9805      ;
9806      if (reasonLinkId != null) {
9807        dst.reasonLinkId = new ArrayList<StringType>();
9808        for (StringType i : reasonLinkId)
9809          dst.reasonLinkId.add(i.copy());
9810      }
9811      ;
9812      if (note != null) {
9813        dst.note = new ArrayList<Annotation>();
9814        for (Annotation i : note)
9815          dst.note.add(i.copy());
9816      }
9817      ;
9818      if (securityLabelNumber != null) {
9819        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
9820        for (UnsignedIntType i : securityLabelNumber)
9821          dst.securityLabelNumber.add(i.copy());
9822      }
9823      ;
9824    }
9825
9826    @Override
9827    public boolean equalsDeep(Base other_) {
9828      if (!super.equalsDeep(other_))
9829        return false;
9830      if (!(other_ instanceof ActionComponent))
9831        return false;
9832      ActionComponent o = (ActionComponent) other_;
9833      return compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(type, o.type, true)
9834          && compareDeep(subject, o.subject, true) && compareDeep(intent, o.intent, true)
9835          && compareDeep(linkId, o.linkId, true) && compareDeep(status, o.status, true)
9836          && compareDeep(context, o.context, true) && compareDeep(contextLinkId, o.contextLinkId, true)
9837          && compareDeep(occurrence, o.occurrence, true) && compareDeep(requester, o.requester, true)
9838          && compareDeep(requesterLinkId, o.requesterLinkId, true) && compareDeep(performerType, o.performerType, true)
9839          && compareDeep(performerRole, o.performerRole, true) && compareDeep(performer, o.performer, true)
9840          && compareDeep(performerLinkId, o.performerLinkId, true) && compareDeep(reasonCode, o.reasonCode, true)
9841          && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(reason, o.reason, true)
9842          && compareDeep(reasonLinkId, o.reasonLinkId, true) && compareDeep(note, o.note, true)
9843          && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
9844    }
9845
9846    @Override
9847    public boolean equalsShallow(Base other_) {
9848      if (!super.equalsShallow(other_))
9849        return false;
9850      if (!(other_ instanceof ActionComponent))
9851        return false;
9852      ActionComponent o = (ActionComponent) other_;
9853      return compareValues(doNotPerform, o.doNotPerform, true) && compareValues(linkId, o.linkId, true)
9854          && compareValues(contextLinkId, o.contextLinkId, true)
9855          && compareValues(requesterLinkId, o.requesterLinkId, true)
9856          && compareValues(performerLinkId, o.performerLinkId, true) && compareValues(reason, o.reason, true)
9857          && compareValues(reasonLinkId, o.reasonLinkId, true)
9858          && compareValues(securityLabelNumber, o.securityLabelNumber, true);
9859    }
9860
9861    public boolean isEmpty() {
9862      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(doNotPerform, type, subject, intent, linkId,
9863          status, context, contextLinkId, occurrence, requester, requesterLinkId, performerType, performerRole,
9864          performer, performerLinkId, reasonCode, reasonReference, reason, reasonLinkId, note, securityLabelNumber);
9865    }
9866
9867    public String fhirType() {
9868      return "Contract.term.action";
9869
9870    }
9871
9872  }
9873
9874  @Block()
9875  public static class ActionSubjectComponent extends BackboneElement implements IBaseBackboneElement {
9876    /**
9877     * The entity the action is performed or not performed on or for.
9878     */
9879    @Child(name = "reference", type = { Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class,
9880        Device.class, Group.class,
9881        Organization.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9882    @Description(shortDefinition = "Entity of the action", formalDefinition = "The entity the action is performed or not performed on or for.")
9883    protected List<Reference> reference;
9884    /**
9885     * The actual objects that are the target of the reference (The entity the
9886     * action is performed or not performed on or for.)
9887     */
9888    protected List<Resource> referenceTarget;
9889
9890    /**
9891     * Role type of agent assigned roles in this Contract.
9892     */
9893    @Child(name = "role", type = {
9894        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
9895    @Description(shortDefinition = "Role type of the agent", formalDefinition = "Role type of agent assigned roles in this Contract.")
9896    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-actorrole")
9897    protected CodeableConcept role;
9898
9899    private static final long serialVersionUID = 128949255L;
9900
9901    /**
9902     * Constructor
9903     */
9904    public ActionSubjectComponent() {
9905      super();
9906    }
9907
9908    /**
9909     * @return {@link #reference} (The entity the action is performed or not
9910     *         performed on or for.)
9911     */
9912    public List<Reference> getReference() {
9913      if (this.reference == null)
9914        this.reference = new ArrayList<Reference>();
9915      return this.reference;
9916    }
9917
9918    /**
9919     * @return Returns a reference to <code>this</code> for easy method chaining
9920     */
9921    public ActionSubjectComponent setReference(List<Reference> theReference) {
9922      this.reference = theReference;
9923      return this;
9924    }
9925
9926    public boolean hasReference() {
9927      if (this.reference == null)
9928        return false;
9929      for (Reference item : this.reference)
9930        if (!item.isEmpty())
9931          return true;
9932      return false;
9933    }
9934
9935    public Reference addReference() { // 3
9936      Reference t = new Reference();
9937      if (this.reference == null)
9938        this.reference = new ArrayList<Reference>();
9939      this.reference.add(t);
9940      return t;
9941    }
9942
9943    public ActionSubjectComponent addReference(Reference t) { // 3
9944      if (t == null)
9945        return this;
9946      if (this.reference == null)
9947        this.reference = new ArrayList<Reference>();
9948      this.reference.add(t);
9949      return this;
9950    }
9951
9952    /**
9953     * @return The first repetition of repeating field {@link #reference}, creating
9954     *         it if it does not already exist
9955     */
9956    public Reference getReferenceFirstRep() {
9957      if (getReference().isEmpty()) {
9958        addReference();
9959      }
9960      return getReference().get(0);
9961    }
9962
9963    /**
9964     * @deprecated Use Reference#setResource(IBaseResource) instead
9965     */
9966    @Deprecated
9967    public List<Resource> getReferenceTarget() {
9968      if (this.referenceTarget == null)
9969        this.referenceTarget = new ArrayList<Resource>();
9970      return this.referenceTarget;
9971    }
9972
9973    /**
9974     * @return {@link #role} (Role type of agent assigned roles in this Contract.)
9975     */
9976    public CodeableConcept getRole() {
9977      if (this.role == null)
9978        if (Configuration.errorOnAutoCreate())
9979          throw new Error("Attempt to auto-create ActionSubjectComponent.role");
9980        else if (Configuration.doAutoCreate())
9981          this.role = new CodeableConcept(); // cc
9982      return this.role;
9983    }
9984
9985    public boolean hasRole() {
9986      return this.role != null && !this.role.isEmpty();
9987    }
9988
9989    /**
9990     * @param value {@link #role} (Role type of agent assigned roles in this
9991     *              Contract.)
9992     */
9993    public ActionSubjectComponent setRole(CodeableConcept value) {
9994      this.role = value;
9995      return this;
9996    }
9997
9998    protected void listChildren(List<Property> children) {
9999      super.listChildren(children);
10000      children.add(new Property("reference",
10001          "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
10002          "The entity the action is performed or not performed on or for.", 0, java.lang.Integer.MAX_VALUE, reference));
10003      children.add(
10004          new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role));
10005    }
10006
10007    @Override
10008    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10009      switch (_hash) {
10010      case -925155509:
10011        /* reference */ return new Property("reference",
10012            "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
10013            "The entity the action is performed or not performed on or for.", 0, java.lang.Integer.MAX_VALUE,
10014            reference);
10015      case 3506294:
10016        /* role */ return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.",
10017            0, 1, role);
10018      default:
10019        return super.getNamedProperty(_hash, _name, _checkValid);
10020      }
10021
10022    }
10023
10024    @Override
10025    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10026      switch (hash) {
10027      case -925155509:
10028        /* reference */ return this.reference == null ? new Base[0]
10029            : this.reference.toArray(new Base[this.reference.size()]); // Reference
10030      case 3506294:
10031        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
10032      default:
10033        return super.getProperty(hash, name, checkValid);
10034      }
10035
10036    }
10037
10038    @Override
10039    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10040      switch (hash) {
10041      case -925155509: // reference
10042        this.getReference().add(castToReference(value)); // Reference
10043        return value;
10044      case 3506294: // role
10045        this.role = castToCodeableConcept(value); // CodeableConcept
10046        return value;
10047      default:
10048        return super.setProperty(hash, name, value);
10049      }
10050
10051    }
10052
10053    @Override
10054    public Base setProperty(String name, Base value) throws FHIRException {
10055      if (name.equals("reference")) {
10056        this.getReference().add(castToReference(value));
10057      } else if (name.equals("role")) {
10058        this.role = castToCodeableConcept(value); // CodeableConcept
10059      } else
10060        return super.setProperty(name, value);
10061      return value;
10062    }
10063
10064    @Override
10065    public Base makeProperty(int hash, String name) throws FHIRException {
10066      switch (hash) {
10067      case -925155509:
10068        return addReference();
10069      case 3506294:
10070        return getRole();
10071      default:
10072        return super.makeProperty(hash, name);
10073      }
10074
10075    }
10076
10077    @Override
10078    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10079      switch (hash) {
10080      case -925155509:
10081        /* reference */ return new String[] { "Reference" };
10082      case 3506294:
10083        /* role */ return new String[] { "CodeableConcept" };
10084      default:
10085        return super.getTypesForProperty(hash, name);
10086      }
10087
10088    }
10089
10090    @Override
10091    public Base addChild(String name) throws FHIRException {
10092      if (name.equals("reference")) {
10093        return addReference();
10094      } else if (name.equals("role")) {
10095        this.role = new CodeableConcept();
10096        return this.role;
10097      } else
10098        return super.addChild(name);
10099    }
10100
10101    public ActionSubjectComponent copy() {
10102      ActionSubjectComponent dst = new ActionSubjectComponent();
10103      copyValues(dst);
10104      return dst;
10105    }
10106
10107    public void copyValues(ActionSubjectComponent dst) {
10108      super.copyValues(dst);
10109      if (reference != null) {
10110        dst.reference = new ArrayList<Reference>();
10111        for (Reference i : reference)
10112          dst.reference.add(i.copy());
10113      }
10114      ;
10115      dst.role = role == null ? null : role.copy();
10116    }
10117
10118    @Override
10119    public boolean equalsDeep(Base other_) {
10120      if (!super.equalsDeep(other_))
10121        return false;
10122      if (!(other_ instanceof ActionSubjectComponent))
10123        return false;
10124      ActionSubjectComponent o = (ActionSubjectComponent) other_;
10125      return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
10126    }
10127
10128    @Override
10129    public boolean equalsShallow(Base other_) {
10130      if (!super.equalsShallow(other_))
10131        return false;
10132      if (!(other_ instanceof ActionSubjectComponent))
10133        return false;
10134      ActionSubjectComponent o = (ActionSubjectComponent) other_;
10135      return true;
10136    }
10137
10138    public boolean isEmpty() {
10139      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
10140    }
10141
10142    public String fhirType() {
10143      return "Contract.term.action.subject";
10144
10145    }
10146
10147  }
10148
10149  @Block()
10150  public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
10151    /**
10152     * Role of this Contract signer, e.g. notary, grantee.
10153     */
10154    @Child(name = "type", type = { Coding.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10155    @Description(shortDefinition = "Contract Signatory Role", formalDefinition = "Role of this Contract signer, e.g. notary, grantee.")
10156    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-signer-type")
10157    protected Coding type;
10158
10159    /**
10160     * Party which is a signator to this Contract.
10161     */
10162    @Child(name = "party", type = { Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
10163        RelatedPerson.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
10164    @Description(shortDefinition = "Contract Signatory Party", formalDefinition = "Party which is a signator to this Contract.")
10165    protected Reference party;
10166
10167    /**
10168     * The actual object that is the target of the reference (Party which is a
10169     * signator to this Contract.)
10170     */
10171    protected Resource partyTarget;
10172
10173    /**
10174     * Legally binding Contract DSIG signature contents in Base64.
10175     */
10176    @Child(name = "signature", type = {
10177        Signature.class }, order = 3, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10178    @Description(shortDefinition = "Contract Documentation Signature", formalDefinition = "Legally binding Contract DSIG signature contents in Base64.")
10179    protected List<Signature> signature;
10180
10181    private static final long serialVersionUID = 1948139228L;
10182
10183    /**
10184     * Constructor
10185     */
10186    public SignatoryComponent() {
10187      super();
10188    }
10189
10190    /**
10191     * Constructor
10192     */
10193    public SignatoryComponent(Coding type, Reference party) {
10194      super();
10195      this.type = type;
10196      this.party = party;
10197    }
10198
10199    /**
10200     * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
10201     */
10202    public Coding getType() {
10203      if (this.type == null)
10204        if (Configuration.errorOnAutoCreate())
10205          throw new Error("Attempt to auto-create SignatoryComponent.type");
10206        else if (Configuration.doAutoCreate())
10207          this.type = new Coding(); // cc
10208      return this.type;
10209    }
10210
10211    public boolean hasType() {
10212      return this.type != null && !this.type.isEmpty();
10213    }
10214
10215    /**
10216     * @param value {@link #type} (Role of this Contract signer, e.g. notary,
10217     *              grantee.)
10218     */
10219    public SignatoryComponent setType(Coding value) {
10220      this.type = value;
10221      return this;
10222    }
10223
10224    /**
10225     * @return {@link #party} (Party which is a signator to this Contract.)
10226     */
10227    public Reference getParty() {
10228      if (this.party == null)
10229        if (Configuration.errorOnAutoCreate())
10230          throw new Error("Attempt to auto-create SignatoryComponent.party");
10231        else if (Configuration.doAutoCreate())
10232          this.party = new Reference(); // cc
10233      return this.party;
10234    }
10235
10236    public boolean hasParty() {
10237      return this.party != null && !this.party.isEmpty();
10238    }
10239
10240    /**
10241     * @param value {@link #party} (Party which is a signator to this Contract.)
10242     */
10243    public SignatoryComponent setParty(Reference value) {
10244      this.party = value;
10245      return this;
10246    }
10247
10248    /**
10249     * @return {@link #party} The actual object that is the target of the reference.
10250     *         The reference library doesn't populate this, but you can use it to
10251     *         hold the resource if you resolve it. (Party which is a signator to
10252     *         this Contract.)
10253     */
10254    public Resource getPartyTarget() {
10255      return this.partyTarget;
10256    }
10257
10258    /**
10259     * @param value {@link #party} The actual object that is the target of the
10260     *              reference. The reference library doesn't use these, but you can
10261     *              use it to hold the resource if you resolve it. (Party which is a
10262     *              signator to this Contract.)
10263     */
10264    public SignatoryComponent setPartyTarget(Resource value) {
10265      this.partyTarget = value;
10266      return this;
10267    }
10268
10269    /**
10270     * @return {@link #signature} (Legally binding Contract DSIG signature contents
10271     *         in Base64.)
10272     */
10273    public List<Signature> getSignature() {
10274      if (this.signature == null)
10275        this.signature = new ArrayList<Signature>();
10276      return this.signature;
10277    }
10278
10279    /**
10280     * @return Returns a reference to <code>this</code> for easy method chaining
10281     */
10282    public SignatoryComponent setSignature(List<Signature> theSignature) {
10283      this.signature = theSignature;
10284      return this;
10285    }
10286
10287    public boolean hasSignature() {
10288      if (this.signature == null)
10289        return false;
10290      for (Signature item : this.signature)
10291        if (!item.isEmpty())
10292          return true;
10293      return false;
10294    }
10295
10296    public Signature addSignature() { // 3
10297      Signature t = new Signature();
10298      if (this.signature == null)
10299        this.signature = new ArrayList<Signature>();
10300      this.signature.add(t);
10301      return t;
10302    }
10303
10304    public SignatoryComponent addSignature(Signature t) { // 3
10305      if (t == null)
10306        return this;
10307      if (this.signature == null)
10308        this.signature = new ArrayList<Signature>();
10309      this.signature.add(t);
10310      return this;
10311    }
10312
10313    /**
10314     * @return The first repetition of repeating field {@link #signature}, creating
10315     *         it if it does not already exist
10316     */
10317    public Signature getSignatureFirstRep() {
10318      if (getSignature().isEmpty()) {
10319        addSignature();
10320      }
10321      return getSignature().get(0);
10322    }
10323
10324    protected void listChildren(List<Property> children) {
10325      super.listChildren(children);
10326      children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
10327      children.add(new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
10328          "Party which is a signator to this Contract.", 0, 1, party));
10329      children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.",
10330          0, java.lang.Integer.MAX_VALUE, signature));
10331    }
10332
10333    @Override
10334    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10335      switch (_hash) {
10336      case 3575610:
10337        /* type */ return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1,
10338            type);
10339      case 106437350:
10340        /* party */ return new Property("party",
10341            "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
10342            "Party which is a signator to this Contract.", 0, 1, party);
10343      case 1073584312:
10344        /* signature */ return new Property("signature", "Signature",
10345            "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
10346      default:
10347        return super.getNamedProperty(_hash, _name, _checkValid);
10348      }
10349
10350    }
10351
10352    @Override
10353    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10354      switch (hash) {
10355      case 3575610:
10356        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Coding
10357      case 106437350:
10358        /* party */ return this.party == null ? new Base[0] : new Base[] { this.party }; // Reference
10359      case 1073584312:
10360        /* signature */ return this.signature == null ? new Base[0]
10361            : this.signature.toArray(new Base[this.signature.size()]); // Signature
10362      default:
10363        return super.getProperty(hash, name, checkValid);
10364      }
10365
10366    }
10367
10368    @Override
10369    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10370      switch (hash) {
10371      case 3575610: // type
10372        this.type = castToCoding(value); // Coding
10373        return value;
10374      case 106437350: // party
10375        this.party = castToReference(value); // Reference
10376        return value;
10377      case 1073584312: // signature
10378        this.getSignature().add(castToSignature(value)); // Signature
10379        return value;
10380      default:
10381        return super.setProperty(hash, name, value);
10382      }
10383
10384    }
10385
10386    @Override
10387    public Base setProperty(String name, Base value) throws FHIRException {
10388      if (name.equals("type")) {
10389        this.type = castToCoding(value); // Coding
10390      } else if (name.equals("party")) {
10391        this.party = castToReference(value); // Reference
10392      } else if (name.equals("signature")) {
10393        this.getSignature().add(castToSignature(value));
10394      } else
10395        return super.setProperty(name, value);
10396      return value;
10397    }
10398
10399    @Override
10400    public Base makeProperty(int hash, String name) throws FHIRException {
10401      switch (hash) {
10402      case 3575610:
10403        return getType();
10404      case 106437350:
10405        return getParty();
10406      case 1073584312:
10407        return addSignature();
10408      default:
10409        return super.makeProperty(hash, name);
10410      }
10411
10412    }
10413
10414    @Override
10415    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10416      switch (hash) {
10417      case 3575610:
10418        /* type */ return new String[] { "Coding" };
10419      case 106437350:
10420        /* party */ return new String[] { "Reference" };
10421      case 1073584312:
10422        /* signature */ return new String[] { "Signature" };
10423      default:
10424        return super.getTypesForProperty(hash, name);
10425      }
10426
10427    }
10428
10429    @Override
10430    public Base addChild(String name) throws FHIRException {
10431      if (name.equals("type")) {
10432        this.type = new Coding();
10433        return this.type;
10434      } else if (name.equals("party")) {
10435        this.party = new Reference();
10436        return this.party;
10437      } else if (name.equals("signature")) {
10438        return addSignature();
10439      } else
10440        return super.addChild(name);
10441    }
10442
10443    public SignatoryComponent copy() {
10444      SignatoryComponent dst = new SignatoryComponent();
10445      copyValues(dst);
10446      return dst;
10447    }
10448
10449    public void copyValues(SignatoryComponent dst) {
10450      super.copyValues(dst);
10451      dst.type = type == null ? null : type.copy();
10452      dst.party = party == null ? null : party.copy();
10453      if (signature != null) {
10454        dst.signature = new ArrayList<Signature>();
10455        for (Signature i : signature)
10456          dst.signature.add(i.copy());
10457      }
10458      ;
10459    }
10460
10461    @Override
10462    public boolean equalsDeep(Base other_) {
10463      if (!super.equalsDeep(other_))
10464        return false;
10465      if (!(other_ instanceof SignatoryComponent))
10466        return false;
10467      SignatoryComponent o = (SignatoryComponent) other_;
10468      return compareDeep(type, o.type, true) && compareDeep(party, o.party, true)
10469          && compareDeep(signature, o.signature, true);
10470    }
10471
10472    @Override
10473    public boolean equalsShallow(Base other_) {
10474      if (!super.equalsShallow(other_))
10475        return false;
10476      if (!(other_ instanceof SignatoryComponent))
10477        return false;
10478      SignatoryComponent o = (SignatoryComponent) other_;
10479      return true;
10480    }
10481
10482    public boolean isEmpty() {
10483      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
10484    }
10485
10486    public String fhirType() {
10487      return "Contract.signer";
10488
10489    }
10490
10491  }
10492
10493  @Block()
10494  public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
10495    /**
10496     * Human readable rendering of this Contract in a format and representation
10497     * intended to enhance comprehension and ensure understandability.
10498     */
10499    @Child(name = "content", type = { Attachment.class, Composition.class, DocumentReference.class,
10500        QuestionnaireResponse.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10501    @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.")
10502    protected Type content;
10503
10504    private static final long serialVersionUID = -1763459053L;
10505
10506    /**
10507     * Constructor
10508     */
10509    public FriendlyLanguageComponent() {
10510      super();
10511    }
10512
10513    /**
10514     * Constructor
10515     */
10516    public FriendlyLanguageComponent(Type content) {
10517      super();
10518      this.content = content;
10519    }
10520
10521    /**
10522     * @return {@link #content} (Human readable rendering of this Contract in a
10523     *         format and representation intended to enhance comprehension and
10524     *         ensure understandability.)
10525     */
10526    public Type getContent() {
10527      return this.content;
10528    }
10529
10530    /**
10531     * @return {@link #content} (Human readable rendering of this Contract in a
10532     *         format and representation intended to enhance comprehension and
10533     *         ensure understandability.)
10534     */
10535    public Attachment getContentAttachment() throws FHIRException {
10536      if (this.content == null)
10537        this.content = new Attachment();
10538      if (!(this.content instanceof Attachment))
10539        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
10540            + this.content.getClass().getName() + " was encountered");
10541      return (Attachment) this.content;
10542    }
10543
10544    public boolean hasContentAttachment() {
10545      return this != null && this.content instanceof Attachment;
10546    }
10547
10548    /**
10549     * @return {@link #content} (Human readable rendering of this Contract in a
10550     *         format and representation intended to enhance comprehension and
10551     *         ensure understandability.)
10552     */
10553    public Reference getContentReference() throws FHIRException {
10554      if (this.content == null)
10555        this.content = new Reference();
10556      if (!(this.content instanceof Reference))
10557        throw new FHIRException("Type mismatch: the type Reference was expected, but "
10558            + this.content.getClass().getName() + " was encountered");
10559      return (Reference) this.content;
10560    }
10561
10562    public boolean hasContentReference() {
10563      return this != null && this.content instanceof Reference;
10564    }
10565
10566    public boolean hasContent() {
10567      return this.content != null && !this.content.isEmpty();
10568    }
10569
10570    /**
10571     * @param value {@link #content} (Human readable rendering of this Contract in a
10572     *              format and representation intended to enhance comprehension and
10573     *              ensure understandability.)
10574     */
10575    public FriendlyLanguageComponent setContent(Type value) {
10576      if (value != null && !(value instanceof Attachment || value instanceof Reference))
10577        throw new Error("Not the right type for Contract.friendly.content[x]: " + value.fhirType());
10578      this.content = value;
10579      return this;
10580    }
10581
10582    protected void listChildren(List<Property> children) {
10583      super.listChildren(children);
10584      children.add(new Property("content[x]",
10585          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10586          "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10587          0, 1, content));
10588    }
10589
10590    @Override
10591    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10592      switch (_hash) {
10593      case 264548711:
10594        /* content[x] */ return new Property("content[x]",
10595            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10596            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10597            0, 1, content);
10598      case 951530617:
10599        /* content */ return new Property("content[x]",
10600            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10601            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10602            0, 1, content);
10603      case -702028164:
10604        /* contentAttachment */ return new Property("content[x]",
10605            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10606            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10607            0, 1, content);
10608      case 1193747154:
10609        /* contentReference */ return new Property("content[x]",
10610            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10611            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10612            0, 1, content);
10613      default:
10614        return super.getNamedProperty(_hash, _name, _checkValid);
10615      }
10616
10617    }
10618
10619    @Override
10620    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10621      switch (hash) {
10622      case 951530617:
10623        /* content */ return this.content == null ? new Base[0] : new Base[] { this.content }; // Type
10624      default:
10625        return super.getProperty(hash, name, checkValid);
10626      }
10627
10628    }
10629
10630    @Override
10631    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10632      switch (hash) {
10633      case 951530617: // content
10634        this.content = castToType(value); // Type
10635        return value;
10636      default:
10637        return super.setProperty(hash, name, value);
10638      }
10639
10640    }
10641
10642    @Override
10643    public Base setProperty(String name, Base value) throws FHIRException {
10644      if (name.equals("content[x]")) {
10645        this.content = castToType(value); // Type
10646      } else
10647        return super.setProperty(name, value);
10648      return value;
10649    }
10650
10651    @Override
10652    public Base makeProperty(int hash, String name) throws FHIRException {
10653      switch (hash) {
10654      case 264548711:
10655        return getContent();
10656      case 951530617:
10657        return getContent();
10658      default:
10659        return super.makeProperty(hash, name);
10660      }
10661
10662    }
10663
10664    @Override
10665    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10666      switch (hash) {
10667      case 951530617:
10668        /* content */ return new String[] { "Attachment", "Reference" };
10669      default:
10670        return super.getTypesForProperty(hash, name);
10671      }
10672
10673    }
10674
10675    @Override
10676    public Base addChild(String name) throws FHIRException {
10677      if (name.equals("contentAttachment")) {
10678        this.content = new Attachment();
10679        return this.content;
10680      } else if (name.equals("contentReference")) {
10681        this.content = new Reference();
10682        return this.content;
10683      } else
10684        return super.addChild(name);
10685    }
10686
10687    public FriendlyLanguageComponent copy() {
10688      FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
10689      copyValues(dst);
10690      return dst;
10691    }
10692
10693    public void copyValues(FriendlyLanguageComponent dst) {
10694      super.copyValues(dst);
10695      dst.content = content == null ? null : content.copy();
10696    }
10697
10698    @Override
10699    public boolean equalsDeep(Base other_) {
10700      if (!super.equalsDeep(other_))
10701        return false;
10702      if (!(other_ instanceof FriendlyLanguageComponent))
10703        return false;
10704      FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
10705      return compareDeep(content, o.content, true);
10706    }
10707
10708    @Override
10709    public boolean equalsShallow(Base other_) {
10710      if (!super.equalsShallow(other_))
10711        return false;
10712      if (!(other_ instanceof FriendlyLanguageComponent))
10713        return false;
10714      FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
10715      return true;
10716    }
10717
10718    public boolean isEmpty() {
10719      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
10720    }
10721
10722    public String fhirType() {
10723      return "Contract.friendly";
10724
10725    }
10726
10727  }
10728
10729  @Block()
10730  public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
10731    /**
10732     * Contract legal text in human renderable form.
10733     */
10734    @Child(name = "content", type = { Attachment.class, Composition.class, DocumentReference.class,
10735        QuestionnaireResponse.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10736    @Description(shortDefinition = "Contract Legal Text", formalDefinition = "Contract legal text in human renderable form.")
10737    protected Type content;
10738
10739    private static final long serialVersionUID = -1763459053L;
10740
10741    /**
10742     * Constructor
10743     */
10744    public LegalLanguageComponent() {
10745      super();
10746    }
10747
10748    /**
10749     * Constructor
10750     */
10751    public LegalLanguageComponent(Type content) {
10752      super();
10753      this.content = content;
10754    }
10755
10756    /**
10757     * @return {@link #content} (Contract legal text in human renderable form.)
10758     */
10759    public Type getContent() {
10760      return this.content;
10761    }
10762
10763    /**
10764     * @return {@link #content} (Contract legal text in human renderable form.)
10765     */
10766    public Attachment getContentAttachment() throws FHIRException {
10767      if (this.content == null)
10768        this.content = new Attachment();
10769      if (!(this.content instanceof Attachment))
10770        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
10771            + this.content.getClass().getName() + " was encountered");
10772      return (Attachment) this.content;
10773    }
10774
10775    public boolean hasContentAttachment() {
10776      return this != null && this.content instanceof Attachment;
10777    }
10778
10779    /**
10780     * @return {@link #content} (Contract legal text in human renderable form.)
10781     */
10782    public Reference getContentReference() throws FHIRException {
10783      if (this.content == null)
10784        this.content = new Reference();
10785      if (!(this.content instanceof Reference))
10786        throw new FHIRException("Type mismatch: the type Reference was expected, but "
10787            + this.content.getClass().getName() + " was encountered");
10788      return (Reference) this.content;
10789    }
10790
10791    public boolean hasContentReference() {
10792      return this != null && this.content instanceof Reference;
10793    }
10794
10795    public boolean hasContent() {
10796      return this.content != null && !this.content.isEmpty();
10797    }
10798
10799    /**
10800     * @param value {@link #content} (Contract legal text in human renderable form.)
10801     */
10802    public LegalLanguageComponent setContent(Type value) {
10803      if (value != null && !(value instanceof Attachment || value instanceof Reference))
10804        throw new Error("Not the right type for Contract.legal.content[x]: " + value.fhirType());
10805      this.content = value;
10806      return this;
10807    }
10808
10809    protected void listChildren(List<Property> children) {
10810      super.listChildren(children);
10811      children
10812          .add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10813              "Contract legal text in human renderable form.", 0, 1, content));
10814    }
10815
10816    @Override
10817    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10818      switch (_hash) {
10819      case 264548711:
10820        /* content[x] */ return new Property("content[x]",
10821            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10822            "Contract legal text in human renderable form.", 0, 1, content);
10823      case 951530617:
10824        /* content */ return new Property("content[x]",
10825            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10826            "Contract legal text in human renderable form.", 0, 1, content);
10827      case -702028164:
10828        /* contentAttachment */ return new Property("content[x]",
10829            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10830            "Contract legal text in human renderable form.", 0, 1, content);
10831      case 1193747154:
10832        /* contentReference */ return new Property("content[x]",
10833            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10834            "Contract legal text in human renderable form.", 0, 1, content);
10835      default:
10836        return super.getNamedProperty(_hash, _name, _checkValid);
10837      }
10838
10839    }
10840
10841    @Override
10842    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10843      switch (hash) {
10844      case 951530617:
10845        /* content */ return this.content == null ? new Base[0] : new Base[] { this.content }; // Type
10846      default:
10847        return super.getProperty(hash, name, checkValid);
10848      }
10849
10850    }
10851
10852    @Override
10853    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10854      switch (hash) {
10855      case 951530617: // content
10856        this.content = castToType(value); // Type
10857        return value;
10858      default:
10859        return super.setProperty(hash, name, value);
10860      }
10861
10862    }
10863
10864    @Override
10865    public Base setProperty(String name, Base value) throws FHIRException {
10866      if (name.equals("content[x]")) {
10867        this.content = castToType(value); // Type
10868      } else
10869        return super.setProperty(name, value);
10870      return value;
10871    }
10872
10873    @Override
10874    public Base makeProperty(int hash, String name) throws FHIRException {
10875      switch (hash) {
10876      case 264548711:
10877        return getContent();
10878      case 951530617:
10879        return getContent();
10880      default:
10881        return super.makeProperty(hash, name);
10882      }
10883
10884    }
10885
10886    @Override
10887    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10888      switch (hash) {
10889      case 951530617:
10890        /* content */ return new String[] { "Attachment", "Reference" };
10891      default:
10892        return super.getTypesForProperty(hash, name);
10893      }
10894
10895    }
10896
10897    @Override
10898    public Base addChild(String name) throws FHIRException {
10899      if (name.equals("contentAttachment")) {
10900        this.content = new Attachment();
10901        return this.content;
10902      } else if (name.equals("contentReference")) {
10903        this.content = new Reference();
10904        return this.content;
10905      } else
10906        return super.addChild(name);
10907    }
10908
10909    public LegalLanguageComponent copy() {
10910      LegalLanguageComponent dst = new LegalLanguageComponent();
10911      copyValues(dst);
10912      return dst;
10913    }
10914
10915    public void copyValues(LegalLanguageComponent dst) {
10916      super.copyValues(dst);
10917      dst.content = content == null ? null : content.copy();
10918    }
10919
10920    @Override
10921    public boolean equalsDeep(Base other_) {
10922      if (!super.equalsDeep(other_))
10923        return false;
10924      if (!(other_ instanceof LegalLanguageComponent))
10925        return false;
10926      LegalLanguageComponent o = (LegalLanguageComponent) other_;
10927      return compareDeep(content, o.content, true);
10928    }
10929
10930    @Override
10931    public boolean equalsShallow(Base other_) {
10932      if (!super.equalsShallow(other_))
10933        return false;
10934      if (!(other_ instanceof LegalLanguageComponent))
10935        return false;
10936      LegalLanguageComponent o = (LegalLanguageComponent) other_;
10937      return true;
10938    }
10939
10940    public boolean isEmpty() {
10941      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
10942    }
10943
10944    public String fhirType() {
10945      return "Contract.legal";
10946
10947    }
10948
10949  }
10950
10951  @Block()
10952  public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
10953    /**
10954     * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL,
10955     * SecPal).
10956     */
10957    @Child(name = "content", type = { Attachment.class,
10958        DocumentReference.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10959    @Description(shortDefinition = "Computable Contract Rules", formalDefinition = "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).")
10960    protected Type content;
10961
10962    private static final long serialVersionUID = -1763459053L;
10963
10964    /**
10965     * Constructor
10966     */
10967    public ComputableLanguageComponent() {
10968      super();
10969    }
10970
10971    /**
10972     * Constructor
10973     */
10974    public ComputableLanguageComponent(Type content) {
10975      super();
10976      this.content = content;
10977    }
10978
10979    /**
10980     * @return {@link #content} (Computable Contract conveyed using a policy rule
10981     *         language (e.g. XACML, DKAL, SecPal).)
10982     */
10983    public Type getContent() {
10984      return this.content;
10985    }
10986
10987    /**
10988     * @return {@link #content} (Computable Contract conveyed using a policy rule
10989     *         language (e.g. XACML, DKAL, SecPal).)
10990     */
10991    public Attachment getContentAttachment() throws FHIRException {
10992      if (this.content == null)
10993        this.content = new Attachment();
10994      if (!(this.content instanceof Attachment))
10995        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
10996            + this.content.getClass().getName() + " was encountered");
10997      return (Attachment) this.content;
10998    }
10999
11000    public boolean hasContentAttachment() {
11001      return this != null && this.content instanceof Attachment;
11002    }
11003
11004    /**
11005     * @return {@link #content} (Computable Contract conveyed using a policy rule
11006     *         language (e.g. XACML, DKAL, SecPal).)
11007     */
11008    public Reference getContentReference() throws FHIRException {
11009      if (this.content == null)
11010        this.content = new Reference();
11011      if (!(this.content instanceof Reference))
11012        throw new FHIRException("Type mismatch: the type Reference was expected, but "
11013            + this.content.getClass().getName() + " was encountered");
11014      return (Reference) this.content;
11015    }
11016
11017    public boolean hasContentReference() {
11018      return this != null && this.content instanceof Reference;
11019    }
11020
11021    public boolean hasContent() {
11022      return this.content != null && !this.content.isEmpty();
11023    }
11024
11025    /**
11026     * @param value {@link #content} (Computable Contract conveyed using a policy
11027     *              rule language (e.g. XACML, DKAL, SecPal).)
11028     */
11029    public ComputableLanguageComponent setContent(Type value) {
11030      if (value != null && !(value instanceof Attachment || value instanceof Reference))
11031        throw new Error("Not the right type for Contract.rule.content[x]: " + value.fhirType());
11032      this.content = value;
11033      return this;
11034    }
11035
11036    protected void listChildren(List<Property> children) {
11037      super.listChildren(children);
11038      children.add(new Property("content[x]", "Attachment|Reference(DocumentReference)",
11039          "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content));
11040    }
11041
11042    @Override
11043    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11044      switch (_hash) {
11045      case 264548711:
11046        /* content[x] */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11047            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11048      case 951530617:
11049        /* content */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11050            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11051      case -702028164:
11052        /* contentAttachment */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11053            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11054      case 1193747154:
11055        /* contentReference */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11056            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11057      default:
11058        return super.getNamedProperty(_hash, _name, _checkValid);
11059      }
11060
11061    }
11062
11063    @Override
11064    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11065      switch (hash) {
11066      case 951530617:
11067        /* content */ return this.content == null ? new Base[0] : new Base[] { this.content }; // Type
11068      default:
11069        return super.getProperty(hash, name, checkValid);
11070      }
11071
11072    }
11073
11074    @Override
11075    public Base setProperty(int hash, String name, Base value) throws FHIRException {
11076      switch (hash) {
11077      case 951530617: // content
11078        this.content = castToType(value); // Type
11079        return value;
11080      default:
11081        return super.setProperty(hash, name, value);
11082      }
11083
11084    }
11085
11086    @Override
11087    public Base setProperty(String name, Base value) throws FHIRException {
11088      if (name.equals("content[x]")) {
11089        this.content = castToType(value); // Type
11090      } else
11091        return super.setProperty(name, value);
11092      return value;
11093    }
11094
11095    @Override
11096    public Base makeProperty(int hash, String name) throws FHIRException {
11097      switch (hash) {
11098      case 264548711:
11099        return getContent();
11100      case 951530617:
11101        return getContent();
11102      default:
11103        return super.makeProperty(hash, name);
11104      }
11105
11106    }
11107
11108    @Override
11109    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11110      switch (hash) {
11111      case 951530617:
11112        /* content */ return new String[] { "Attachment", "Reference" };
11113      default:
11114        return super.getTypesForProperty(hash, name);
11115      }
11116
11117    }
11118
11119    @Override
11120    public Base addChild(String name) throws FHIRException {
11121      if (name.equals("contentAttachment")) {
11122        this.content = new Attachment();
11123        return this.content;
11124      } else if (name.equals("contentReference")) {
11125        this.content = new Reference();
11126        return this.content;
11127      } else
11128        return super.addChild(name);
11129    }
11130
11131    public ComputableLanguageComponent copy() {
11132      ComputableLanguageComponent dst = new ComputableLanguageComponent();
11133      copyValues(dst);
11134      return dst;
11135    }
11136
11137    public void copyValues(ComputableLanguageComponent dst) {
11138      super.copyValues(dst);
11139      dst.content = content == null ? null : content.copy();
11140    }
11141
11142    @Override
11143    public boolean equalsDeep(Base other_) {
11144      if (!super.equalsDeep(other_))
11145        return false;
11146      if (!(other_ instanceof ComputableLanguageComponent))
11147        return false;
11148      ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
11149      return compareDeep(content, o.content, true);
11150    }
11151
11152    @Override
11153    public boolean equalsShallow(Base other_) {
11154      if (!super.equalsShallow(other_))
11155        return false;
11156      if (!(other_ instanceof ComputableLanguageComponent))
11157        return false;
11158      ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
11159      return true;
11160    }
11161
11162    public boolean isEmpty() {
11163      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
11164    }
11165
11166    public String fhirType() {
11167      return "Contract.rule";
11168
11169    }
11170
11171  }
11172
11173  /**
11174   * Unique identifier for this Contract or a derivative that references a Source
11175   * Contract.
11176   */
11177  @Child(name = "identifier", type = {
11178      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
11179  @Description(shortDefinition = "Contract number", formalDefinition = "Unique identifier for this Contract or a derivative that references a Source Contract.")
11180  protected List<Identifier> identifier;
11181
11182  /**
11183   * Canonical identifier for this contract, represented as a URI (globally
11184   * unique).
11185   */
11186  @Child(name = "url", type = { UriType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
11187  @Description(shortDefinition = "Basal definition", formalDefinition = "Canonical identifier for this contract, represented as a URI (globally unique).")
11188  protected UriType url;
11189
11190  /**
11191   * An edition identifier used for business purposes to label business
11192   * significant variants.
11193   */
11194  @Child(name = "version", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
11195  @Description(shortDefinition = "Business edition", formalDefinition = "An edition identifier used for business purposes to label business significant variants.")
11196  protected StringType version;
11197
11198  /**
11199   * The status of the resource instance.
11200   */
11201  @Child(name = "status", type = { CodeType.class }, order = 3, min = 0, max = 1, modifier = true, summary = true)
11202  @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.")
11203  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-status")
11204  protected Enumeration<ContractStatus> status;
11205
11206  /**
11207   * Legal states of the formation of a legal instrument, which is a formally
11208   * executed written document that can be formally attributed to its author,
11209   * records and formally expresses a legally enforceable act, process, or
11210   * contractual duty, obligation, or right, and therefore evidences that act,
11211   * process, or agreement.
11212   */
11213  @Child(name = "legalState", type = {
11214      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
11215  @Description(shortDefinition = "Negotiation status", formalDefinition = "Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.")
11216  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-legalstate")
11217  protected CodeableConcept legalState;
11218
11219  /**
11220   * The URL pointing to a FHIR-defined Contract Definition that is adhered to in
11221   * whole or part by this Contract.
11222   */
11223  @Child(name = "instantiatesCanonical", type = {
11224      Contract.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
11225  @Description(shortDefinition = "Source Contract Definition", formalDefinition = "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.")
11226  protected Reference instantiatesCanonical;
11227
11228  /**
11229   * The actual object that is the target of the reference (The URL pointing to a
11230   * FHIR-defined Contract Definition that is adhered to in whole or part by this
11231   * Contract.)
11232   */
11233  protected Contract instantiatesCanonicalTarget;
11234
11235  /**
11236   * The URL pointing to an externally maintained definition that is adhered to in
11237   * whole or in part by this Contract.
11238   */
11239  @Child(name = "instantiatesUri", type = {
11240      UriType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
11241  @Description(shortDefinition = "External Contract Definition", formalDefinition = "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.")
11242  protected UriType instantiatesUri;
11243
11244  /**
11245   * The minimal content derived from the basal information source at a specific
11246   * stage in its lifecycle.
11247   */
11248  @Child(name = "contentDerivative", type = {
11249      CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
11250  @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.")
11251  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-content-derivative")
11252  protected CodeableConcept contentDerivative;
11253
11254  /**
11255   * When this Contract was issued.
11256   */
11257  @Child(name = "issued", type = { DateTimeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
11258  @Description(shortDefinition = "When this Contract was issued", formalDefinition = "When this  Contract was issued.")
11259  protected DateTimeType issued;
11260
11261  /**
11262   * Relevant time or time-period when this Contract is applicable.
11263   */
11264  @Child(name = "applies", type = { Period.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
11265  @Description(shortDefinition = "Effective time", formalDefinition = "Relevant time or time-period when this Contract is applicable.")
11266  protected Period applies;
11267
11268  /**
11269   * Event resulting in discontinuation or termination of this Contract instance
11270   * by one or more parties to the contract.
11271   */
11272  @Child(name = "expirationType", type = {
11273      CodeableConcept.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
11274  @Description(shortDefinition = "Contract cessation cause", formalDefinition = "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.")
11275  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-expiration-type")
11276  protected CodeableConcept expirationType;
11277
11278  /**
11279   * The target entity impacted by or of interest to parties to the agreement.
11280   */
11281  @Child(name = "subject", type = {
11282      Reference.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
11283  @Description(shortDefinition = "Contract Target Entity", formalDefinition = "The target entity impacted by or of interest to parties to the agreement.")
11284  protected List<Reference> subject;
11285  /**
11286   * The actual objects that are the target of the reference (The target entity
11287   * impacted by or of interest to parties to the agreement.)
11288   */
11289  protected List<Resource> subjectTarget;
11290
11291  /**
11292   * A formally or informally recognized grouping of people, principals,
11293   * organizations, or jurisdictions formed for the purpose of achieving some form
11294   * of collective action such as the promulgation, administration and enforcement
11295   * of contracts and policies.
11296   */
11297  @Child(name = "authority", type = {
11298      Organization.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11299  @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.")
11300  protected List<Reference> authority;
11301  /**
11302   * The actual objects that are the target of the reference (A formally or
11303   * informally recognized grouping of people, principals, organizations, or
11304   * jurisdictions formed for the purpose of achieving some form of collective
11305   * action such as the promulgation, administration and enforcement of contracts
11306   * and policies.)
11307   */
11308  protected List<Organization> authorityTarget;
11309
11310  /**
11311   * Recognized governance framework or system operating with a circumscribed
11312   * scope in accordance with specified principles, policies, processes or
11313   * procedures for managing rights, actions, or behaviors of parties or
11314   * principals relative to resources.
11315   */
11316  @Child(name = "domain", type = {
11317      Location.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11318  @Description(shortDefinition = "A sphere of control governed by an authoritative jurisdiction, organization, or person", 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.")
11319  protected List<Reference> domain;
11320  /**
11321   * The actual objects that are the target of the reference (Recognized
11322   * governance framework or system operating with a circumscribed scope in
11323   * accordance with specified principles, policies, processes or procedures for
11324   * managing rights, actions, or behaviors of parties or principals relative to
11325   * resources.)
11326   */
11327  protected List<Location> domainTarget;
11328
11329  /**
11330   * Sites in which the contract is complied with, exercised, or in force.
11331   */
11332  @Child(name = "site", type = {
11333      Location.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11334  @Description(shortDefinition = "Specific Location", formalDefinition = "Sites in which the contract is complied with,  exercised, or in force.")
11335  protected List<Reference> site;
11336  /**
11337   * The actual objects that are the target of the reference (Sites in which the
11338   * contract is complied with, exercised, or in force.)
11339   */
11340  protected List<Location> siteTarget;
11341
11342  /**
11343   * A natural language name identifying this Contract definition, derivative, or
11344   * instance in any legal state. Provides additional information about its
11345   * content. This name should be usable as an identifier for the module by
11346   * machine processing applications such as code generation.
11347   */
11348  @Child(name = "name", type = { StringType.class }, order = 15, min = 0, max = 1, modifier = false, summary = true)
11349  @Description(shortDefinition = "Computer friendly designation", formalDefinition = "A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.")
11350  protected StringType name;
11351
11352  /**
11353   * A short, descriptive, user-friendly title for this Contract definition,
11354   * derivative, or instance in any legal state.t giving additional information
11355   * about its content.
11356   */
11357  @Child(name = "title", type = { StringType.class }, order = 16, min = 0, max = 1, modifier = false, summary = true)
11358  @Description(shortDefinition = "Human Friendly name", formalDefinition = "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.")
11359  protected StringType title;
11360
11361  /**
11362   * An explanatory or alternate user-friendly title for this Contract definition,
11363   * derivative, or instance in any legal state.t giving additional information
11364   * about its content.
11365   */
11366  @Child(name = "subtitle", type = {
11367      StringType.class }, order = 17, min = 0, max = 1, modifier = false, summary = false)
11368  @Description(shortDefinition = "Subordinate Friendly name", formalDefinition = "An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.")
11369  protected StringType subtitle;
11370
11371  /**
11372   * Alternative representation of the title for this Contract definition,
11373   * derivative, or instance in any legal state., e.g., a domain specific contract
11374   * number related to legislation.
11375   */
11376  @Child(name = "alias", type = {
11377      StringType.class }, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11378  @Description(shortDefinition = "Acronym or short name", formalDefinition = "Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.")
11379  protected List<StringType> alias;
11380
11381  /**
11382   * The individual or organization that authored the Contract definition,
11383   * derivative, or instance in any legal state.
11384   */
11385  @Child(name = "author", type = { Patient.class, Practitioner.class, PractitionerRole.class,
11386      Organization.class }, order = 19, min = 0, max = 1, modifier = false, summary = false)
11387  @Description(shortDefinition = "Source of Contract", formalDefinition = "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.")
11388  protected Reference author;
11389
11390  /**
11391   * The actual object that is the target of the reference (The individual or
11392   * organization that authored the Contract definition, derivative, or instance
11393   * in any legal state.)
11394   */
11395  protected Resource authorTarget;
11396
11397  /**
11398   * A selector of legal concerns for this Contract definition, derivative, or
11399   * instance in any legal state.
11400   */
11401  @Child(name = "scope", type = {
11402      CodeableConcept.class }, order = 20, min = 0, max = 1, modifier = false, summary = false)
11403  @Description(shortDefinition = "Range of Legal Concerns", formalDefinition = "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.")
11404  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-scope")
11405  protected CodeableConcept scope;
11406
11407  /**
11408   * Narrows the range of legal concerns to focus on the achievement of specific
11409   * contractual objectives.
11410   */
11411  @Child(name = "topic", type = { CodeableConcept.class,
11412      Reference.class }, order = 21, min = 0, max = 1, modifier = false, summary = false)
11413  @Description(shortDefinition = "Focus of contract interest", formalDefinition = "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.")
11414  protected Type topic;
11415
11416  /**
11417   * A high-level category for the legal instrument, whether constructed as a
11418   * Contract definition, derivative, or instance in any legal state. Provides
11419   * additional information about its content within the context of the Contract's
11420   * scope to distinguish the kinds of systems that would be interested in the
11421   * contract.
11422   */
11423  @Child(name = "type", type = {
11424      CodeableConcept.class }, order = 22, min = 0, max = 1, modifier = false, summary = true)
11425  @Description(shortDefinition = "Legal instrument category", formalDefinition = "A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.")
11426  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-type")
11427  protected CodeableConcept type;
11428
11429  /**
11430   * Sub-category for the Contract that distinguishes the kinds of systems that
11431   * would be interested in the Contract within the context of the Contract's
11432   * scope.
11433   */
11434  @Child(name = "subType", type = {
11435      CodeableConcept.class }, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
11436  @Description(shortDefinition = "Subtype within the context of type", formalDefinition = "Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.")
11437  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-subtype")
11438  protected List<CodeableConcept> subType;
11439
11440  /**
11441   * Precusory content developed with a focus and intent of supporting the
11442   * formation a Contract instance, which may be associated with and transformable
11443   * into a Contract.
11444   */
11445  @Child(name = "contentDefinition", type = {}, order = 24, min = 0, max = 1, modifier = false, summary = false)
11446  @Description(shortDefinition = "Contract precursor content", formalDefinition = "Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.")
11447  protected ContentDefinitionComponent contentDefinition;
11448
11449  /**
11450   * One or more Contract Provisions, which may be related and conveyed as a
11451   * group, and may contain nested groups.
11452   */
11453  @Child(name = "term", type = {}, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11454  @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.")
11455  protected List<TermComponent> term;
11456
11457  /**
11458   * Information that may be needed by/relevant to the performer in their
11459   * execution of this term action.
11460   */
11461  @Child(name = "supportingInfo", type = {
11462      Reference.class }, order = 26, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11463  @Description(shortDefinition = "Extra Information", formalDefinition = "Information that may be needed by/relevant to the performer in their execution of this term action.")
11464  protected List<Reference> supportingInfo;
11465  /**
11466   * The actual objects that are the target of the reference (Information that may
11467   * be needed by/relevant to the performer in their execution of this term
11468   * action.)
11469   */
11470  protected List<Resource> supportingInfoTarget;
11471
11472  /**
11473   * Links to Provenance records for past versions of this Contract definition,
11474   * derivative, or instance, which identify key state transitions or updates that
11475   * are likely to be relevant to a user looking at the current version of the
11476   * Contract. The Provence.entity indicates the target that was changed in the
11477   * update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.
11478   */
11479  @Child(name = "relevantHistory", type = {
11480      Provenance.class }, order = 27, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11481  @Description(shortDefinition = "Key event in Contract History", formalDefinition = "Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.")
11482  protected List<Reference> relevantHistory;
11483  /**
11484   * The actual objects that are the target of the reference (Links to Provenance
11485   * records for past versions of this Contract definition, derivative, or
11486   * instance, which identify key state transitions or updates that are likely to
11487   * be relevant to a user looking at the current version of the Contract. The
11488   * Provence.entity indicates the target that was changed in the update.
11489   * http://build.fhir.org/provenance-definitions.html#Provenance.entity.)
11490   */
11491  protected List<Provenance> relevantHistoryTarget;
11492
11493  /**
11494   * Parties with legal standing in the Contract, including the principal parties,
11495   * the grantor(s) and grantee(s), which are any person or organization bound by
11496   * the contract, and any ancillary parties, which facilitate the execution of
11497   * the contract such as a notary or witness.
11498   */
11499  @Child(name = "signer", type = {}, order = 28, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11500  @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.")
11501  protected List<SignatoryComponent> signer;
11502
11503  /**
11504   * The "patient friendly language" versionof the Contract in whole or in parts.
11505   * "Patient friendly language" means the representation of the Contract and
11506   * Contract Provisions in a manner that is readily accessible and understandable
11507   * by a layperson in accordance with best practices for communication styles
11508   * that ensure that those agreeing to or signing the Contract understand the
11509   * roles, actions, obligations, responsibilities, and implication of the
11510   * agreement.
11511   */
11512  @Child(name = "friendly", type = {}, order = 29, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11513  @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.")
11514  protected List<FriendlyLanguageComponent> friendly;
11515
11516  /**
11517   * List of Legal expressions or representations of this Contract.
11518   */
11519  @Child(name = "legal", type = {}, order = 30, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11520  @Description(shortDefinition = "Contract Legal Language", formalDefinition = "List of Legal expressions or representations of this Contract.")
11521  protected List<LegalLanguageComponent> legal;
11522
11523  /**
11524   * List of Computable Policy Rule Language Representations of this Contract.
11525   */
11526  @Child(name = "rule", type = {}, order = 31, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11527  @Description(shortDefinition = "Computable Contract Language", formalDefinition = "List of Computable Policy Rule Language Representations of this Contract.")
11528  protected List<ComputableLanguageComponent> rule;
11529
11530  /**
11531   * Legally binding Contract: This is the signed and legally recognized
11532   * representation of the Contract, which is considered the "source of truth" and
11533   * which would be the basis for legal action related to enforcement of this
11534   * Contract.
11535   */
11536  @Child(name = "legallyBinding", type = { Attachment.class, Composition.class, DocumentReference.class,
11537      QuestionnaireResponse.class, Contract.class }, order = 32, min = 0, max = 1, modifier = false, summary = false)
11538  @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.")
11539  protected Type legallyBinding;
11540
11541  private static final long serialVersionUID = -1388892487L;
11542
11543  /**
11544   * Constructor
11545   */
11546  public Contract() {
11547    super();
11548  }
11549
11550  /**
11551   * @return {@link #identifier} (Unique identifier for this Contract or a
11552   *         derivative that references a Source Contract.)
11553   */
11554  public List<Identifier> getIdentifier() {
11555    if (this.identifier == null)
11556      this.identifier = new ArrayList<Identifier>();
11557    return this.identifier;
11558  }
11559
11560  /**
11561   * @return Returns a reference to <code>this</code> for easy method chaining
11562   */
11563  public Contract setIdentifier(List<Identifier> theIdentifier) {
11564    this.identifier = theIdentifier;
11565    return this;
11566  }
11567
11568  public boolean hasIdentifier() {
11569    if (this.identifier == null)
11570      return false;
11571    for (Identifier item : this.identifier)
11572      if (!item.isEmpty())
11573        return true;
11574    return false;
11575  }
11576
11577  public Identifier addIdentifier() { // 3
11578    Identifier t = new Identifier();
11579    if (this.identifier == null)
11580      this.identifier = new ArrayList<Identifier>();
11581    this.identifier.add(t);
11582    return t;
11583  }
11584
11585  public Contract addIdentifier(Identifier t) { // 3
11586    if (t == null)
11587      return this;
11588    if (this.identifier == null)
11589      this.identifier = new ArrayList<Identifier>();
11590    this.identifier.add(t);
11591    return this;
11592  }
11593
11594  /**
11595   * @return The first repetition of repeating field {@link #identifier}, creating
11596   *         it if it does not already exist
11597   */
11598  public Identifier getIdentifierFirstRep() {
11599    if (getIdentifier().isEmpty()) {
11600      addIdentifier();
11601    }
11602    return getIdentifier().get(0);
11603  }
11604
11605  /**
11606   * @return {@link #url} (Canonical identifier for this contract, represented as
11607   *         a URI (globally unique).). This is the underlying object with id,
11608   *         value and extensions. The accessor "getUrl" gives direct access to
11609   *         the value
11610   */
11611  public UriType getUrlElement() {
11612    if (this.url == null)
11613      if (Configuration.errorOnAutoCreate())
11614        throw new Error("Attempt to auto-create Contract.url");
11615      else if (Configuration.doAutoCreate())
11616        this.url = new UriType(); // bb
11617    return this.url;
11618  }
11619
11620  public boolean hasUrlElement() {
11621    return this.url != null && !this.url.isEmpty();
11622  }
11623
11624  public boolean hasUrl() {
11625    return this.url != null && !this.url.isEmpty();
11626  }
11627
11628  /**
11629   * @param value {@link #url} (Canonical identifier for this contract,
11630   *              represented as a URI (globally unique).). This is the underlying
11631   *              object with id, value and extensions. The accessor "getUrl"
11632   *              gives direct access to the value
11633   */
11634  public Contract setUrlElement(UriType value) {
11635    this.url = value;
11636    return this;
11637  }
11638
11639  /**
11640   * @return Canonical identifier for this contract, represented as a URI
11641   *         (globally unique).
11642   */
11643  public String getUrl() {
11644    return this.url == null ? null : this.url.getValue();
11645  }
11646
11647  /**
11648   * @param value Canonical identifier for this contract, represented as a URI
11649   *              (globally unique).
11650   */
11651  public Contract setUrl(String value) {
11652    if (Utilities.noString(value))
11653      this.url = null;
11654    else {
11655      if (this.url == null)
11656        this.url = new UriType();
11657      this.url.setValue(value);
11658    }
11659    return this;
11660  }
11661
11662  /**
11663   * @return {@link #version} (An edition identifier used for business purposes to
11664   *         label business significant variants.). This is the underlying object
11665   *         with id, value and extensions. The accessor "getVersion" gives direct
11666   *         access to the value
11667   */
11668  public StringType getVersionElement() {
11669    if (this.version == null)
11670      if (Configuration.errorOnAutoCreate())
11671        throw new Error("Attempt to auto-create Contract.version");
11672      else if (Configuration.doAutoCreate())
11673        this.version = new StringType(); // bb
11674    return this.version;
11675  }
11676
11677  public boolean hasVersionElement() {
11678    return this.version != null && !this.version.isEmpty();
11679  }
11680
11681  public boolean hasVersion() {
11682    return this.version != null && !this.version.isEmpty();
11683  }
11684
11685  /**
11686   * @param value {@link #version} (An edition identifier used for business
11687   *              purposes to label business significant variants.). This is the
11688   *              underlying object with id, value and extensions. The accessor
11689   *              "getVersion" gives direct access to the value
11690   */
11691  public Contract setVersionElement(StringType value) {
11692    this.version = value;
11693    return this;
11694  }
11695
11696  /**
11697   * @return An edition identifier used for business purposes to label business
11698   *         significant variants.
11699   */
11700  public String getVersion() {
11701    return this.version == null ? null : this.version.getValue();
11702  }
11703
11704  /**
11705   * @param value An edition identifier used for business purposes to label
11706   *              business significant variants.
11707   */
11708  public Contract setVersion(String value) {
11709    if (Utilities.noString(value))
11710      this.version = null;
11711    else {
11712      if (this.version == null)
11713        this.version = new StringType();
11714      this.version.setValue(value);
11715    }
11716    return this;
11717  }
11718
11719  /**
11720   * @return {@link #status} (The status of the resource instance.). This is the
11721   *         underlying object with id, value and extensions. The accessor
11722   *         "getStatus" gives direct access to the value
11723   */
11724  public Enumeration<ContractStatus> getStatusElement() {
11725    if (this.status == null)
11726      if (Configuration.errorOnAutoCreate())
11727        throw new Error("Attempt to auto-create Contract.status");
11728      else if (Configuration.doAutoCreate())
11729        this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory()); // bb
11730    return this.status;
11731  }
11732
11733  public boolean hasStatusElement() {
11734    return this.status != null && !this.status.isEmpty();
11735  }
11736
11737  public boolean hasStatus() {
11738    return this.status != null && !this.status.isEmpty();
11739  }
11740
11741  /**
11742   * @param value {@link #status} (The status of the resource instance.). This is
11743   *              the underlying object with id, value and extensions. The
11744   *              accessor "getStatus" gives direct access to the value
11745   */
11746  public Contract setStatusElement(Enumeration<ContractStatus> value) {
11747    this.status = value;
11748    return this;
11749  }
11750
11751  /**
11752   * @return The status of the resource instance.
11753   */
11754  public ContractStatus getStatus() {
11755    return this.status == null ? null : this.status.getValue();
11756  }
11757
11758  /**
11759   * @param value The status of the resource instance.
11760   */
11761  public Contract setStatus(ContractStatus value) {
11762    if (value == null)
11763      this.status = null;
11764    else {
11765      if (this.status == null)
11766        this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory());
11767      this.status.setValue(value);
11768    }
11769    return this;
11770  }
11771
11772  /**
11773   * @return {@link #legalState} (Legal states of the formation of a legal
11774   *         instrument, which is a formally executed written document that can be
11775   *         formally attributed to its author, records and formally expresses a
11776   *         legally enforceable act, process, or contractual duty, obligation, or
11777   *         right, and therefore evidences that act, process, or agreement.)
11778   */
11779  public CodeableConcept getLegalState() {
11780    if (this.legalState == null)
11781      if (Configuration.errorOnAutoCreate())
11782        throw new Error("Attempt to auto-create Contract.legalState");
11783      else if (Configuration.doAutoCreate())
11784        this.legalState = new CodeableConcept(); // cc
11785    return this.legalState;
11786  }
11787
11788  public boolean hasLegalState() {
11789    return this.legalState != null && !this.legalState.isEmpty();
11790  }
11791
11792  /**
11793   * @param value {@link #legalState} (Legal states of the formation of a legal
11794   *              instrument, which is a formally executed written document that
11795   *              can be formally attributed to its author, records and formally
11796   *              expresses a legally enforceable act, process, or contractual
11797   *              duty, obligation, or right, and therefore evidences that act,
11798   *              process, or agreement.)
11799   */
11800  public Contract setLegalState(CodeableConcept value) {
11801    this.legalState = value;
11802    return this;
11803  }
11804
11805  /**
11806   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
11807   *         Contract Definition that is adhered to in whole or part by this
11808   *         Contract.)
11809   */
11810  public Reference getInstantiatesCanonical() {
11811    if (this.instantiatesCanonical == null)
11812      if (Configuration.errorOnAutoCreate())
11813        throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
11814      else if (Configuration.doAutoCreate())
11815        this.instantiatesCanonical = new Reference(); // cc
11816    return this.instantiatesCanonical;
11817  }
11818
11819  public boolean hasInstantiatesCanonical() {
11820    return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
11821  }
11822
11823  /**
11824   * @param value {@link #instantiatesCanonical} (The URL pointing to a
11825   *              FHIR-defined Contract Definition that is adhered to in whole or
11826   *              part by this Contract.)
11827   */
11828  public Contract setInstantiatesCanonical(Reference value) {
11829    this.instantiatesCanonical = value;
11830    return this;
11831  }
11832
11833  /**
11834   * @return {@link #instantiatesCanonical} The actual object that is the target
11835   *         of the reference. The reference library doesn't populate this, but
11836   *         you can use it to hold the resource if you resolve it. (The URL
11837   *         pointing to a FHIR-defined Contract Definition that is adhered to in
11838   *         whole or part by this Contract.)
11839   */
11840  public Contract getInstantiatesCanonicalTarget() {
11841    if (this.instantiatesCanonicalTarget == null)
11842      if (Configuration.errorOnAutoCreate())
11843        throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
11844      else if (Configuration.doAutoCreate())
11845        this.instantiatesCanonicalTarget = new Contract(); // aa
11846    return this.instantiatesCanonicalTarget;
11847  }
11848
11849  /**
11850   * @param value {@link #instantiatesCanonical} The actual object that is the
11851   *              target of the reference. The reference library doesn't use
11852   *              these, but you can use it to hold the resource if you resolve
11853   *              it. (The URL pointing to a FHIR-defined Contract Definition that
11854   *              is adhered to in whole or part by this Contract.)
11855   */
11856  public Contract setInstantiatesCanonicalTarget(Contract value) {
11857    this.instantiatesCanonicalTarget = value;
11858    return this;
11859  }
11860
11861  /**
11862   * @return {@link #instantiatesUri} (The URL pointing to an externally
11863   *         maintained definition that is adhered to in whole or in part by this
11864   *         Contract.). This is the underlying object with id, value and
11865   *         extensions. The accessor "getInstantiatesUri" gives direct access to
11866   *         the value
11867   */
11868  public UriType getInstantiatesUriElement() {
11869    if (this.instantiatesUri == null)
11870      if (Configuration.errorOnAutoCreate())
11871        throw new Error("Attempt to auto-create Contract.instantiatesUri");
11872      else if (Configuration.doAutoCreate())
11873        this.instantiatesUri = new UriType(); // bb
11874    return this.instantiatesUri;
11875  }
11876
11877  public boolean hasInstantiatesUriElement() {
11878    return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
11879  }
11880
11881  public boolean hasInstantiatesUri() {
11882    return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
11883  }
11884
11885  /**
11886   * @param value {@link #instantiatesUri} (The URL pointing to an externally
11887   *              maintained definition that is adhered to in whole or in part by
11888   *              this Contract.). This is the underlying object with id, value
11889   *              and extensions. The accessor "getInstantiatesUri" gives direct
11890   *              access to the value
11891   */
11892  public Contract setInstantiatesUriElement(UriType value) {
11893    this.instantiatesUri = value;
11894    return this;
11895  }
11896
11897  /**
11898   * @return The URL pointing to an externally maintained definition that is
11899   *         adhered to in whole or in part by this Contract.
11900   */
11901  public String getInstantiatesUri() {
11902    return this.instantiatesUri == null ? null : this.instantiatesUri.getValue();
11903  }
11904
11905  /**
11906   * @param value The URL pointing to an externally maintained definition that is
11907   *              adhered to in whole or in part by this Contract.
11908   */
11909  public Contract setInstantiatesUri(String value) {
11910    if (Utilities.noString(value))
11911      this.instantiatesUri = null;
11912    else {
11913      if (this.instantiatesUri == null)
11914        this.instantiatesUri = new UriType();
11915      this.instantiatesUri.setValue(value);
11916    }
11917    return this;
11918  }
11919
11920  /**
11921   * @return {@link #contentDerivative} (The minimal content derived from the
11922   *         basal information source at a specific stage in its lifecycle.)
11923   */
11924  public CodeableConcept getContentDerivative() {
11925    if (this.contentDerivative == null)
11926      if (Configuration.errorOnAutoCreate())
11927        throw new Error("Attempt to auto-create Contract.contentDerivative");
11928      else if (Configuration.doAutoCreate())
11929        this.contentDerivative = new CodeableConcept(); // cc
11930    return this.contentDerivative;
11931  }
11932
11933  public boolean hasContentDerivative() {
11934    return this.contentDerivative != null && !this.contentDerivative.isEmpty();
11935  }
11936
11937  /**
11938   * @param value {@link #contentDerivative} (The minimal content derived from the
11939   *              basal information source at a specific stage in its lifecycle.)
11940   */
11941  public Contract setContentDerivative(CodeableConcept value) {
11942    this.contentDerivative = value;
11943    return this;
11944  }
11945
11946  /**
11947   * @return {@link #issued} (When this Contract was issued.). This is the
11948   *         underlying object with id, value and extensions. The accessor
11949   *         "getIssued" gives direct access to the value
11950   */
11951  public DateTimeType getIssuedElement() {
11952    if (this.issued == null)
11953      if (Configuration.errorOnAutoCreate())
11954        throw new Error("Attempt to auto-create Contract.issued");
11955      else if (Configuration.doAutoCreate())
11956        this.issued = new DateTimeType(); // bb
11957    return this.issued;
11958  }
11959
11960  public boolean hasIssuedElement() {
11961    return this.issued != null && !this.issued.isEmpty();
11962  }
11963
11964  public boolean hasIssued() {
11965    return this.issued != null && !this.issued.isEmpty();
11966  }
11967
11968  /**
11969   * @param value {@link #issued} (When this Contract was issued.). This is the
11970   *              underlying object with id, value and extensions. The accessor
11971   *              "getIssued" gives direct access to the value
11972   */
11973  public Contract setIssuedElement(DateTimeType value) {
11974    this.issued = value;
11975    return this;
11976  }
11977
11978  /**
11979   * @return When this Contract was issued.
11980   */
11981  public Date getIssued() {
11982    return this.issued == null ? null : this.issued.getValue();
11983  }
11984
11985  /**
11986   * @param value When this Contract was issued.
11987   */
11988  public Contract setIssued(Date value) {
11989    if (value == null)
11990      this.issued = null;
11991    else {
11992      if (this.issued == null)
11993        this.issued = new DateTimeType();
11994      this.issued.setValue(value);
11995    }
11996    return this;
11997  }
11998
11999  /**
12000   * @return {@link #applies} (Relevant time or time-period when this Contract is
12001   *         applicable.)
12002   */
12003  public Period getApplies() {
12004    if (this.applies == null)
12005      if (Configuration.errorOnAutoCreate())
12006        throw new Error("Attempt to auto-create Contract.applies");
12007      else if (Configuration.doAutoCreate())
12008        this.applies = new Period(); // cc
12009    return this.applies;
12010  }
12011
12012  public boolean hasApplies() {
12013    return this.applies != null && !this.applies.isEmpty();
12014  }
12015
12016  /**
12017   * @param value {@link #applies} (Relevant time or time-period when this
12018   *              Contract is applicable.)
12019   */
12020  public Contract setApplies(Period value) {
12021    this.applies = value;
12022    return this;
12023  }
12024
12025  /**
12026   * @return {@link #expirationType} (Event resulting in discontinuation or
12027   *         termination of this Contract instance by one or more parties to the
12028   *         contract.)
12029   */
12030  public CodeableConcept getExpirationType() {
12031    if (this.expirationType == null)
12032      if (Configuration.errorOnAutoCreate())
12033        throw new Error("Attempt to auto-create Contract.expirationType");
12034      else if (Configuration.doAutoCreate())
12035        this.expirationType = new CodeableConcept(); // cc
12036    return this.expirationType;
12037  }
12038
12039  public boolean hasExpirationType() {
12040    return this.expirationType != null && !this.expirationType.isEmpty();
12041  }
12042
12043  /**
12044   * @param value {@link #expirationType} (Event resulting in discontinuation or
12045   *              termination of this Contract instance by one or more parties to
12046   *              the contract.)
12047   */
12048  public Contract setExpirationType(CodeableConcept value) {
12049    this.expirationType = value;
12050    return this;
12051  }
12052
12053  /**
12054   * @return {@link #subject} (The target entity impacted by or of interest to
12055   *         parties to the agreement.)
12056   */
12057  public List<Reference> getSubject() {
12058    if (this.subject == null)
12059      this.subject = new ArrayList<Reference>();
12060    return this.subject;
12061  }
12062
12063  /**
12064   * @return Returns a reference to <code>this</code> for easy method chaining
12065   */
12066  public Contract setSubject(List<Reference> theSubject) {
12067    this.subject = theSubject;
12068    return this;
12069  }
12070
12071  public boolean hasSubject() {
12072    if (this.subject == null)
12073      return false;
12074    for (Reference item : this.subject)
12075      if (!item.isEmpty())
12076        return true;
12077    return false;
12078  }
12079
12080  public Reference addSubject() { // 3
12081    Reference t = new Reference();
12082    if (this.subject == null)
12083      this.subject = new ArrayList<Reference>();
12084    this.subject.add(t);
12085    return t;
12086  }
12087
12088  public Contract addSubject(Reference t) { // 3
12089    if (t == null)
12090      return this;
12091    if (this.subject == null)
12092      this.subject = new ArrayList<Reference>();
12093    this.subject.add(t);
12094    return this;
12095  }
12096
12097  /**
12098   * @return The first repetition of repeating field {@link #subject}, creating it
12099   *         if it does not already exist
12100   */
12101  public Reference getSubjectFirstRep() {
12102    if (getSubject().isEmpty()) {
12103      addSubject();
12104    }
12105    return getSubject().get(0);
12106  }
12107
12108  /**
12109   * @deprecated Use Reference#setResource(IBaseResource) instead
12110   */
12111  @Deprecated
12112  public List<Resource> getSubjectTarget() {
12113    if (this.subjectTarget == null)
12114      this.subjectTarget = new ArrayList<Resource>();
12115    return this.subjectTarget;
12116  }
12117
12118  /**
12119   * @return {@link #authority} (A formally or informally recognized grouping of
12120   *         people, principals, organizations, or jurisdictions formed for the
12121   *         purpose of achieving some form of collective action such as the
12122   *         promulgation, administration and enforcement of contracts and
12123   *         policies.)
12124   */
12125  public List<Reference> getAuthority() {
12126    if (this.authority == null)
12127      this.authority = new ArrayList<Reference>();
12128    return this.authority;
12129  }
12130
12131  /**
12132   * @return Returns a reference to <code>this</code> for easy method chaining
12133   */
12134  public Contract setAuthority(List<Reference> theAuthority) {
12135    this.authority = theAuthority;
12136    return this;
12137  }
12138
12139  public boolean hasAuthority() {
12140    if (this.authority == null)
12141      return false;
12142    for (Reference item : this.authority)
12143      if (!item.isEmpty())
12144        return true;
12145    return false;
12146  }
12147
12148  public Reference addAuthority() { // 3
12149    Reference t = new Reference();
12150    if (this.authority == null)
12151      this.authority = new ArrayList<Reference>();
12152    this.authority.add(t);
12153    return t;
12154  }
12155
12156  public Contract addAuthority(Reference t) { // 3
12157    if (t == null)
12158      return this;
12159    if (this.authority == null)
12160      this.authority = new ArrayList<Reference>();
12161    this.authority.add(t);
12162    return this;
12163  }
12164
12165  /**
12166   * @return The first repetition of repeating field {@link #authority}, creating
12167   *         it if it does not already exist
12168   */
12169  public Reference getAuthorityFirstRep() {
12170    if (getAuthority().isEmpty()) {
12171      addAuthority();
12172    }
12173    return getAuthority().get(0);
12174  }
12175
12176  /**
12177   * @deprecated Use Reference#setResource(IBaseResource) instead
12178   */
12179  @Deprecated
12180  public List<Organization> getAuthorityTarget() {
12181    if (this.authorityTarget == null)
12182      this.authorityTarget = new ArrayList<Organization>();
12183    return this.authorityTarget;
12184  }
12185
12186  /**
12187   * @deprecated Use Reference#setResource(IBaseResource) instead
12188   */
12189  @Deprecated
12190  public Organization addAuthorityTarget() {
12191    Organization r = new Organization();
12192    if (this.authorityTarget == null)
12193      this.authorityTarget = new ArrayList<Organization>();
12194    this.authorityTarget.add(r);
12195    return r;
12196  }
12197
12198  /**
12199   * @return {@link #domain} (Recognized governance framework or system operating
12200   *         with a circumscribed scope in accordance with specified principles,
12201   *         policies, processes or procedures for managing rights, actions, or
12202   *         behaviors of parties or principals relative to resources.)
12203   */
12204  public List<Reference> getDomain() {
12205    if (this.domain == null)
12206      this.domain = new ArrayList<Reference>();
12207    return this.domain;
12208  }
12209
12210  /**
12211   * @return Returns a reference to <code>this</code> for easy method chaining
12212   */
12213  public Contract setDomain(List<Reference> theDomain) {
12214    this.domain = theDomain;
12215    return this;
12216  }
12217
12218  public boolean hasDomain() {
12219    if (this.domain == null)
12220      return false;
12221    for (Reference item : this.domain)
12222      if (!item.isEmpty())
12223        return true;
12224    return false;
12225  }
12226
12227  public Reference addDomain() { // 3
12228    Reference t = new Reference();
12229    if (this.domain == null)
12230      this.domain = new ArrayList<Reference>();
12231    this.domain.add(t);
12232    return t;
12233  }
12234
12235  public Contract addDomain(Reference t) { // 3
12236    if (t == null)
12237      return this;
12238    if (this.domain == null)
12239      this.domain = new ArrayList<Reference>();
12240    this.domain.add(t);
12241    return this;
12242  }
12243
12244  /**
12245   * @return The first repetition of repeating field {@link #domain}, creating it
12246   *         if it does not already exist
12247   */
12248  public Reference getDomainFirstRep() {
12249    if (getDomain().isEmpty()) {
12250      addDomain();
12251    }
12252    return getDomain().get(0);
12253  }
12254
12255  /**
12256   * @deprecated Use Reference#setResource(IBaseResource) instead
12257   */
12258  @Deprecated
12259  public List<Location> getDomainTarget() {
12260    if (this.domainTarget == null)
12261      this.domainTarget = new ArrayList<Location>();
12262    return this.domainTarget;
12263  }
12264
12265  /**
12266   * @deprecated Use Reference#setResource(IBaseResource) instead
12267   */
12268  @Deprecated
12269  public Location addDomainTarget() {
12270    Location r = new Location();
12271    if (this.domainTarget == null)
12272      this.domainTarget = new ArrayList<Location>();
12273    this.domainTarget.add(r);
12274    return r;
12275  }
12276
12277  /**
12278   * @return {@link #site} (Sites in which the contract is complied with,
12279   *         exercised, or in force.)
12280   */
12281  public List<Reference> getSite() {
12282    if (this.site == null)
12283      this.site = new ArrayList<Reference>();
12284    return this.site;
12285  }
12286
12287  /**
12288   * @return Returns a reference to <code>this</code> for easy method chaining
12289   */
12290  public Contract setSite(List<Reference> theSite) {
12291    this.site = theSite;
12292    return this;
12293  }
12294
12295  public boolean hasSite() {
12296    if (this.site == null)
12297      return false;
12298    for (Reference item : this.site)
12299      if (!item.isEmpty())
12300        return true;
12301    return false;
12302  }
12303
12304  public Reference addSite() { // 3
12305    Reference t = new Reference();
12306    if (this.site == null)
12307      this.site = new ArrayList<Reference>();
12308    this.site.add(t);
12309    return t;
12310  }
12311
12312  public Contract addSite(Reference t) { // 3
12313    if (t == null)
12314      return this;
12315    if (this.site == null)
12316      this.site = new ArrayList<Reference>();
12317    this.site.add(t);
12318    return this;
12319  }
12320
12321  /**
12322   * @return The first repetition of repeating field {@link #site}, creating it if
12323   *         it does not already exist
12324   */
12325  public Reference getSiteFirstRep() {
12326    if (getSite().isEmpty()) {
12327      addSite();
12328    }
12329    return getSite().get(0);
12330  }
12331
12332  /**
12333   * @deprecated Use Reference#setResource(IBaseResource) instead
12334   */
12335  @Deprecated
12336  public List<Location> getSiteTarget() {
12337    if (this.siteTarget == null)
12338      this.siteTarget = new ArrayList<Location>();
12339    return this.siteTarget;
12340  }
12341
12342  /**
12343   * @deprecated Use Reference#setResource(IBaseResource) instead
12344   */
12345  @Deprecated
12346  public Location addSiteTarget() {
12347    Location r = new Location();
12348    if (this.siteTarget == null)
12349      this.siteTarget = new ArrayList<Location>();
12350    this.siteTarget.add(r);
12351    return r;
12352  }
12353
12354  /**
12355   * @return {@link #name} (A natural language name identifying this Contract
12356   *         definition, derivative, or instance in any legal state. Provides
12357   *         additional information about its content. This name should be usable
12358   *         as an identifier for the module by machine processing applications
12359   *         such as code generation.). This is the underlying object with id,
12360   *         value and extensions. The accessor "getName" gives direct access to
12361   *         the value
12362   */
12363  public StringType getNameElement() {
12364    if (this.name == null)
12365      if (Configuration.errorOnAutoCreate())
12366        throw new Error("Attempt to auto-create Contract.name");
12367      else if (Configuration.doAutoCreate())
12368        this.name = new StringType(); // bb
12369    return this.name;
12370  }
12371
12372  public boolean hasNameElement() {
12373    return this.name != null && !this.name.isEmpty();
12374  }
12375
12376  public boolean hasName() {
12377    return this.name != null && !this.name.isEmpty();
12378  }
12379
12380  /**
12381   * @param value {@link #name} (A natural language name identifying this Contract
12382   *              definition, derivative, or instance in any legal state. Provides
12383   *              additional information about its content. This name should be
12384   *              usable as an identifier for the module by machine processing
12385   *              applications such as code generation.). This is the underlying
12386   *              object with id, value and extensions. The accessor "getName"
12387   *              gives direct access to the value
12388   */
12389  public Contract setNameElement(StringType value) {
12390    this.name = value;
12391    return this;
12392  }
12393
12394  /**
12395   * @return A natural language name identifying this Contract definition,
12396   *         derivative, or instance in any legal state. Provides additional
12397   *         information about its content. This name should be usable as an
12398   *         identifier for the module by machine processing applications such as
12399   *         code generation.
12400   */
12401  public String getName() {
12402    return this.name == null ? null : this.name.getValue();
12403  }
12404
12405  /**
12406   * @param value A natural language name identifying this Contract definition,
12407   *              derivative, or instance in any legal state. Provides additional
12408   *              information about its content. This name should be usable as an
12409   *              identifier for the module by machine processing applications
12410   *              such as code generation.
12411   */
12412  public Contract setName(String value) {
12413    if (Utilities.noString(value))
12414      this.name = null;
12415    else {
12416      if (this.name == null)
12417        this.name = new StringType();
12418      this.name.setValue(value);
12419    }
12420    return this;
12421  }
12422
12423  /**
12424   * @return {@link #title} (A short, descriptive, user-friendly title for this
12425   *         Contract definition, derivative, or instance in any legal state.t
12426   *         giving additional information about its content.). This is the
12427   *         underlying object with id, value and extensions. The accessor
12428   *         "getTitle" gives direct access to the value
12429   */
12430  public StringType getTitleElement() {
12431    if (this.title == null)
12432      if (Configuration.errorOnAutoCreate())
12433        throw new Error("Attempt to auto-create Contract.title");
12434      else if (Configuration.doAutoCreate())
12435        this.title = new StringType(); // bb
12436    return this.title;
12437  }
12438
12439  public boolean hasTitleElement() {
12440    return this.title != null && !this.title.isEmpty();
12441  }
12442
12443  public boolean hasTitle() {
12444    return this.title != null && !this.title.isEmpty();
12445  }
12446
12447  /**
12448   * @param value {@link #title} (A short, descriptive, user-friendly title for
12449   *              this Contract definition, derivative, or instance in any legal
12450   *              state.t giving additional information about its content.). This
12451   *              is the underlying object with id, value and extensions. The
12452   *              accessor "getTitle" gives direct access to the value
12453   */
12454  public Contract setTitleElement(StringType value) {
12455    this.title = value;
12456    return this;
12457  }
12458
12459  /**
12460   * @return A short, descriptive, user-friendly title for this Contract
12461   *         definition, derivative, or instance in any legal state.t giving
12462   *         additional information about its content.
12463   */
12464  public String getTitle() {
12465    return this.title == null ? null : this.title.getValue();
12466  }
12467
12468  /**
12469   * @param value A short, descriptive, user-friendly title for this Contract
12470   *              definition, derivative, or instance in any legal state.t giving
12471   *              additional information about its content.
12472   */
12473  public Contract setTitle(String value) {
12474    if (Utilities.noString(value))
12475      this.title = null;
12476    else {
12477      if (this.title == null)
12478        this.title = new StringType();
12479      this.title.setValue(value);
12480    }
12481    return this;
12482  }
12483
12484  /**
12485   * @return {@link #subtitle} (An explanatory or alternate user-friendly title
12486   *         for this Contract definition, derivative, or instance in any legal
12487   *         state.t giving additional information about its content.). This is
12488   *         the underlying object with id, value and extensions. The accessor
12489   *         "getSubtitle" gives direct access to the value
12490   */
12491  public StringType getSubtitleElement() {
12492    if (this.subtitle == null)
12493      if (Configuration.errorOnAutoCreate())
12494        throw new Error("Attempt to auto-create Contract.subtitle");
12495      else if (Configuration.doAutoCreate())
12496        this.subtitle = new StringType(); // bb
12497    return this.subtitle;
12498  }
12499
12500  public boolean hasSubtitleElement() {
12501    return this.subtitle != null && !this.subtitle.isEmpty();
12502  }
12503
12504  public boolean hasSubtitle() {
12505    return this.subtitle != null && !this.subtitle.isEmpty();
12506  }
12507
12508  /**
12509   * @param value {@link #subtitle} (An explanatory or alternate user-friendly
12510   *              title for this Contract definition, derivative, or instance in
12511   *              any legal state.t giving additional information about its
12512   *              content.). This is the underlying object with id, value and
12513   *              extensions. The accessor "getSubtitle" gives direct access to
12514   *              the value
12515   */
12516  public Contract setSubtitleElement(StringType value) {
12517    this.subtitle = value;
12518    return this;
12519  }
12520
12521  /**
12522   * @return An explanatory or alternate user-friendly title for this Contract
12523   *         definition, derivative, or instance in any legal state.t giving
12524   *         additional information about its content.
12525   */
12526  public String getSubtitle() {
12527    return this.subtitle == null ? null : this.subtitle.getValue();
12528  }
12529
12530  /**
12531   * @param value An explanatory or alternate user-friendly title for this
12532   *              Contract definition, derivative, or instance in any legal
12533   *              state.t giving additional information about its content.
12534   */
12535  public Contract setSubtitle(String value) {
12536    if (Utilities.noString(value))
12537      this.subtitle = null;
12538    else {
12539      if (this.subtitle == null)
12540        this.subtitle = new StringType();
12541      this.subtitle.setValue(value);
12542    }
12543    return this;
12544  }
12545
12546  /**
12547   * @return {@link #alias} (Alternative representation of the title for this
12548   *         Contract definition, derivative, or instance in any legal state.,
12549   *         e.g., a domain specific contract number related to legislation.)
12550   */
12551  public List<StringType> getAlias() {
12552    if (this.alias == null)
12553      this.alias = new ArrayList<StringType>();
12554    return this.alias;
12555  }
12556
12557  /**
12558   * @return Returns a reference to <code>this</code> for easy method chaining
12559   */
12560  public Contract setAlias(List<StringType> theAlias) {
12561    this.alias = theAlias;
12562    return this;
12563  }
12564
12565  public boolean hasAlias() {
12566    if (this.alias == null)
12567      return false;
12568    for (StringType item : this.alias)
12569      if (!item.isEmpty())
12570        return true;
12571    return false;
12572  }
12573
12574  /**
12575   * @return {@link #alias} (Alternative representation of the title for this
12576   *         Contract definition, derivative, or instance in any legal state.,
12577   *         e.g., a domain specific contract number related to legislation.)
12578   */
12579  public StringType addAliasElement() {// 2
12580    StringType t = new StringType();
12581    if (this.alias == null)
12582      this.alias = new ArrayList<StringType>();
12583    this.alias.add(t);
12584    return t;
12585  }
12586
12587  /**
12588   * @param value {@link #alias} (Alternative representation of the title for this
12589   *              Contract definition, derivative, or instance in any legal
12590   *              state., e.g., a domain specific contract number related to
12591   *              legislation.)
12592   */
12593  public Contract addAlias(String value) { // 1
12594    StringType t = new StringType();
12595    t.setValue(value);
12596    if (this.alias == null)
12597      this.alias = new ArrayList<StringType>();
12598    this.alias.add(t);
12599    return this;
12600  }
12601
12602  /**
12603   * @param value {@link #alias} (Alternative representation of the title for this
12604   *              Contract definition, derivative, or instance in any legal
12605   *              state., e.g., a domain specific contract number related to
12606   *              legislation.)
12607   */
12608  public boolean hasAlias(String value) {
12609    if (this.alias == null)
12610      return false;
12611    for (StringType v : this.alias)
12612      if (v.getValue().equals(value)) // string
12613        return true;
12614    return false;
12615  }
12616
12617  /**
12618   * @return {@link #author} (The individual or organization that authored the
12619   *         Contract definition, derivative, or instance in any legal state.)
12620   */
12621  public Reference getAuthor() {
12622    if (this.author == null)
12623      if (Configuration.errorOnAutoCreate())
12624        throw new Error("Attempt to auto-create Contract.author");
12625      else if (Configuration.doAutoCreate())
12626        this.author = new Reference(); // cc
12627    return this.author;
12628  }
12629
12630  public boolean hasAuthor() {
12631    return this.author != null && !this.author.isEmpty();
12632  }
12633
12634  /**
12635   * @param value {@link #author} (The individual or organization that authored
12636   *              the Contract definition, derivative, or instance in any legal
12637   *              state.)
12638   */
12639  public Contract setAuthor(Reference value) {
12640    this.author = value;
12641    return this;
12642  }
12643
12644  /**
12645   * @return {@link #author} The actual object that is the target of the
12646   *         reference. The reference library doesn't populate this, but you can
12647   *         use it to hold the resource if you resolve it. (The individual or
12648   *         organization that authored the Contract definition, derivative, or
12649   *         instance in any legal state.)
12650   */
12651  public Resource getAuthorTarget() {
12652    return this.authorTarget;
12653  }
12654
12655  /**
12656   * @param value {@link #author} The actual object that is the target of the
12657   *              reference. The reference library doesn't use these, but you can
12658   *              use it to hold the resource if you resolve it. (The individual
12659   *              or organization that authored the Contract definition,
12660   *              derivative, or instance in any legal state.)
12661   */
12662  public Contract setAuthorTarget(Resource value) {
12663    this.authorTarget = value;
12664    return this;
12665  }
12666
12667  /**
12668   * @return {@link #scope} (A selector of legal concerns for this Contract
12669   *         definition, derivative, or instance in any legal state.)
12670   */
12671  public CodeableConcept getScope() {
12672    if (this.scope == null)
12673      if (Configuration.errorOnAutoCreate())
12674        throw new Error("Attempt to auto-create Contract.scope");
12675      else if (Configuration.doAutoCreate())
12676        this.scope = new CodeableConcept(); // cc
12677    return this.scope;
12678  }
12679
12680  public boolean hasScope() {
12681    return this.scope != null && !this.scope.isEmpty();
12682  }
12683
12684  /**
12685   * @param value {@link #scope} (A selector of legal concerns for this Contract
12686   *              definition, derivative, or instance in any legal state.)
12687   */
12688  public Contract setScope(CodeableConcept value) {
12689    this.scope = value;
12690    return this;
12691  }
12692
12693  /**
12694   * @return {@link #topic} (Narrows the range of legal concerns to focus on the
12695   *         achievement of specific contractual objectives.)
12696   */
12697  public Type getTopic() {
12698    return this.topic;
12699  }
12700
12701  /**
12702   * @return {@link #topic} (Narrows the range of legal concerns to focus on the
12703   *         achievement of specific contractual objectives.)
12704   */
12705  public CodeableConcept getTopicCodeableConcept() throws FHIRException {
12706    if (this.topic == null)
12707      this.topic = new CodeableConcept();
12708    if (!(this.topic instanceof CodeableConcept))
12709      throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
12710          + this.topic.getClass().getName() + " was encountered");
12711    return (CodeableConcept) this.topic;
12712  }
12713
12714  public boolean hasTopicCodeableConcept() {
12715    return this != null && this.topic instanceof CodeableConcept;
12716  }
12717
12718  /**
12719   * @return {@link #topic} (Narrows the range of legal concerns to focus on the
12720   *         achievement of specific contractual objectives.)
12721   */
12722  public Reference getTopicReference() throws FHIRException {
12723    if (this.topic == null)
12724      this.topic = new Reference();
12725    if (!(this.topic instanceof Reference))
12726      throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.topic.getClass().getName()
12727          + " was encountered");
12728    return (Reference) this.topic;
12729  }
12730
12731  public boolean hasTopicReference() {
12732    return this != null && this.topic instanceof Reference;
12733  }
12734
12735  public boolean hasTopic() {
12736    return this.topic != null && !this.topic.isEmpty();
12737  }
12738
12739  /**
12740   * @param value {@link #topic} (Narrows the range of legal concerns to focus on
12741   *              the achievement of specific contractual objectives.)
12742   */
12743  public Contract setTopic(Type value) {
12744    if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
12745      throw new Error("Not the right type for Contract.topic[x]: " + value.fhirType());
12746    this.topic = value;
12747    return this;
12748  }
12749
12750  /**
12751   * @return {@link #type} (A high-level category for the legal instrument,
12752   *         whether constructed as a Contract definition, derivative, or instance
12753   *         in any legal state. Provides additional information about its content
12754   *         within the context of the Contract's scope to distinguish the kinds
12755   *         of systems that would be interested in the contract.)
12756   */
12757  public CodeableConcept getType() {
12758    if (this.type == null)
12759      if (Configuration.errorOnAutoCreate())
12760        throw new Error("Attempt to auto-create Contract.type");
12761      else if (Configuration.doAutoCreate())
12762        this.type = new CodeableConcept(); // cc
12763    return this.type;
12764  }
12765
12766  public boolean hasType() {
12767    return this.type != null && !this.type.isEmpty();
12768  }
12769
12770  /**
12771   * @param value {@link #type} (A high-level category for the legal instrument,
12772   *              whether constructed as a Contract definition, derivative, or
12773   *              instance in any legal state. Provides additional information
12774   *              about its content within the context of the Contract's scope to
12775   *              distinguish the kinds of systems that would be interested in the
12776   *              contract.)
12777   */
12778  public Contract setType(CodeableConcept value) {
12779    this.type = value;
12780    return this;
12781  }
12782
12783  /**
12784   * @return {@link #subType} (Sub-category for the Contract that distinguishes
12785   *         the kinds of systems that would be interested in the Contract within
12786   *         the context of the Contract's scope.)
12787   */
12788  public List<CodeableConcept> getSubType() {
12789    if (this.subType == null)
12790      this.subType = new ArrayList<CodeableConcept>();
12791    return this.subType;
12792  }
12793
12794  /**
12795   * @return Returns a reference to <code>this</code> for easy method chaining
12796   */
12797  public Contract setSubType(List<CodeableConcept> theSubType) {
12798    this.subType = theSubType;
12799    return this;
12800  }
12801
12802  public boolean hasSubType() {
12803    if (this.subType == null)
12804      return false;
12805    for (CodeableConcept item : this.subType)
12806      if (!item.isEmpty())
12807        return true;
12808    return false;
12809  }
12810
12811  public CodeableConcept addSubType() { // 3
12812    CodeableConcept t = new CodeableConcept();
12813    if (this.subType == null)
12814      this.subType = new ArrayList<CodeableConcept>();
12815    this.subType.add(t);
12816    return t;
12817  }
12818
12819  public Contract addSubType(CodeableConcept t) { // 3
12820    if (t == null)
12821      return this;
12822    if (this.subType == null)
12823      this.subType = new ArrayList<CodeableConcept>();
12824    this.subType.add(t);
12825    return this;
12826  }
12827
12828  /**
12829   * @return The first repetition of repeating field {@link #subType}, creating it
12830   *         if it does not already exist
12831   */
12832  public CodeableConcept getSubTypeFirstRep() {
12833    if (getSubType().isEmpty()) {
12834      addSubType();
12835    }
12836    return getSubType().get(0);
12837  }
12838
12839  /**
12840   * @return {@link #contentDefinition} (Precusory content developed with a focus
12841   *         and intent of supporting the formation a Contract instance, which may
12842   *         be associated with and transformable into a Contract.)
12843   */
12844  public ContentDefinitionComponent getContentDefinition() {
12845    if (this.contentDefinition == null)
12846      if (Configuration.errorOnAutoCreate())
12847        throw new Error("Attempt to auto-create Contract.contentDefinition");
12848      else if (Configuration.doAutoCreate())
12849        this.contentDefinition = new ContentDefinitionComponent(); // cc
12850    return this.contentDefinition;
12851  }
12852
12853  public boolean hasContentDefinition() {
12854    return this.contentDefinition != null && !this.contentDefinition.isEmpty();
12855  }
12856
12857  /**
12858   * @param value {@link #contentDefinition} (Precusory content developed with a
12859   *              focus and intent of supporting the formation a Contract
12860   *              instance, which may be associated with and transformable into a
12861   *              Contract.)
12862   */
12863  public Contract setContentDefinition(ContentDefinitionComponent value) {
12864    this.contentDefinition = value;
12865    return this;
12866  }
12867
12868  /**
12869   * @return {@link #term} (One or more Contract Provisions, which may be related
12870   *         and conveyed as a group, and may contain nested groups.)
12871   */
12872  public List<TermComponent> getTerm() {
12873    if (this.term == null)
12874      this.term = new ArrayList<TermComponent>();
12875    return this.term;
12876  }
12877
12878  /**
12879   * @return Returns a reference to <code>this</code> for easy method chaining
12880   */
12881  public Contract setTerm(List<TermComponent> theTerm) {
12882    this.term = theTerm;
12883    return this;
12884  }
12885
12886  public boolean hasTerm() {
12887    if (this.term == null)
12888      return false;
12889    for (TermComponent item : this.term)
12890      if (!item.isEmpty())
12891        return true;
12892    return false;
12893  }
12894
12895  public TermComponent addTerm() { // 3
12896    TermComponent t = new TermComponent();
12897    if (this.term == null)
12898      this.term = new ArrayList<TermComponent>();
12899    this.term.add(t);
12900    return t;
12901  }
12902
12903  public Contract addTerm(TermComponent t) { // 3
12904    if (t == null)
12905      return this;
12906    if (this.term == null)
12907      this.term = new ArrayList<TermComponent>();
12908    this.term.add(t);
12909    return this;
12910  }
12911
12912  /**
12913   * @return The first repetition of repeating field {@link #term}, creating it if
12914   *         it does not already exist
12915   */
12916  public TermComponent getTermFirstRep() {
12917    if (getTerm().isEmpty()) {
12918      addTerm();
12919    }
12920    return getTerm().get(0);
12921  }
12922
12923  /**
12924   * @return {@link #supportingInfo} (Information that may be needed by/relevant
12925   *         to the performer in their execution of this term action.)
12926   */
12927  public List<Reference> getSupportingInfo() {
12928    if (this.supportingInfo == null)
12929      this.supportingInfo = new ArrayList<Reference>();
12930    return this.supportingInfo;
12931  }
12932
12933  /**
12934   * @return Returns a reference to <code>this</code> for easy method chaining
12935   */
12936  public Contract setSupportingInfo(List<Reference> theSupportingInfo) {
12937    this.supportingInfo = theSupportingInfo;
12938    return this;
12939  }
12940
12941  public boolean hasSupportingInfo() {
12942    if (this.supportingInfo == null)
12943      return false;
12944    for (Reference item : this.supportingInfo)
12945      if (!item.isEmpty())
12946        return true;
12947    return false;
12948  }
12949
12950  public Reference addSupportingInfo() { // 3
12951    Reference t = new Reference();
12952    if (this.supportingInfo == null)
12953      this.supportingInfo = new ArrayList<Reference>();
12954    this.supportingInfo.add(t);
12955    return t;
12956  }
12957
12958  public Contract addSupportingInfo(Reference t) { // 3
12959    if (t == null)
12960      return this;
12961    if (this.supportingInfo == null)
12962      this.supportingInfo = new ArrayList<Reference>();
12963    this.supportingInfo.add(t);
12964    return this;
12965  }
12966
12967  /**
12968   * @return The first repetition of repeating field {@link #supportingInfo},
12969   *         creating it if it does not already exist
12970   */
12971  public Reference getSupportingInfoFirstRep() {
12972    if (getSupportingInfo().isEmpty()) {
12973      addSupportingInfo();
12974    }
12975    return getSupportingInfo().get(0);
12976  }
12977
12978  /**
12979   * @deprecated Use Reference#setResource(IBaseResource) instead
12980   */
12981  @Deprecated
12982  public List<Resource> getSupportingInfoTarget() {
12983    if (this.supportingInfoTarget == null)
12984      this.supportingInfoTarget = new ArrayList<Resource>();
12985    return this.supportingInfoTarget;
12986  }
12987
12988  /**
12989   * @return {@link #relevantHistory} (Links to Provenance records for past
12990   *         versions of this Contract definition, derivative, or instance, which
12991   *         identify key state transitions or updates that are likely to be
12992   *         relevant to a user looking at the current version of the Contract.
12993   *         The Provence.entity indicates the target that was changed in the
12994   *         update.
12995   *         http://build.fhir.org/provenance-definitions.html#Provenance.entity.)
12996   */
12997  public List<Reference> getRelevantHistory() {
12998    if (this.relevantHistory == null)
12999      this.relevantHistory = new ArrayList<Reference>();
13000    return this.relevantHistory;
13001  }
13002
13003  /**
13004   * @return Returns a reference to <code>this</code> for easy method chaining
13005   */
13006  public Contract setRelevantHistory(List<Reference> theRelevantHistory) {
13007    this.relevantHistory = theRelevantHistory;
13008    return this;
13009  }
13010
13011  public boolean hasRelevantHistory() {
13012    if (this.relevantHistory == null)
13013      return false;
13014    for (Reference item : this.relevantHistory)
13015      if (!item.isEmpty())
13016        return true;
13017    return false;
13018  }
13019
13020  public Reference addRelevantHistory() { // 3
13021    Reference t = new Reference();
13022    if (this.relevantHistory == null)
13023      this.relevantHistory = new ArrayList<Reference>();
13024    this.relevantHistory.add(t);
13025    return t;
13026  }
13027
13028  public Contract addRelevantHistory(Reference t) { // 3
13029    if (t == null)
13030      return this;
13031    if (this.relevantHistory == null)
13032      this.relevantHistory = new ArrayList<Reference>();
13033    this.relevantHistory.add(t);
13034    return this;
13035  }
13036
13037  /**
13038   * @return The first repetition of repeating field {@link #relevantHistory},
13039   *         creating it if it does not already exist
13040   */
13041  public Reference getRelevantHistoryFirstRep() {
13042    if (getRelevantHistory().isEmpty()) {
13043      addRelevantHistory();
13044    }
13045    return getRelevantHistory().get(0);
13046  }
13047
13048  /**
13049   * @deprecated Use Reference#setResource(IBaseResource) instead
13050   */
13051  @Deprecated
13052  public List<Provenance> getRelevantHistoryTarget() {
13053    if (this.relevantHistoryTarget == null)
13054      this.relevantHistoryTarget = new ArrayList<Provenance>();
13055    return this.relevantHistoryTarget;
13056  }
13057
13058  /**
13059   * @deprecated Use Reference#setResource(IBaseResource) instead
13060   */
13061  @Deprecated
13062  public Provenance addRelevantHistoryTarget() {
13063    Provenance r = new Provenance();
13064    if (this.relevantHistoryTarget == null)
13065      this.relevantHistoryTarget = new ArrayList<Provenance>();
13066    this.relevantHistoryTarget.add(r);
13067    return r;
13068  }
13069
13070  /**
13071   * @return {@link #signer} (Parties with legal standing in the Contract,
13072   *         including the principal parties, the grantor(s) and grantee(s), which
13073   *         are any person or organization bound by the contract, and any
13074   *         ancillary parties, which facilitate the execution of the contract
13075   *         such as a notary or witness.)
13076   */
13077  public List<SignatoryComponent> getSigner() {
13078    if (this.signer == null)
13079      this.signer = new ArrayList<SignatoryComponent>();
13080    return this.signer;
13081  }
13082
13083  /**
13084   * @return Returns a reference to <code>this</code> for easy method chaining
13085   */
13086  public Contract setSigner(List<SignatoryComponent> theSigner) {
13087    this.signer = theSigner;
13088    return this;
13089  }
13090
13091  public boolean hasSigner() {
13092    if (this.signer == null)
13093      return false;
13094    for (SignatoryComponent item : this.signer)
13095      if (!item.isEmpty())
13096        return true;
13097    return false;
13098  }
13099
13100  public SignatoryComponent addSigner() { // 3
13101    SignatoryComponent t = new SignatoryComponent();
13102    if (this.signer == null)
13103      this.signer = new ArrayList<SignatoryComponent>();
13104    this.signer.add(t);
13105    return t;
13106  }
13107
13108  public Contract addSigner(SignatoryComponent t) { // 3
13109    if (t == null)
13110      return this;
13111    if (this.signer == null)
13112      this.signer = new ArrayList<SignatoryComponent>();
13113    this.signer.add(t);
13114    return this;
13115  }
13116
13117  /**
13118   * @return The first repetition of repeating field {@link #signer}, creating it
13119   *         if it does not already exist
13120   */
13121  public SignatoryComponent getSignerFirstRep() {
13122    if (getSigner().isEmpty()) {
13123      addSigner();
13124    }
13125    return getSigner().get(0);
13126  }
13127
13128  /**
13129   * @return {@link #friendly} (The "patient friendly language" versionof the
13130   *         Contract in whole or in parts. "Patient friendly language" means the
13131   *         representation of the Contract and Contract Provisions in a manner
13132   *         that is readily accessible and understandable by a layperson in
13133   *         accordance with best practices for communication styles that ensure
13134   *         that those agreeing to or signing the Contract understand the roles,
13135   *         actions, obligations, responsibilities, and implication of the
13136   *         agreement.)
13137   */
13138  public List<FriendlyLanguageComponent> getFriendly() {
13139    if (this.friendly == null)
13140      this.friendly = new ArrayList<FriendlyLanguageComponent>();
13141    return this.friendly;
13142  }
13143
13144  /**
13145   * @return Returns a reference to <code>this</code> for easy method chaining
13146   */
13147  public Contract setFriendly(List<FriendlyLanguageComponent> theFriendly) {
13148    this.friendly = theFriendly;
13149    return this;
13150  }
13151
13152  public boolean hasFriendly() {
13153    if (this.friendly == null)
13154      return false;
13155    for (FriendlyLanguageComponent item : this.friendly)
13156      if (!item.isEmpty())
13157        return true;
13158    return false;
13159  }
13160
13161  public FriendlyLanguageComponent addFriendly() { // 3
13162    FriendlyLanguageComponent t = new FriendlyLanguageComponent();
13163    if (this.friendly == null)
13164      this.friendly = new ArrayList<FriendlyLanguageComponent>();
13165    this.friendly.add(t);
13166    return t;
13167  }
13168
13169  public Contract addFriendly(FriendlyLanguageComponent t) { // 3
13170    if (t == null)
13171      return this;
13172    if (this.friendly == null)
13173      this.friendly = new ArrayList<FriendlyLanguageComponent>();
13174    this.friendly.add(t);
13175    return this;
13176  }
13177
13178  /**
13179   * @return The first repetition of repeating field {@link #friendly}, creating
13180   *         it if it does not already exist
13181   */
13182  public FriendlyLanguageComponent getFriendlyFirstRep() {
13183    if (getFriendly().isEmpty()) {
13184      addFriendly();
13185    }
13186    return getFriendly().get(0);
13187  }
13188
13189  /**
13190   * @return {@link #legal} (List of Legal expressions or representations of this
13191   *         Contract.)
13192   */
13193  public List<LegalLanguageComponent> getLegal() {
13194    if (this.legal == null)
13195      this.legal = new ArrayList<LegalLanguageComponent>();
13196    return this.legal;
13197  }
13198
13199  /**
13200   * @return Returns a reference to <code>this</code> for easy method chaining
13201   */
13202  public Contract setLegal(List<LegalLanguageComponent> theLegal) {
13203    this.legal = theLegal;
13204    return this;
13205  }
13206
13207  public boolean hasLegal() {
13208    if (this.legal == null)
13209      return false;
13210    for (LegalLanguageComponent item : this.legal)
13211      if (!item.isEmpty())
13212        return true;
13213    return false;
13214  }
13215
13216  public LegalLanguageComponent addLegal() { // 3
13217    LegalLanguageComponent t = new LegalLanguageComponent();
13218    if (this.legal == null)
13219      this.legal = new ArrayList<LegalLanguageComponent>();
13220    this.legal.add(t);
13221    return t;
13222  }
13223
13224  public Contract addLegal(LegalLanguageComponent t) { // 3
13225    if (t == null)
13226      return this;
13227    if (this.legal == null)
13228      this.legal = new ArrayList<LegalLanguageComponent>();
13229    this.legal.add(t);
13230    return this;
13231  }
13232
13233  /**
13234   * @return The first repetition of repeating field {@link #legal}, creating it
13235   *         if it does not already exist
13236   */
13237  public LegalLanguageComponent getLegalFirstRep() {
13238    if (getLegal().isEmpty()) {
13239      addLegal();
13240    }
13241    return getLegal().get(0);
13242  }
13243
13244  /**
13245   * @return {@link #rule} (List of Computable Policy Rule Language
13246   *         Representations of this Contract.)
13247   */
13248  public List<ComputableLanguageComponent> getRule() {
13249    if (this.rule == null)
13250      this.rule = new ArrayList<ComputableLanguageComponent>();
13251    return this.rule;
13252  }
13253
13254  /**
13255   * @return Returns a reference to <code>this</code> for easy method chaining
13256   */
13257  public Contract setRule(List<ComputableLanguageComponent> theRule) {
13258    this.rule = theRule;
13259    return this;
13260  }
13261
13262  public boolean hasRule() {
13263    if (this.rule == null)
13264      return false;
13265    for (ComputableLanguageComponent item : this.rule)
13266      if (!item.isEmpty())
13267        return true;
13268    return false;
13269  }
13270
13271  public ComputableLanguageComponent addRule() { // 3
13272    ComputableLanguageComponent t = new ComputableLanguageComponent();
13273    if (this.rule == null)
13274      this.rule = new ArrayList<ComputableLanguageComponent>();
13275    this.rule.add(t);
13276    return t;
13277  }
13278
13279  public Contract addRule(ComputableLanguageComponent t) { // 3
13280    if (t == null)
13281      return this;
13282    if (this.rule == null)
13283      this.rule = new ArrayList<ComputableLanguageComponent>();
13284    this.rule.add(t);
13285    return this;
13286  }
13287
13288  /**
13289   * @return The first repetition of repeating field {@link #rule}, creating it if
13290   *         it does not already exist
13291   */
13292  public ComputableLanguageComponent getRuleFirstRep() {
13293    if (getRule().isEmpty()) {
13294      addRule();
13295    }
13296    return getRule().get(0);
13297  }
13298
13299  /**
13300   * @return {@link #legallyBinding} (Legally binding Contract: This is the signed
13301   *         and legally recognized representation of the Contract, which is
13302   *         considered the "source of truth" and which would be the basis for
13303   *         legal action related to enforcement of this Contract.)
13304   */
13305  public Type getLegallyBinding() {
13306    return this.legallyBinding;
13307  }
13308
13309  /**
13310   * @return {@link #legallyBinding} (Legally binding Contract: This is the signed
13311   *         and legally recognized representation of the Contract, which is
13312   *         considered the "source of truth" and which would be the basis for
13313   *         legal action related to enforcement of this Contract.)
13314   */
13315  public Attachment getLegallyBindingAttachment() throws FHIRException {
13316    if (this.legallyBinding == null)
13317      this.legallyBinding = new Attachment();
13318    if (!(this.legallyBinding instanceof Attachment))
13319      throw new FHIRException("Type mismatch: the type Attachment was expected, but "
13320          + this.legallyBinding.getClass().getName() + " was encountered");
13321    return (Attachment) this.legallyBinding;
13322  }
13323
13324  public boolean hasLegallyBindingAttachment() {
13325    return this != null && this.legallyBinding instanceof Attachment;
13326  }
13327
13328  /**
13329   * @return {@link #legallyBinding} (Legally binding Contract: This is the signed
13330   *         and legally recognized representation of the Contract, which is
13331   *         considered the "source of truth" and which would be the basis for
13332   *         legal action related to enforcement of this Contract.)
13333   */
13334  public Reference getLegallyBindingReference() throws FHIRException {
13335    if (this.legallyBinding == null)
13336      this.legallyBinding = new Reference();
13337    if (!(this.legallyBinding instanceof Reference))
13338      throw new FHIRException("Type mismatch: the type Reference was expected, but "
13339          + this.legallyBinding.getClass().getName() + " was encountered");
13340    return (Reference) this.legallyBinding;
13341  }
13342
13343  public boolean hasLegallyBindingReference() {
13344    return this != null && this.legallyBinding instanceof Reference;
13345  }
13346
13347  public boolean hasLegallyBinding() {
13348    return this.legallyBinding != null && !this.legallyBinding.isEmpty();
13349  }
13350
13351  /**
13352   * @param value {@link #legallyBinding} (Legally binding Contract: This is the
13353   *              signed and legally recognized representation of the Contract,
13354   *              which is considered the "source of truth" and which would be the
13355   *              basis for legal action related to enforcement of this Contract.)
13356   */
13357  public Contract setLegallyBinding(Type value) {
13358    if (value != null && !(value instanceof Attachment || value instanceof Reference))
13359      throw new Error("Not the right type for Contract.legallyBinding[x]: " + value.fhirType());
13360    this.legallyBinding = value;
13361    return this;
13362  }
13363
13364  protected void listChildren(List<Property> children) {
13365    super.listChildren(children);
13366    children.add(new Property("identifier", "Identifier",
13367        "Unique identifier for this Contract or a derivative that references a Source Contract.", 0,
13368        java.lang.Integer.MAX_VALUE, identifier));
13369    children.add(new Property("url", "uri",
13370        "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url));
13371    children.add(new Property("version", "string",
13372        "An edition identifier used for business purposes to label business significant variants.", 0, 1, version));
13373    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
13374    children.add(new Property("legalState", "CodeableConcept",
13375        "Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.",
13376        0, 1, legalState));
13377    children.add(new Property("instantiatesCanonical", "Reference(Contract)",
13378        "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.",
13379        0, 1, instantiatesCanonical));
13380    children.add(new Property("instantiatesUri", "uri",
13381        "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.",
13382        0, 1, instantiatesUri));
13383    children.add(new Property("contentDerivative", "CodeableConcept",
13384        "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1,
13385        contentDerivative));
13386    children.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued));
13387    children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0,
13388        1, applies));
13389    children.add(new Property("expirationType", "CodeableConcept",
13390        "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.",
13391        0, 1, expirationType));
13392    children.add(new Property("subject", "Reference(Any)",
13393        "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE,
13394        subject));
13395    children.add(new Property("authority", "Reference(Organization)",
13396        "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.",
13397        0, java.lang.Integer.MAX_VALUE, authority));
13398    children.add(new Property("domain", "Reference(Location)",
13399        "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.",
13400        0, java.lang.Integer.MAX_VALUE, domain));
13401    children.add(new Property("site", "Reference(Location)",
13402        "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE,
13403        site));
13404    children.add(new Property("name", "string",
13405        "A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.",
13406        0, 1, name));
13407    children.add(new Property("title", "string",
13408        "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.",
13409        0, 1, title));
13410    children.add(new Property("subtitle", "string",
13411        "An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.",
13412        0, 1, subtitle));
13413    children.add(new Property("alias", "string",
13414        "Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.",
13415        0, java.lang.Integer.MAX_VALUE, alias));
13416    children.add(new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)",
13417        "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.",
13418        0, 1, author));
13419    children.add(new Property("scope", "CodeableConcept",
13420        "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0, 1,
13421        scope));
13422    children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)",
13423        "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13424        topic));
13425    children.add(new Property("type", "CodeableConcept",
13426        "A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.",
13427        0, 1, type));
13428    children.add(new Property("subType", "CodeableConcept",
13429        "Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.",
13430        0, java.lang.Integer.MAX_VALUE, subType));
13431    children.add(new Property("contentDefinition", "",
13432        "Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.",
13433        0, 1, contentDefinition));
13434    children.add(new Property("term", "",
13435        "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.",
13436        0, java.lang.Integer.MAX_VALUE, term));
13437    children.add(new Property("supportingInfo", "Reference(Any)",
13438        "Information that may be needed by/relevant to the performer in their execution of this term action.", 0,
13439        java.lang.Integer.MAX_VALUE, supportingInfo));
13440    children.add(new Property("relevantHistory", "Reference(Provenance)",
13441        "Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.",
13442        0, java.lang.Integer.MAX_VALUE, relevantHistory));
13443    children.add(new Property("signer", "",
13444        "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.",
13445        0, java.lang.Integer.MAX_VALUE, signer));
13446    children.add(new Property("friendly", "",
13447        "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.",
13448        0, java.lang.Integer.MAX_VALUE, friendly));
13449    children.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0,
13450        java.lang.Integer.MAX_VALUE, legal));
13451    children.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.",
13452        0, java.lang.Integer.MAX_VALUE, rule));
13453    children.add(new Property("legallyBinding[x]",
13454        "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13455        "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.",
13456        0, 1, legallyBinding));
13457  }
13458
13459  @Override
13460  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13461    switch (_hash) {
13462    case -1618432855:
13463      /* identifier */ return new Property("identifier", "Identifier",
13464          "Unique identifier for this Contract or a derivative that references a Source Contract.", 0,
13465          java.lang.Integer.MAX_VALUE, identifier);
13466    case 116079:
13467      /* url */ return new Property("url", "uri",
13468          "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url);
13469    case 351608024:
13470      /* version */ return new Property("version", "string",
13471          "An edition identifier used for business purposes to label business significant variants.", 0, 1, version);
13472    case -892481550:
13473      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
13474    case 568606040:
13475      /* legalState */ return new Property("legalState", "CodeableConcept",
13476          "Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.",
13477          0, 1, legalState);
13478    case 8911915:
13479      /* instantiatesCanonical */ return new Property("instantiatesCanonical", "Reference(Contract)",
13480          "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.",
13481          0, 1, instantiatesCanonical);
13482    case -1926393373:
13483      /* instantiatesUri */ return new Property("instantiatesUri", "uri",
13484          "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.",
13485          0, 1, instantiatesUri);
13486    case -92412192:
13487      /* contentDerivative */ return new Property("contentDerivative", "CodeableConcept",
13488          "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1,
13489          contentDerivative);
13490    case -1179159893:
13491      /* issued */ return new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued);
13492    case -793235316:
13493      /* applies */ return new Property("applies", "Period",
13494          "Relevant time or time-period when this Contract is applicable.", 0, 1, applies);
13495    case -668311927:
13496      /* expirationType */ return new Property("expirationType", "CodeableConcept",
13497          "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.",
13498          0, 1, expirationType);
13499    case -1867885268:
13500      /* subject */ return new Property("subject", "Reference(Any)",
13501          "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE,
13502          subject);
13503    case 1475610435:
13504      /* authority */ return new Property("authority", "Reference(Organization)",
13505          "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.",
13506          0, java.lang.Integer.MAX_VALUE, authority);
13507    case -1326197564:
13508      /* domain */ return new Property("domain", "Reference(Location)",
13509          "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.",
13510          0, java.lang.Integer.MAX_VALUE, domain);
13511    case 3530567:
13512      /* site */ return new Property("site", "Reference(Location)",
13513          "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE,
13514          site);
13515    case 3373707:
13516      /* name */ return new Property("name", "string",
13517          "A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.",
13518          0, 1, name);
13519    case 110371416:
13520      /* title */ return new Property("title", "string",
13521          "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.",
13522          0, 1, title);
13523    case -2060497896:
13524      /* subtitle */ return new Property("subtitle", "string",
13525          "An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.",
13526          0, 1, subtitle);
13527    case 92902992:
13528      /* alias */ return new Property("alias", "string",
13529          "Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.",
13530          0, java.lang.Integer.MAX_VALUE, alias);
13531    case -1406328437:
13532      /* author */ return new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)",
13533          "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.",
13534          0, 1, author);
13535    case 109264468:
13536      /* scope */ return new Property("scope", "CodeableConcept",
13537          "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0,
13538          1, scope);
13539    case -957295375:
13540      /* topic[x] */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13541          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13542          topic);
13543    case 110546223:
13544      /* topic */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13545          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13546          topic);
13547    case 777778802:
13548      /* topicCodeableConcept */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13549          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13550          topic);
13551    case -343345444:
13552      /* topicReference */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13553          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13554          topic);
13555    case 3575610:
13556      /* type */ return new Property("type", "CodeableConcept",
13557          "A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.",
13558          0, 1, type);
13559    case -1868521062:
13560      /* subType */ return new Property("subType", "CodeableConcept",
13561          "Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.",
13562          0, java.lang.Integer.MAX_VALUE, subType);
13563    case 247055020:
13564      /* contentDefinition */ return new Property("contentDefinition", "",
13565          "Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.",
13566          0, 1, contentDefinition);
13567    case 3556460:
13568      /* term */ return new Property("term", "",
13569          "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.",
13570          0, java.lang.Integer.MAX_VALUE, term);
13571    case 1922406657:
13572      /* supportingInfo */ return new Property("supportingInfo", "Reference(Any)",
13573          "Information that may be needed by/relevant to the performer in their execution of this term action.", 0,
13574          java.lang.Integer.MAX_VALUE, supportingInfo);
13575    case 1538891575:
13576      /* relevantHistory */ return new Property("relevantHistory", "Reference(Provenance)",
13577          "Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.",
13578          0, java.lang.Integer.MAX_VALUE, relevantHistory);
13579    case -902467798:
13580      /* signer */ return new Property("signer", "",
13581          "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.",
13582          0, java.lang.Integer.MAX_VALUE, signer);
13583    case -1423054677:
13584      /* friendly */ return new Property("friendly", "",
13585          "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.",
13586          0, java.lang.Integer.MAX_VALUE, friendly);
13587    case 102851257:
13588      /* legal */ return new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0,
13589          java.lang.Integer.MAX_VALUE, legal);
13590    case 3512060:
13591      /* rule */ return new Property("rule", "",
13592          "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE,
13593          rule);
13594    case -772497791:
13595      /* legallyBinding[x] */ return new Property("legallyBinding[x]",
13596          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13597          "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.",
13598          0, 1, legallyBinding);
13599    case -126751329:
13600      /* legallyBinding */ return new Property("legallyBinding[x]",
13601          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13602          "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.",
13603          0, 1, legallyBinding);
13604    case 344057890:
13605      /* legallyBindingAttachment */ return new Property("legallyBinding[x]",
13606          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13607          "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.",
13608          0, 1, legallyBinding);
13609    case -296528788:
13610      /* legallyBindingReference */ return new Property("legallyBinding[x]",
13611          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13612          "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.",
13613          0, 1, legallyBinding);
13614    default:
13615      return super.getNamedProperty(_hash, _name, _checkValid);
13616    }
13617
13618  }
13619
13620  @Override
13621  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13622    switch (hash) {
13623    case -1618432855:
13624      /* identifier */ return this.identifier == null ? new Base[0]
13625          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
13626    case 116079:
13627      /* url */ return this.url == null ? new Base[0] : new Base[] { this.url }; // UriType
13628    case 351608024:
13629      /* version */ return this.version == null ? new Base[0] : new Base[] { this.version }; // StringType
13630    case -892481550:
13631      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ContractStatus>
13632    case 568606040:
13633      /* legalState */ return this.legalState == null ? new Base[0] : new Base[] { this.legalState }; // CodeableConcept
13634    case 8911915:
13635      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
13636          : new Base[] { this.instantiatesCanonical }; // Reference
13637    case -1926393373:
13638      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0] : new Base[] { this.instantiatesUri }; // UriType
13639    case -92412192:
13640      /* contentDerivative */ return this.contentDerivative == null ? new Base[0]
13641          : new Base[] { this.contentDerivative }; // CodeableConcept
13642    case -1179159893:
13643      /* issued */ return this.issued == null ? new Base[0] : new Base[] { this.issued }; // DateTimeType
13644    case -793235316:
13645      /* applies */ return this.applies == null ? new Base[0] : new Base[] { this.applies }; // Period
13646    case -668311927:
13647      /* expirationType */ return this.expirationType == null ? new Base[0] : new Base[] { this.expirationType }; // CodeableConcept
13648    case -1867885268:
13649      /* subject */ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
13650    case 1475610435:
13651      /* authority */ return this.authority == null ? new Base[0]
13652          : this.authority.toArray(new Base[this.authority.size()]); // Reference
13653    case -1326197564:
13654      /* domain */ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // Reference
13655    case 3530567:
13656      /* site */ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // Reference
13657    case 3373707:
13658      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
13659    case 110371416:
13660      /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
13661    case -2060497896:
13662      /* subtitle */ return this.subtitle == null ? new Base[0] : new Base[] { this.subtitle }; // StringType
13663    case 92902992:
13664      /* alias */ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
13665    case -1406328437:
13666      /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
13667    case 109264468:
13668      /* scope */ return this.scope == null ? new Base[0] : new Base[] { this.scope }; // CodeableConcept
13669    case 110546223:
13670      /* topic */ return this.topic == null ? new Base[0] : new Base[] { this.topic }; // Type
13671    case 3575610:
13672      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
13673    case -1868521062:
13674      /* subType */ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
13675    case 247055020:
13676      /* contentDefinition */ return this.contentDefinition == null ? new Base[0]
13677          : new Base[] { this.contentDefinition }; // ContentDefinitionComponent
13678    case 3556460:
13679      /* term */ return this.term == null ? new Base[0] : this.term.toArray(new Base[this.term.size()]); // TermComponent
13680    case 1922406657:
13681      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
13682          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
13683    case 1538891575:
13684      /* relevantHistory */ return this.relevantHistory == null ? new Base[0]
13685          : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
13686    case -902467798:
13687      /* signer */ return this.signer == null ? new Base[0] : this.signer.toArray(new Base[this.signer.size()]); // SignatoryComponent
13688    case -1423054677:
13689      /* friendly */ return this.friendly == null ? new Base[0] : this.friendly.toArray(new Base[this.friendly.size()]); // FriendlyLanguageComponent
13690    case 102851257:
13691      /* legal */ return this.legal == null ? new Base[0] : this.legal.toArray(new Base[this.legal.size()]); // LegalLanguageComponent
13692    case 3512060:
13693      /* rule */ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // ComputableLanguageComponent
13694    case -126751329:
13695      /* legallyBinding */ return this.legallyBinding == null ? new Base[0] : new Base[] { this.legallyBinding }; // Type
13696    default:
13697      return super.getProperty(hash, name, checkValid);
13698    }
13699
13700  }
13701
13702  @Override
13703  public Base setProperty(int hash, String name, Base value) throws FHIRException {
13704    switch (hash) {
13705    case -1618432855: // identifier
13706      this.getIdentifier().add(castToIdentifier(value)); // Identifier
13707      return value;
13708    case 116079: // url
13709      this.url = castToUri(value); // UriType
13710      return value;
13711    case 351608024: // version
13712      this.version = castToString(value); // StringType
13713      return value;
13714    case -892481550: // status
13715      value = new ContractStatusEnumFactory().fromType(castToCode(value));
13716      this.status = (Enumeration) value; // Enumeration<ContractStatus>
13717      return value;
13718    case 568606040: // legalState
13719      this.legalState = castToCodeableConcept(value); // CodeableConcept
13720      return value;
13721    case 8911915: // instantiatesCanonical
13722      this.instantiatesCanonical = castToReference(value); // Reference
13723      return value;
13724    case -1926393373: // instantiatesUri
13725      this.instantiatesUri = castToUri(value); // UriType
13726      return value;
13727    case -92412192: // contentDerivative
13728      this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
13729      return value;
13730    case -1179159893: // issued
13731      this.issued = castToDateTime(value); // DateTimeType
13732      return value;
13733    case -793235316: // applies
13734      this.applies = castToPeriod(value); // Period
13735      return value;
13736    case -668311927: // expirationType
13737      this.expirationType = castToCodeableConcept(value); // CodeableConcept
13738      return value;
13739    case -1867885268: // subject
13740      this.getSubject().add(castToReference(value)); // Reference
13741      return value;
13742    case 1475610435: // authority
13743      this.getAuthority().add(castToReference(value)); // Reference
13744      return value;
13745    case -1326197564: // domain
13746      this.getDomain().add(castToReference(value)); // Reference
13747      return value;
13748    case 3530567: // site
13749      this.getSite().add(castToReference(value)); // Reference
13750      return value;
13751    case 3373707: // name
13752      this.name = castToString(value); // StringType
13753      return value;
13754    case 110371416: // title
13755      this.title = castToString(value); // StringType
13756      return value;
13757    case -2060497896: // subtitle
13758      this.subtitle = castToString(value); // StringType
13759      return value;
13760    case 92902992: // alias
13761      this.getAlias().add(castToString(value)); // StringType
13762      return value;
13763    case -1406328437: // author
13764      this.author = castToReference(value); // Reference
13765      return value;
13766    case 109264468: // scope
13767      this.scope = castToCodeableConcept(value); // CodeableConcept
13768      return value;
13769    case 110546223: // topic
13770      this.topic = castToType(value); // Type
13771      return value;
13772    case 3575610: // type
13773      this.type = castToCodeableConcept(value); // CodeableConcept
13774      return value;
13775    case -1868521062: // subType
13776      this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
13777      return value;
13778    case 247055020: // contentDefinition
13779      this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
13780      return value;
13781    case 3556460: // term
13782      this.getTerm().add((TermComponent) value); // TermComponent
13783      return value;
13784    case 1922406657: // supportingInfo
13785      this.getSupportingInfo().add(castToReference(value)); // Reference
13786      return value;
13787    case 1538891575: // relevantHistory
13788      this.getRelevantHistory().add(castToReference(value)); // Reference
13789      return value;
13790    case -902467798: // signer
13791      this.getSigner().add((SignatoryComponent) value); // SignatoryComponent
13792      return value;
13793    case -1423054677: // friendly
13794      this.getFriendly().add((FriendlyLanguageComponent) value); // FriendlyLanguageComponent
13795      return value;
13796    case 102851257: // legal
13797      this.getLegal().add((LegalLanguageComponent) value); // LegalLanguageComponent
13798      return value;
13799    case 3512060: // rule
13800      this.getRule().add((ComputableLanguageComponent) value); // ComputableLanguageComponent
13801      return value;
13802    case -126751329: // legallyBinding
13803      this.legallyBinding = castToType(value); // Type
13804      return value;
13805    default:
13806      return super.setProperty(hash, name, value);
13807    }
13808
13809  }
13810
13811  @Override
13812  public Base setProperty(String name, Base value) throws FHIRException {
13813    if (name.equals("identifier")) {
13814      this.getIdentifier().add(castToIdentifier(value));
13815    } else if (name.equals("url")) {
13816      this.url = castToUri(value); // UriType
13817    } else if (name.equals("version")) {
13818      this.version = castToString(value); // StringType
13819    } else if (name.equals("status")) {
13820      value = new ContractStatusEnumFactory().fromType(castToCode(value));
13821      this.status = (Enumeration) value; // Enumeration<ContractStatus>
13822    } else if (name.equals("legalState")) {
13823      this.legalState = castToCodeableConcept(value); // CodeableConcept
13824    } else if (name.equals("instantiatesCanonical")) {
13825      this.instantiatesCanonical = castToReference(value); // Reference
13826    } else if (name.equals("instantiatesUri")) {
13827      this.instantiatesUri = castToUri(value); // UriType
13828    } else if (name.equals("contentDerivative")) {
13829      this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
13830    } else if (name.equals("issued")) {
13831      this.issued = castToDateTime(value); // DateTimeType
13832    } else if (name.equals("applies")) {
13833      this.applies = castToPeriod(value); // Period
13834    } else if (name.equals("expirationType")) {
13835      this.expirationType = castToCodeableConcept(value); // CodeableConcept
13836    } else if (name.equals("subject")) {
13837      this.getSubject().add(castToReference(value));
13838    } else if (name.equals("authority")) {
13839      this.getAuthority().add(castToReference(value));
13840    } else if (name.equals("domain")) {
13841      this.getDomain().add(castToReference(value));
13842    } else if (name.equals("site")) {
13843      this.getSite().add(castToReference(value));
13844    } else if (name.equals("name")) {
13845      this.name = castToString(value); // StringType
13846    } else if (name.equals("title")) {
13847      this.title = castToString(value); // StringType
13848    } else if (name.equals("subtitle")) {
13849      this.subtitle = castToString(value); // StringType
13850    } else if (name.equals("alias")) {
13851      this.getAlias().add(castToString(value));
13852    } else if (name.equals("author")) {
13853      this.author = castToReference(value); // Reference
13854    } else if (name.equals("scope")) {
13855      this.scope = castToCodeableConcept(value); // CodeableConcept
13856    } else if (name.equals("topic[x]")) {
13857      this.topic = castToType(value); // Type
13858    } else if (name.equals("type")) {
13859      this.type = castToCodeableConcept(value); // CodeableConcept
13860    } else if (name.equals("subType")) {
13861      this.getSubType().add(castToCodeableConcept(value));
13862    } else if (name.equals("contentDefinition")) {
13863      this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
13864    } else if (name.equals("term")) {
13865      this.getTerm().add((TermComponent) value);
13866    } else if (name.equals("supportingInfo")) {
13867      this.getSupportingInfo().add(castToReference(value));
13868    } else if (name.equals("relevantHistory")) {
13869      this.getRelevantHistory().add(castToReference(value));
13870    } else if (name.equals("signer")) {
13871      this.getSigner().add((SignatoryComponent) value);
13872    } else if (name.equals("friendly")) {
13873      this.getFriendly().add((FriendlyLanguageComponent) value);
13874    } else if (name.equals("legal")) {
13875      this.getLegal().add((LegalLanguageComponent) value);
13876    } else if (name.equals("rule")) {
13877      this.getRule().add((ComputableLanguageComponent) value);
13878    } else if (name.equals("legallyBinding[x]")) {
13879      this.legallyBinding = castToType(value); // Type
13880    } else
13881      return super.setProperty(name, value);
13882    return value;
13883  }
13884
13885  @Override
13886  public Base makeProperty(int hash, String name) throws FHIRException {
13887    switch (hash) {
13888    case -1618432855:
13889      return addIdentifier();
13890    case 116079:
13891      return getUrlElement();
13892    case 351608024:
13893      return getVersionElement();
13894    case -892481550:
13895      return getStatusElement();
13896    case 568606040:
13897      return getLegalState();
13898    case 8911915:
13899      return getInstantiatesCanonical();
13900    case -1926393373:
13901      return getInstantiatesUriElement();
13902    case -92412192:
13903      return getContentDerivative();
13904    case -1179159893:
13905      return getIssuedElement();
13906    case -793235316:
13907      return getApplies();
13908    case -668311927:
13909      return getExpirationType();
13910    case -1867885268:
13911      return addSubject();
13912    case 1475610435:
13913      return addAuthority();
13914    case -1326197564:
13915      return addDomain();
13916    case 3530567:
13917      return addSite();
13918    case 3373707:
13919      return getNameElement();
13920    case 110371416:
13921      return getTitleElement();
13922    case -2060497896:
13923      return getSubtitleElement();
13924    case 92902992:
13925      return addAliasElement();
13926    case -1406328437:
13927      return getAuthor();
13928    case 109264468:
13929      return getScope();
13930    case -957295375:
13931      return getTopic();
13932    case 110546223:
13933      return getTopic();
13934    case 3575610:
13935      return getType();
13936    case -1868521062:
13937      return addSubType();
13938    case 247055020:
13939      return getContentDefinition();
13940    case 3556460:
13941      return addTerm();
13942    case 1922406657:
13943      return addSupportingInfo();
13944    case 1538891575:
13945      return addRelevantHistory();
13946    case -902467798:
13947      return addSigner();
13948    case -1423054677:
13949      return addFriendly();
13950    case 102851257:
13951      return addLegal();
13952    case 3512060:
13953      return addRule();
13954    case -772497791:
13955      return getLegallyBinding();
13956    case -126751329:
13957      return getLegallyBinding();
13958    default:
13959      return super.makeProperty(hash, name);
13960    }
13961
13962  }
13963
13964  @Override
13965  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13966    switch (hash) {
13967    case -1618432855:
13968      /* identifier */ return new String[] { "Identifier" };
13969    case 116079:
13970      /* url */ return new String[] { "uri" };
13971    case 351608024:
13972      /* version */ return new String[] { "string" };
13973    case -892481550:
13974      /* status */ return new String[] { "code" };
13975    case 568606040:
13976      /* legalState */ return new String[] { "CodeableConcept" };
13977    case 8911915:
13978      /* instantiatesCanonical */ return new String[] { "Reference" };
13979    case -1926393373:
13980      /* instantiatesUri */ return new String[] { "uri" };
13981    case -92412192:
13982      /* contentDerivative */ return new String[] { "CodeableConcept" };
13983    case -1179159893:
13984      /* issued */ return new String[] { "dateTime" };
13985    case -793235316:
13986      /* applies */ return new String[] { "Period" };
13987    case -668311927:
13988      /* expirationType */ return new String[] { "CodeableConcept" };
13989    case -1867885268:
13990      /* subject */ return new String[] { "Reference" };
13991    case 1475610435:
13992      /* authority */ return new String[] { "Reference" };
13993    case -1326197564:
13994      /* domain */ return new String[] { "Reference" };
13995    case 3530567:
13996      /* site */ return new String[] { "Reference" };
13997    case 3373707:
13998      /* name */ return new String[] { "string" };
13999    case 110371416:
14000      /* title */ return new String[] { "string" };
14001    case -2060497896:
14002      /* subtitle */ return new String[] { "string" };
14003    case 92902992:
14004      /* alias */ return new String[] { "string" };
14005    case -1406328437:
14006      /* author */ return new String[] { "Reference" };
14007    case 109264468:
14008      /* scope */ return new String[] { "CodeableConcept" };
14009    case 110546223:
14010      /* topic */ return new String[] { "CodeableConcept", "Reference" };
14011    case 3575610:
14012      /* type */ return new String[] { "CodeableConcept" };
14013    case -1868521062:
14014      /* subType */ return new String[] { "CodeableConcept" };
14015    case 247055020:
14016      /* contentDefinition */ return new String[] {};
14017    case 3556460:
14018      /* term */ return new String[] {};
14019    case 1922406657:
14020      /* supportingInfo */ return new String[] { "Reference" };
14021    case 1538891575:
14022      /* relevantHistory */ return new String[] { "Reference" };
14023    case -902467798:
14024      /* signer */ return new String[] {};
14025    case -1423054677:
14026      /* friendly */ return new String[] {};
14027    case 102851257:
14028      /* legal */ return new String[] {};
14029    case 3512060:
14030      /* rule */ return new String[] {};
14031    case -126751329:
14032      /* legallyBinding */ return new String[] { "Attachment", "Reference" };
14033    default:
14034      return super.getTypesForProperty(hash, name);
14035    }
14036
14037  }
14038
14039  @Override
14040  public Base addChild(String name) throws FHIRException {
14041    if (name.equals("identifier")) {
14042      return addIdentifier();
14043    } else if (name.equals("url")) {
14044      throw new FHIRException("Cannot call addChild on a singleton property Contract.url");
14045    } else if (name.equals("version")) {
14046      throw new FHIRException("Cannot call addChild on a singleton property Contract.version");
14047    } else if (name.equals("status")) {
14048      throw new FHIRException("Cannot call addChild on a singleton property Contract.status");
14049    } else if (name.equals("legalState")) {
14050      this.legalState = new CodeableConcept();
14051      return this.legalState;
14052    } else if (name.equals("instantiatesCanonical")) {
14053      this.instantiatesCanonical = new Reference();
14054      return this.instantiatesCanonical;
14055    } else if (name.equals("instantiatesUri")) {
14056      throw new FHIRException("Cannot call addChild on a singleton property Contract.instantiatesUri");
14057    } else if (name.equals("contentDerivative")) {
14058      this.contentDerivative = new CodeableConcept();
14059      return this.contentDerivative;
14060    } else if (name.equals("issued")) {
14061      throw new FHIRException("Cannot call addChild on a singleton property Contract.issued");
14062    } else if (name.equals("applies")) {
14063      this.applies = new Period();
14064      return this.applies;
14065    } else if (name.equals("expirationType")) {
14066      this.expirationType = new CodeableConcept();
14067      return this.expirationType;
14068    } else if (name.equals("subject")) {
14069      return addSubject();
14070    } else if (name.equals("authority")) {
14071      return addAuthority();
14072    } else if (name.equals("domain")) {
14073      return addDomain();
14074    } else if (name.equals("site")) {
14075      return addSite();
14076    } else if (name.equals("name")) {
14077      throw new FHIRException("Cannot call addChild on a singleton property Contract.name");
14078    } else if (name.equals("title")) {
14079      throw new FHIRException("Cannot call addChild on a singleton property Contract.title");
14080    } else if (name.equals("subtitle")) {
14081      throw new FHIRException("Cannot call addChild on a singleton property Contract.subtitle");
14082    } else if (name.equals("alias")) {
14083      throw new FHIRException("Cannot call addChild on a singleton property Contract.alias");
14084    } else if (name.equals("author")) {
14085      this.author = new Reference();
14086      return this.author;
14087    } else if (name.equals("scope")) {
14088      this.scope = new CodeableConcept();
14089      return this.scope;
14090    } else if (name.equals("topicCodeableConcept")) {
14091      this.topic = new CodeableConcept();
14092      return this.topic;
14093    } else if (name.equals("topicReference")) {
14094      this.topic = new Reference();
14095      return this.topic;
14096    } else if (name.equals("type")) {
14097      this.type = new CodeableConcept();
14098      return this.type;
14099    } else if (name.equals("subType")) {
14100      return addSubType();
14101    } else if (name.equals("contentDefinition")) {
14102      this.contentDefinition = new ContentDefinitionComponent();
14103      return this.contentDefinition;
14104    } else if (name.equals("term")) {
14105      return addTerm();
14106    } else if (name.equals("supportingInfo")) {
14107      return addSupportingInfo();
14108    } else if (name.equals("relevantHistory")) {
14109      return addRelevantHistory();
14110    } else if (name.equals("signer")) {
14111      return addSigner();
14112    } else if (name.equals("friendly")) {
14113      return addFriendly();
14114    } else if (name.equals("legal")) {
14115      return addLegal();
14116    } else if (name.equals("rule")) {
14117      return addRule();
14118    } else if (name.equals("legallyBindingAttachment")) {
14119      this.legallyBinding = new Attachment();
14120      return this.legallyBinding;
14121    } else if (name.equals("legallyBindingReference")) {
14122      this.legallyBinding = new Reference();
14123      return this.legallyBinding;
14124    } else
14125      return super.addChild(name);
14126  }
14127
14128  public String fhirType() {
14129    return "Contract";
14130
14131  }
14132
14133  public Contract copy() {
14134    Contract dst = new Contract();
14135    copyValues(dst);
14136    return dst;
14137  }
14138
14139  public void copyValues(Contract dst) {
14140    super.copyValues(dst);
14141    if (identifier != null) {
14142      dst.identifier = new ArrayList<Identifier>();
14143      for (Identifier i : identifier)
14144        dst.identifier.add(i.copy());
14145    }
14146    ;
14147    dst.url = url == null ? null : url.copy();
14148    dst.version = version == null ? null : version.copy();
14149    dst.status = status == null ? null : status.copy();
14150    dst.legalState = legalState == null ? null : legalState.copy();
14151    dst.instantiatesCanonical = instantiatesCanonical == null ? null : instantiatesCanonical.copy();
14152    dst.instantiatesUri = instantiatesUri == null ? null : instantiatesUri.copy();
14153    dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
14154    dst.issued = issued == null ? null : issued.copy();
14155    dst.applies = applies == null ? null : applies.copy();
14156    dst.expirationType = expirationType == null ? null : expirationType.copy();
14157    if (subject != null) {
14158      dst.subject = new ArrayList<Reference>();
14159      for (Reference i : subject)
14160        dst.subject.add(i.copy());
14161    }
14162    ;
14163    if (authority != null) {
14164      dst.authority = new ArrayList<Reference>();
14165      for (Reference i : authority)
14166        dst.authority.add(i.copy());
14167    }
14168    ;
14169    if (domain != null) {
14170      dst.domain = new ArrayList<Reference>();
14171      for (Reference i : domain)
14172        dst.domain.add(i.copy());
14173    }
14174    ;
14175    if (site != null) {
14176      dst.site = new ArrayList<Reference>();
14177      for (Reference i : site)
14178        dst.site.add(i.copy());
14179    }
14180    ;
14181    dst.name = name == null ? null : name.copy();
14182    dst.title = title == null ? null : title.copy();
14183    dst.subtitle = subtitle == null ? null : subtitle.copy();
14184    if (alias != null) {
14185      dst.alias = new ArrayList<StringType>();
14186      for (StringType i : alias)
14187        dst.alias.add(i.copy());
14188    }
14189    ;
14190    dst.author = author == null ? null : author.copy();
14191    dst.scope = scope == null ? null : scope.copy();
14192    dst.topic = topic == null ? null : topic.copy();
14193    dst.type = type == null ? null : type.copy();
14194    if (subType != null) {
14195      dst.subType = new ArrayList<CodeableConcept>();
14196      for (CodeableConcept i : subType)
14197        dst.subType.add(i.copy());
14198    }
14199    ;
14200    dst.contentDefinition = contentDefinition == null ? null : contentDefinition.copy();
14201    if (term != null) {
14202      dst.term = new ArrayList<TermComponent>();
14203      for (TermComponent i : term)
14204        dst.term.add(i.copy());
14205    }
14206    ;
14207    if (supportingInfo != null) {
14208      dst.supportingInfo = new ArrayList<Reference>();
14209      for (Reference i : supportingInfo)
14210        dst.supportingInfo.add(i.copy());
14211    }
14212    ;
14213    if (relevantHistory != null) {
14214      dst.relevantHistory = new ArrayList<Reference>();
14215      for (Reference i : relevantHistory)
14216        dst.relevantHistory.add(i.copy());
14217    }
14218    ;
14219    if (signer != null) {
14220      dst.signer = new ArrayList<SignatoryComponent>();
14221      for (SignatoryComponent i : signer)
14222        dst.signer.add(i.copy());
14223    }
14224    ;
14225    if (friendly != null) {
14226      dst.friendly = new ArrayList<FriendlyLanguageComponent>();
14227      for (FriendlyLanguageComponent i : friendly)
14228        dst.friendly.add(i.copy());
14229    }
14230    ;
14231    if (legal != null) {
14232      dst.legal = new ArrayList<LegalLanguageComponent>();
14233      for (LegalLanguageComponent i : legal)
14234        dst.legal.add(i.copy());
14235    }
14236    ;
14237    if (rule != null) {
14238      dst.rule = new ArrayList<ComputableLanguageComponent>();
14239      for (ComputableLanguageComponent i : rule)
14240        dst.rule.add(i.copy());
14241    }
14242    ;
14243    dst.legallyBinding = legallyBinding == null ? null : legallyBinding.copy();
14244  }
14245
14246  protected Contract typedCopy() {
14247    return copy();
14248  }
14249
14250  @Override
14251  public boolean equalsDeep(Base other_) {
14252    if (!super.equalsDeep(other_))
14253      return false;
14254    if (!(other_ instanceof Contract))
14255      return false;
14256    Contract o = (Contract) other_;
14257    return compareDeep(identifier, o.identifier, true) && compareDeep(url, o.url, true)
14258        && compareDeep(version, o.version, true) && compareDeep(status, o.status, true)
14259        && compareDeep(legalState, o.legalState, true)
14260        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
14261        && compareDeep(instantiatesUri, o.instantiatesUri, true)
14262        && compareDeep(contentDerivative, o.contentDerivative, true) && compareDeep(issued, o.issued, true)
14263        && compareDeep(applies, o.applies, true) && compareDeep(expirationType, o.expirationType, true)
14264        && compareDeep(subject, o.subject, true) && compareDeep(authority, o.authority, true)
14265        && compareDeep(domain, o.domain, true) && compareDeep(site, o.site, true) && compareDeep(name, o.name, true)
14266        && compareDeep(title, o.title, true) && compareDeep(subtitle, o.subtitle, true)
14267        && compareDeep(alias, o.alias, true) && compareDeep(author, o.author, true) && compareDeep(scope, o.scope, true)
14268        && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
14269        && compareDeep(contentDefinition, o.contentDefinition, true) && compareDeep(term, o.term, true)
14270        && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(relevantHistory, o.relevantHistory, true)
14271        && compareDeep(signer, o.signer, true) && compareDeep(friendly, o.friendly, true)
14272        && compareDeep(legal, o.legal, true) && compareDeep(rule, o.rule, true)
14273        && compareDeep(legallyBinding, o.legallyBinding, true);
14274  }
14275
14276  @Override
14277  public boolean equalsShallow(Base other_) {
14278    if (!super.equalsShallow(other_))
14279      return false;
14280    if (!(other_ instanceof Contract))
14281      return false;
14282    Contract o = (Contract) other_;
14283    return compareValues(url, o.url, true) && compareValues(version, o.version, true)
14284        && compareValues(status, o.status, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
14285        && compareValues(issued, o.issued, true) && compareValues(name, o.name, true)
14286        && compareValues(title, o.title, true) && compareValues(subtitle, o.subtitle, true)
14287        && compareValues(alias, o.alias, true);
14288  }
14289
14290  public boolean isEmpty() {
14291    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, url, version, status, legalState,
14292        instantiatesCanonical, instantiatesUri, contentDerivative, issued, applies, expirationType, subject, authority,
14293        domain, site, name, title, subtitle, alias, author, scope, topic, type, subType, contentDefinition, term,
14294        supportingInfo, relevantHistory, signer, friendly, legal, rule, legallyBinding);
14295  }
14296
14297  @Override
14298  public ResourceType getResourceType() {
14299    return ResourceType.Contract;
14300  }
14301
14302  /**
14303   * Search parameter: <b>identifier</b>
14304   * <p>
14305   * Description: <b>The identity of the contract</b><br>
14306   * Type: <b>token</b><br>
14307   * Path: <b>Contract.identifier</b><br>
14308   * </p>
14309   */
14310  @SearchParamDefinition(name = "identifier", path = "Contract.identifier", description = "The identity of the contract", type = "token")
14311  public static final String SP_IDENTIFIER = "identifier";
14312  /**
14313   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
14314   * <p>
14315   * Description: <b>The identity of the contract</b><br>
14316   * Type: <b>token</b><br>
14317   * Path: <b>Contract.identifier</b><br>
14318   * </p>
14319   */
14320  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
14321      SP_IDENTIFIER);
14322
14323  /**
14324   * Search parameter: <b>instantiates</b>
14325   * <p>
14326   * Description: <b>A source definition of the contract</b><br>
14327   * Type: <b>uri</b><br>
14328   * Path: <b>Contract.instantiatesUri</b><br>
14329   * </p>
14330   */
14331  @SearchParamDefinition(name = "instantiates", path = "Contract.instantiatesUri", description = "A source definition of the contract", type = "uri")
14332  public static final String SP_INSTANTIATES = "instantiates";
14333  /**
14334   * <b>Fluent Client</b> search parameter constant for <b>instantiates</b>
14335   * <p>
14336   * Description: <b>A source definition of the contract</b><br>
14337   * Type: <b>uri</b><br>
14338   * Path: <b>Contract.instantiatesUri</b><br>
14339   * </p>
14340   */
14341  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES = new ca.uhn.fhir.rest.gclient.UriClientParam(
14342      SP_INSTANTIATES);
14343
14344  /**
14345   * Search parameter: <b>patient</b>
14346   * <p>
14347   * Description: <b>The identity of the subject of the contract (if a
14348   * patient)</b><br>
14349   * Type: <b>reference</b><br>
14350   * Path: <b>Contract.subject</b><br>
14351   * </p>
14352   */
14353  @SearchParamDefinition(name = "patient", path = "Contract.subject.where(resolve() is Patient)", description = "The identity of the subject of the contract (if a patient)", type = "reference", target = {
14354      Patient.class })
14355  public static final String SP_PATIENT = "patient";
14356  /**
14357   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
14358   * <p>
14359   * Description: <b>The identity of the subject of the contract (if a
14360   * patient)</b><br>
14361   * Type: <b>reference</b><br>
14362   * Path: <b>Contract.subject</b><br>
14363   * </p>
14364   */
14365  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14366      SP_PATIENT);
14367
14368  /**
14369   * Constant for fluent queries to be used to add include statements. Specifies
14370   * the path value of "<b>Contract:patient</b>".
14371   */
14372  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
14373      "Contract:patient").toLocked();
14374
14375  /**
14376   * Search parameter: <b>subject</b>
14377   * <p>
14378   * Description: <b>The identity of the subject of the contract</b><br>
14379   * Type: <b>reference</b><br>
14380   * Path: <b>Contract.subject</b><br>
14381   * </p>
14382   */
14383  @SearchParamDefinition(name = "subject", path = "Contract.subject", description = "The identity of the subject of the contract", type = "reference")
14384  public static final String SP_SUBJECT = "subject";
14385  /**
14386   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
14387   * <p>
14388   * Description: <b>The identity of the subject of the contract</b><br>
14389   * Type: <b>reference</b><br>
14390   * Path: <b>Contract.subject</b><br>
14391   * </p>
14392   */
14393  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14394      SP_SUBJECT);
14395
14396  /**
14397   * Constant for fluent queries to be used to add include statements. Specifies
14398   * the path value of "<b>Contract:subject</b>".
14399   */
14400  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
14401      "Contract:subject").toLocked();
14402
14403  /**
14404   * Search parameter: <b>authority</b>
14405   * <p>
14406   * Description: <b>The authority of the contract</b><br>
14407   * Type: <b>reference</b><br>
14408   * Path: <b>Contract.authority</b><br>
14409   * </p>
14410   */
14411  @SearchParamDefinition(name = "authority", path = "Contract.authority", description = "The authority of the contract", type = "reference", target = {
14412      Organization.class })
14413  public static final String SP_AUTHORITY = "authority";
14414  /**
14415   * <b>Fluent Client</b> search parameter constant for <b>authority</b>
14416   * <p>
14417   * Description: <b>The authority of the contract</b><br>
14418   * Type: <b>reference</b><br>
14419   * Path: <b>Contract.authority</b><br>
14420   * </p>
14421   */
14422  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHORITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14423      SP_AUTHORITY);
14424
14425  /**
14426   * Constant for fluent queries to be used to add include statements. Specifies
14427   * the path value of "<b>Contract:authority</b>".
14428   */
14429  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHORITY = new ca.uhn.fhir.model.api.Include(
14430      "Contract:authority").toLocked();
14431
14432  /**
14433   * Search parameter: <b>domain</b>
14434   * <p>
14435   * Description: <b>The domain of the contract</b><br>
14436   * Type: <b>reference</b><br>
14437   * Path: <b>Contract.domain</b><br>
14438   * </p>
14439   */
14440  @SearchParamDefinition(name = "domain", path = "Contract.domain", description = "The domain of the contract", type = "reference", target = {
14441      Location.class })
14442  public static final String SP_DOMAIN = "domain";
14443  /**
14444   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
14445   * <p>
14446   * Description: <b>The domain of the contract</b><br>
14447   * Type: <b>reference</b><br>
14448   * Path: <b>Contract.domain</b><br>
14449   * </p>
14450   */
14451  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14452      SP_DOMAIN);
14453
14454  /**
14455   * Constant for fluent queries to be used to add include statements. Specifies
14456   * the path value of "<b>Contract:domain</b>".
14457   */
14458  public static final ca.uhn.fhir.model.api.Include INCLUDE_DOMAIN = new ca.uhn.fhir.model.api.Include(
14459      "Contract:domain").toLocked();
14460
14461  /**
14462   * Search parameter: <b>issued</b>
14463   * <p>
14464   * Description: <b>The date/time the contract was issued</b><br>
14465   * Type: <b>date</b><br>
14466   * Path: <b>Contract.issued</b><br>
14467   * </p>
14468   */
14469  @SearchParamDefinition(name = "issued", path = "Contract.issued", description = "The date/time the contract was issued", type = "date")
14470  public static final String SP_ISSUED = "issued";
14471  /**
14472   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
14473   * <p>
14474   * Description: <b>The date/time the contract was issued</b><br>
14475   * Type: <b>date</b><br>
14476   * Path: <b>Contract.issued</b><br>
14477   * </p>
14478   */
14479  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(
14480      SP_ISSUED);
14481
14482  /**
14483   * Search parameter: <b>url</b>
14484   * <p>
14485   * Description: <b>The basal contract definition</b><br>
14486   * Type: <b>uri</b><br>
14487   * Path: <b>Contract.url</b><br>
14488   * </p>
14489   */
14490  @SearchParamDefinition(name = "url", path = "Contract.url", description = "The basal contract definition", type = "uri")
14491  public static final String SP_URL = "url";
14492  /**
14493   * <b>Fluent Client</b> search parameter constant for <b>url</b>
14494   * <p>
14495   * Description: <b>The basal contract definition</b><br>
14496   * Type: <b>uri</b><br>
14497   * Path: <b>Contract.url</b><br>
14498   * </p>
14499   */
14500  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
14501
14502  /**
14503   * Search parameter: <b>signer</b>
14504   * <p>
14505   * Description: <b>Contract Signatory Party</b><br>
14506   * Type: <b>reference</b><br>
14507   * Path: <b>Contract.signer.party</b><br>
14508   * </p>
14509   */
14510  @SearchParamDefinition(name = "signer", path = "Contract.signer.party", description = "Contract Signatory Party", type = "reference", target = {
14511      Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
14512  public static final String SP_SIGNER = "signer";
14513  /**
14514   * <b>Fluent Client</b> search parameter constant for <b>signer</b>
14515   * <p>
14516   * Description: <b>Contract Signatory Party</b><br>
14517   * Type: <b>reference</b><br>
14518   * Path: <b>Contract.signer.party</b><br>
14519   * </p>
14520   */
14521  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SIGNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14522      SP_SIGNER);
14523
14524  /**
14525   * Constant for fluent queries to be used to add include statements. Specifies
14526   * the path value of "<b>Contract:signer</b>".
14527   */
14528  public static final ca.uhn.fhir.model.api.Include INCLUDE_SIGNER = new ca.uhn.fhir.model.api.Include(
14529      "Contract:signer").toLocked();
14530
14531  /**
14532   * Search parameter: <b>status</b>
14533   * <p>
14534   * Description: <b>The status of the contract</b><br>
14535   * Type: <b>token</b><br>
14536   * Path: <b>Contract.status</b><br>
14537   * </p>
14538   */
14539  @SearchParamDefinition(name = "status", path = "Contract.status", description = "The status of the contract", type = "token")
14540  public static final String SP_STATUS = "status";
14541  /**
14542   * <b>Fluent Client</b> search parameter constant for <b>status</b>
14543   * <p>
14544   * Description: <b>The status of the contract</b><br>
14545   * Type: <b>token</b><br>
14546   * Path: <b>Contract.status</b><br>
14547   * </p>
14548   */
14549  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
14550      SP_STATUS);
14551
14552}