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