001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care for a patient.
047 */
048@ResourceDef(name="CareTeam", profile="http://hl7.org/fhir/Profile/CareTeam")
049public class CareTeam extends DomainResource {
050
051    public enum CareTeamStatus {
052        /**
053         * The care team has been drafted and proposed, but not yet participating in the coordination and delivery of care.
054         */
055        PROPOSED, 
056        /**
057         * The care team is currently participating in the coordination and delivery of care.
058         */
059        ACTIVE, 
060        /**
061         * The care team is temporarily on hold or suspended and not participating in the coordination and delivery of care.
062         */
063        SUSPENDED, 
064        /**
065         * The care team was, but is no longer, participating in the coordination and delivery of care.
066         */
067        INACTIVE, 
068        /**
069         * The care team should have never existed.
070         */
071        ENTEREDINERROR, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static CareTeamStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("proposed".equals(codeString))
080          return PROPOSED;
081        if ("active".equals(codeString))
082          return ACTIVE;
083        if ("suspended".equals(codeString))
084          return SUSPENDED;
085        if ("inactive".equals(codeString))
086          return INACTIVE;
087        if ("entered-in-error".equals(codeString))
088          return ENTEREDINERROR;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown CareTeamStatus code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case PROPOSED: return "proposed";
097            case ACTIVE: return "active";
098            case SUSPENDED: return "suspended";
099            case INACTIVE: return "inactive";
100            case ENTEREDINERROR: return "entered-in-error";
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case PROPOSED: return "http://hl7.org/fhir/care-team-status";
107            case ACTIVE: return "http://hl7.org/fhir/care-team-status";
108            case SUSPENDED: return "http://hl7.org/fhir/care-team-status";
109            case INACTIVE: return "http://hl7.org/fhir/care-team-status";
110            case ENTEREDINERROR: return "http://hl7.org/fhir/care-team-status";
111            default: return "?";
112          }
113        }
114        public String getDefinition() {
115          switch (this) {
116            case PROPOSED: return "The care team has been drafted and proposed, but not yet participating in the coordination and delivery of care.";
117            case ACTIVE: return "The care team is currently participating in the coordination and delivery of care.";
118            case SUSPENDED: return "The care team is temporarily on hold or suspended and not participating in the coordination and delivery of care.";
119            case INACTIVE: return "The care team was, but is no longer, participating in the coordination and delivery of care.";
120            case ENTEREDINERROR: return "The care team should have never existed.";
121            default: return "?";
122          }
123        }
124        public String getDisplay() {
125          switch (this) {
126            case PROPOSED: return "Proposed";
127            case ACTIVE: return "Active";
128            case SUSPENDED: return "Suspended";
129            case INACTIVE: return "Inactive";
130            case ENTEREDINERROR: return "Entered In Error";
131            default: return "?";
132          }
133        }
134    }
135
136  public static class CareTeamStatusEnumFactory implements EnumFactory<CareTeamStatus> {
137    public CareTeamStatus fromCode(String codeString) throws IllegalArgumentException {
138      if (codeString == null || "".equals(codeString))
139            if (codeString == null || "".equals(codeString))
140                return null;
141        if ("proposed".equals(codeString))
142          return CareTeamStatus.PROPOSED;
143        if ("active".equals(codeString))
144          return CareTeamStatus.ACTIVE;
145        if ("suspended".equals(codeString))
146          return CareTeamStatus.SUSPENDED;
147        if ("inactive".equals(codeString))
148          return CareTeamStatus.INACTIVE;
149        if ("entered-in-error".equals(codeString))
150          return CareTeamStatus.ENTEREDINERROR;
151        throw new IllegalArgumentException("Unknown CareTeamStatus code '"+codeString+"'");
152        }
153        public Enumeration<CareTeamStatus> fromType(Base code) throws FHIRException {
154          if (code == null)
155            return null;
156          if (code.isEmpty())
157            return new Enumeration<CareTeamStatus>(this);
158          String codeString = ((PrimitiveType) code).asStringValue();
159          if (codeString == null || "".equals(codeString))
160            return null;
161        if ("proposed".equals(codeString))
162          return new Enumeration<CareTeamStatus>(this, CareTeamStatus.PROPOSED);
163        if ("active".equals(codeString))
164          return new Enumeration<CareTeamStatus>(this, CareTeamStatus.ACTIVE);
165        if ("suspended".equals(codeString))
166          return new Enumeration<CareTeamStatus>(this, CareTeamStatus.SUSPENDED);
167        if ("inactive".equals(codeString))
168          return new Enumeration<CareTeamStatus>(this, CareTeamStatus.INACTIVE);
169        if ("entered-in-error".equals(codeString))
170          return new Enumeration<CareTeamStatus>(this, CareTeamStatus.ENTEREDINERROR);
171        throw new FHIRException("Unknown CareTeamStatus code '"+codeString+"'");
172        }
173    public String toCode(CareTeamStatus code) {
174      if (code == CareTeamStatus.PROPOSED)
175        return "proposed";
176      if (code == CareTeamStatus.ACTIVE)
177        return "active";
178      if (code == CareTeamStatus.SUSPENDED)
179        return "suspended";
180      if (code == CareTeamStatus.INACTIVE)
181        return "inactive";
182      if (code == CareTeamStatus.ENTEREDINERROR)
183        return "entered-in-error";
184      return "?";
185      }
186    public String toSystem(CareTeamStatus code) {
187      return code.getSystem();
188      }
189    }
190
191    @Block()
192    public static class CareTeamParticipantComponent extends BackboneElement implements IBaseBackboneElement {
193        /**
194         * Indicates specific responsibility of an individual within the care team, such as "Primary care physician", "Trained social worker counselor", "Caregiver", etc.
195         */
196        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
197        @Description(shortDefinition="Type of involvement", formalDefinition="Indicates specific responsibility of an individual within the care team, such as \"Primary care physician\", \"Trained social worker counselor\", \"Caregiver\", etc." )
198        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-role")
199        protected CodeableConcept role;
200
201        /**
202         * The specific person or organization who is participating/expected to participate in the care team.
203         */
204        @Child(name = "member", type = {Practitioner.class, RelatedPerson.class, Patient.class, Organization.class, CareTeam.class}, order=2, min=0, max=1, modifier=false, summary=true)
205        @Description(shortDefinition="Who is involved", formalDefinition="The specific person or organization who is participating/expected to participate in the care team." )
206        protected Reference member;
207
208        /**
209         * The actual object that is the target of the reference (The specific person or organization who is participating/expected to participate in the care team.)
210         */
211        protected Resource memberTarget;
212
213        /**
214         * The organization of the practitioner.
215         */
216        @Child(name = "onBehalfOf", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
217        @Description(shortDefinition="Organization of the practitioner", formalDefinition="The organization of the practitioner." )
218        protected Reference onBehalfOf;
219
220        /**
221         * The actual object that is the target of the reference (The organization of the practitioner.)
222         */
223        protected Organization onBehalfOfTarget;
224
225        /**
226         * Indicates when the specific member or organization did (or is intended to) come into effect and end.
227         */
228        @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
229        @Description(shortDefinition="Time period of participant", formalDefinition="Indicates when the specific member or organization did (or is intended to) come into effect and end." )
230        protected Period period;
231
232        private static final long serialVersionUID = -1363308804L;
233
234    /**
235     * Constructor
236     */
237      public CareTeamParticipantComponent() {
238        super();
239      }
240
241        /**
242         * @return {@link #role} (Indicates specific responsibility of an individual within the care team, such as "Primary care physician", "Trained social worker counselor", "Caregiver", etc.)
243         */
244        public CodeableConcept getRole() { 
245          if (this.role == null)
246            if (Configuration.errorOnAutoCreate())
247              throw new Error("Attempt to auto-create CareTeamParticipantComponent.role");
248            else if (Configuration.doAutoCreate())
249              this.role = new CodeableConcept(); // cc
250          return this.role;
251        }
252
253        public boolean hasRole() { 
254          return this.role != null && !this.role.isEmpty();
255        }
256
257        /**
258         * @param value {@link #role} (Indicates specific responsibility of an individual within the care team, such as "Primary care physician", "Trained social worker counselor", "Caregiver", etc.)
259         */
260        public CareTeamParticipantComponent setRole(CodeableConcept value) { 
261          this.role = value;
262          return this;
263        }
264
265        /**
266         * @return {@link #member} (The specific person or organization who is participating/expected to participate in the care team.)
267         */
268        public Reference getMember() { 
269          if (this.member == null)
270            if (Configuration.errorOnAutoCreate())
271              throw new Error("Attempt to auto-create CareTeamParticipantComponent.member");
272            else if (Configuration.doAutoCreate())
273              this.member = new Reference(); // cc
274          return this.member;
275        }
276
277        public boolean hasMember() { 
278          return this.member != null && !this.member.isEmpty();
279        }
280
281        /**
282         * @param value {@link #member} (The specific person or organization who is participating/expected to participate in the care team.)
283         */
284        public CareTeamParticipantComponent setMember(Reference value) { 
285          this.member = value;
286          return this;
287        }
288
289        /**
290         * @return {@link #member} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The specific person or organization who is participating/expected to participate in the care team.)
291         */
292        public Resource getMemberTarget() { 
293          return this.memberTarget;
294        }
295
296        /**
297         * @param value {@link #member} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The specific person or organization who is participating/expected to participate in the care team.)
298         */
299        public CareTeamParticipantComponent setMemberTarget(Resource value) { 
300          this.memberTarget = value;
301          return this;
302        }
303
304        /**
305         * @return {@link #onBehalfOf} (The organization of the practitioner.)
306         */
307        public Reference getOnBehalfOf() { 
308          if (this.onBehalfOf == null)
309            if (Configuration.errorOnAutoCreate())
310              throw new Error("Attempt to auto-create CareTeamParticipantComponent.onBehalfOf");
311            else if (Configuration.doAutoCreate())
312              this.onBehalfOf = new Reference(); // cc
313          return this.onBehalfOf;
314        }
315
316        public boolean hasOnBehalfOf() { 
317          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
318        }
319
320        /**
321         * @param value {@link #onBehalfOf} (The organization of the practitioner.)
322         */
323        public CareTeamParticipantComponent setOnBehalfOf(Reference value) { 
324          this.onBehalfOf = value;
325          return this;
326        }
327
328        /**
329         * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization of the practitioner.)
330         */
331        public Organization getOnBehalfOfTarget() { 
332          if (this.onBehalfOfTarget == null)
333            if (Configuration.errorOnAutoCreate())
334              throw new Error("Attempt to auto-create CareTeamParticipantComponent.onBehalfOf");
335            else if (Configuration.doAutoCreate())
336              this.onBehalfOfTarget = new Organization(); // aa
337          return this.onBehalfOfTarget;
338        }
339
340        /**
341         * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization of the practitioner.)
342         */
343        public CareTeamParticipantComponent setOnBehalfOfTarget(Organization value) { 
344          this.onBehalfOfTarget = value;
345          return this;
346        }
347
348        /**
349         * @return {@link #period} (Indicates when the specific member or organization did (or is intended to) come into effect and end.)
350         */
351        public Period getPeriod() { 
352          if (this.period == null)
353            if (Configuration.errorOnAutoCreate())
354              throw new Error("Attempt to auto-create CareTeamParticipantComponent.period");
355            else if (Configuration.doAutoCreate())
356              this.period = new Period(); // cc
357          return this.period;
358        }
359
360        public boolean hasPeriod() { 
361          return this.period != null && !this.period.isEmpty();
362        }
363
364        /**
365         * @param value {@link #period} (Indicates when the specific member or organization did (or is intended to) come into effect and end.)
366         */
367        public CareTeamParticipantComponent setPeriod(Period value) { 
368          this.period = value;
369          return this;
370        }
371
372        protected void listChildren(List<Property> childrenList) {
373          super.listChildren(childrenList);
374          childrenList.add(new Property("role", "CodeableConcept", "Indicates specific responsibility of an individual within the care team, such as \"Primary care physician\", \"Trained social worker counselor\", \"Caregiver\", etc.", 0, java.lang.Integer.MAX_VALUE, role));
375          childrenList.add(new Property("member", "Reference(Practitioner|RelatedPerson|Patient|Organization|CareTeam)", "The specific person or organization who is participating/expected to participate in the care team.", 0, java.lang.Integer.MAX_VALUE, member));
376          childrenList.add(new Property("onBehalfOf", "Reference(Organization)", "The organization of the practitioner.", 0, java.lang.Integer.MAX_VALUE, onBehalfOf));
377          childrenList.add(new Property("period", "Period", "Indicates when the specific member or organization did (or is intended to) come into effect and end.", 0, java.lang.Integer.MAX_VALUE, period));
378        }
379
380      @Override
381      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
382        switch (hash) {
383        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
384        case -1077769574: /*member*/ return this.member == null ? new Base[0] : new Base[] {this.member}; // Reference
385        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
386        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
387        default: return super.getProperty(hash, name, checkValid);
388        }
389
390      }
391
392      @Override
393      public Base setProperty(int hash, String name, Base value) throws FHIRException {
394        switch (hash) {
395        case 3506294: // role
396          this.role = castToCodeableConcept(value); // CodeableConcept
397          return value;
398        case -1077769574: // member
399          this.member = castToReference(value); // Reference
400          return value;
401        case -14402964: // onBehalfOf
402          this.onBehalfOf = castToReference(value); // Reference
403          return value;
404        case -991726143: // period
405          this.period = castToPeriod(value); // Period
406          return value;
407        default: return super.setProperty(hash, name, value);
408        }
409
410      }
411
412      @Override
413      public Base setProperty(String name, Base value) throws FHIRException {
414        if (name.equals("role")) {
415          this.role = castToCodeableConcept(value); // CodeableConcept
416        } else if (name.equals("member")) {
417          this.member = castToReference(value); // Reference
418        } else if (name.equals("onBehalfOf")) {
419          this.onBehalfOf = castToReference(value); // Reference
420        } else if (name.equals("period")) {
421          this.period = castToPeriod(value); // Period
422        } else
423          return super.setProperty(name, value);
424        return value;
425      }
426
427      @Override
428      public Base makeProperty(int hash, String name) throws FHIRException {
429        switch (hash) {
430        case 3506294:  return getRole(); 
431        case -1077769574:  return getMember(); 
432        case -14402964:  return getOnBehalfOf(); 
433        case -991726143:  return getPeriod(); 
434        default: return super.makeProperty(hash, name);
435        }
436
437      }
438
439      @Override
440      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
441        switch (hash) {
442        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
443        case -1077769574: /*member*/ return new String[] {"Reference"};
444        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
445        case -991726143: /*period*/ return new String[] {"Period"};
446        default: return super.getTypesForProperty(hash, name);
447        }
448
449      }
450
451      @Override
452      public Base addChild(String name) throws FHIRException {
453        if (name.equals("role")) {
454          this.role = new CodeableConcept();
455          return this.role;
456        }
457        else if (name.equals("member")) {
458          this.member = new Reference();
459          return this.member;
460        }
461        else if (name.equals("onBehalfOf")) {
462          this.onBehalfOf = new Reference();
463          return this.onBehalfOf;
464        }
465        else if (name.equals("period")) {
466          this.period = new Period();
467          return this.period;
468        }
469        else
470          return super.addChild(name);
471      }
472
473      public CareTeamParticipantComponent copy() {
474        CareTeamParticipantComponent dst = new CareTeamParticipantComponent();
475        copyValues(dst);
476        dst.role = role == null ? null : role.copy();
477        dst.member = member == null ? null : member.copy();
478        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
479        dst.period = period == null ? null : period.copy();
480        return dst;
481      }
482
483      @Override
484      public boolean equalsDeep(Base other) {
485        if (!super.equalsDeep(other))
486          return false;
487        if (!(other instanceof CareTeamParticipantComponent))
488          return false;
489        CareTeamParticipantComponent o = (CareTeamParticipantComponent) other;
490        return compareDeep(role, o.role, true) && compareDeep(member, o.member, true) && compareDeep(onBehalfOf, o.onBehalfOf, true)
491           && compareDeep(period, o.period, true);
492      }
493
494      @Override
495      public boolean equalsShallow(Base other) {
496        if (!super.equalsShallow(other))
497          return false;
498        if (!(other instanceof CareTeamParticipantComponent))
499          return false;
500        CareTeamParticipantComponent o = (CareTeamParticipantComponent) other;
501        return true;
502      }
503
504      public boolean isEmpty() {
505        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, member, onBehalfOf
506          , period);
507      }
508
509  public String fhirType() {
510    return "CareTeam.participant";
511
512  }
513
514  }
515
516    /**
517     * This records identifiers associated with this care team that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.
518     */
519    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
520    @Description(shortDefinition="External Ids for this team", formalDefinition="This records identifiers associated with this care team that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate." )
521    protected List<Identifier> identifier;
522
523    /**
524     * Indicates the current state of the care team.
525     */
526    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
527    @Description(shortDefinition="proposed | active | suspended | inactive | entered-in-error", formalDefinition="Indicates the current state of the care team." )
528    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/care-team-status")
529    protected Enumeration<CareTeamStatus> status;
530
531    /**
532     * Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.
533     */
534    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
535    @Description(shortDefinition="Type of team", formalDefinition="Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team." )
536    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/care-team-category")
537    protected List<CodeableConcept> category;
538
539    /**
540     * A label for human use intended to distinguish like teams.  E.g. the "red" vs. "green" trauma teams.
541     */
542    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
543    @Description(shortDefinition="Name of the team, such as crisis assessment team", formalDefinition="A label for human use intended to distinguish like teams.  E.g. the \"red\" vs. \"green\" trauma teams." )
544    protected StringType name;
545
546    /**
547     * Identifies the patient or group whose intended care is handled by the team.
548     */
549    @Child(name = "subject", type = {Patient.class, Group.class}, order=4, min=0, max=1, modifier=false, summary=true)
550    @Description(shortDefinition="Who care team is for", formalDefinition="Identifies the patient or group whose intended care is handled by the team." )
551    protected Reference subject;
552
553    /**
554     * The actual object that is the target of the reference (Identifies the patient or group whose intended care is handled by the team.)
555     */
556    protected Resource subjectTarget;
557
558    /**
559     * The encounter or episode of care that establishes the context for this care team.
560     */
561    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=5, min=0, max=1, modifier=false, summary=true)
562    @Description(shortDefinition="Encounter or episode associated with CareTeam", formalDefinition="The encounter or episode of care that establishes the context for this care team." )
563    protected Reference context;
564
565    /**
566     * The actual object that is the target of the reference (The encounter or episode of care that establishes the context for this care team.)
567     */
568    protected Resource contextTarget;
569
570    /**
571     * Indicates when the team did (or is intended to) come into effect and end.
572     */
573    @Child(name = "period", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
574    @Description(shortDefinition="Time period team covers", formalDefinition="Indicates when the team did (or is intended to) come into effect and end." )
575    protected Period period;
576
577    /**
578     * Identifies all people and organizations who are expected to be involved in the care team.
579     */
580    @Child(name = "participant", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
581    @Description(shortDefinition="Members of the team", formalDefinition="Identifies all people and organizations who are expected to be involved in the care team." )
582    protected List<CareTeamParticipantComponent> participant;
583
584    /**
585     * Describes why the care team exists.
586     */
587    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
588    @Description(shortDefinition="Why the care team exists", formalDefinition="Describes why the care team exists." )
589    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
590    protected List<CodeableConcept> reasonCode;
591
592    /**
593     * Condition(s) that this care team addresses.
594     */
595    @Child(name = "reasonReference", type = {Condition.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
596    @Description(shortDefinition="Why the care team exists", formalDefinition="Condition(s) that this care team addresses." )
597    protected List<Reference> reasonReference;
598    /**
599     * The actual objects that are the target of the reference (Condition(s) that this care team addresses.)
600     */
601    protected List<Condition> reasonReferenceTarget;
602
603
604    /**
605     * The organization responsible for the care team.
606     */
607    @Child(name = "managingOrganization", type = {Organization.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
608    @Description(shortDefinition="Organization responsible for the care team", formalDefinition="The organization responsible for the care team." )
609    protected List<Reference> managingOrganization;
610    /**
611     * The actual objects that are the target of the reference (The organization responsible for the care team.)
612     */
613    protected List<Organization> managingOrganizationTarget;
614
615
616    /**
617     * Comments made about the CareTeam.
618     */
619    @Child(name = "note", type = {Annotation.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
620    @Description(shortDefinition="Comments made about the CareTeam", formalDefinition="Comments made about the CareTeam." )
621    protected List<Annotation> note;
622
623    private static final long serialVersionUID = 1568354370L;
624
625  /**
626   * Constructor
627   */
628    public CareTeam() {
629      super();
630    }
631
632    /**
633     * @return {@link #identifier} (This records identifiers associated with this care team that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.)
634     */
635    public List<Identifier> getIdentifier() { 
636      if (this.identifier == null)
637        this.identifier = new ArrayList<Identifier>();
638      return this.identifier;
639    }
640
641    /**
642     * @return Returns a reference to <code>this</code> for easy method chaining
643     */
644    public CareTeam setIdentifier(List<Identifier> theIdentifier) { 
645      this.identifier = theIdentifier;
646      return this;
647    }
648
649    public boolean hasIdentifier() { 
650      if (this.identifier == null)
651        return false;
652      for (Identifier item : this.identifier)
653        if (!item.isEmpty())
654          return true;
655      return false;
656    }
657
658    public Identifier addIdentifier() { //3
659      Identifier t = new Identifier();
660      if (this.identifier == null)
661        this.identifier = new ArrayList<Identifier>();
662      this.identifier.add(t);
663      return t;
664    }
665
666    public CareTeam addIdentifier(Identifier t) { //3
667      if (t == null)
668        return this;
669      if (this.identifier == null)
670        this.identifier = new ArrayList<Identifier>();
671      this.identifier.add(t);
672      return this;
673    }
674
675    /**
676     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
677     */
678    public Identifier getIdentifierFirstRep() { 
679      if (getIdentifier().isEmpty()) {
680        addIdentifier();
681      }
682      return getIdentifier().get(0);
683    }
684
685    /**
686     * @return {@link #status} (Indicates the current state of the care team.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
687     */
688    public Enumeration<CareTeamStatus> getStatusElement() { 
689      if (this.status == null)
690        if (Configuration.errorOnAutoCreate())
691          throw new Error("Attempt to auto-create CareTeam.status");
692        else if (Configuration.doAutoCreate())
693          this.status = new Enumeration<CareTeamStatus>(new CareTeamStatusEnumFactory()); // bb
694      return this.status;
695    }
696
697    public boolean hasStatusElement() { 
698      return this.status != null && !this.status.isEmpty();
699    }
700
701    public boolean hasStatus() { 
702      return this.status != null && !this.status.isEmpty();
703    }
704
705    /**
706     * @param value {@link #status} (Indicates the current state of the care team.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
707     */
708    public CareTeam setStatusElement(Enumeration<CareTeamStatus> value) { 
709      this.status = value;
710      return this;
711    }
712
713    /**
714     * @return Indicates the current state of the care team.
715     */
716    public CareTeamStatus getStatus() { 
717      return this.status == null ? null : this.status.getValue();
718    }
719
720    /**
721     * @param value Indicates the current state of the care team.
722     */
723    public CareTeam setStatus(CareTeamStatus value) { 
724      if (value == null)
725        this.status = null;
726      else {
727        if (this.status == null)
728          this.status = new Enumeration<CareTeamStatus>(new CareTeamStatusEnumFactory());
729        this.status.setValue(value);
730      }
731      return this;
732    }
733
734    /**
735     * @return {@link #category} (Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.)
736     */
737    public List<CodeableConcept> getCategory() { 
738      if (this.category == null)
739        this.category = new ArrayList<CodeableConcept>();
740      return this.category;
741    }
742
743    /**
744     * @return Returns a reference to <code>this</code> for easy method chaining
745     */
746    public CareTeam setCategory(List<CodeableConcept> theCategory) { 
747      this.category = theCategory;
748      return this;
749    }
750
751    public boolean hasCategory() { 
752      if (this.category == null)
753        return false;
754      for (CodeableConcept item : this.category)
755        if (!item.isEmpty())
756          return true;
757      return false;
758    }
759
760    public CodeableConcept addCategory() { //3
761      CodeableConcept t = new CodeableConcept();
762      if (this.category == null)
763        this.category = new ArrayList<CodeableConcept>();
764      this.category.add(t);
765      return t;
766    }
767
768    public CareTeam addCategory(CodeableConcept t) { //3
769      if (t == null)
770        return this;
771      if (this.category == null)
772        this.category = new ArrayList<CodeableConcept>();
773      this.category.add(t);
774      return this;
775    }
776
777    /**
778     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
779     */
780    public CodeableConcept getCategoryFirstRep() { 
781      if (getCategory().isEmpty()) {
782        addCategory();
783      }
784      return getCategory().get(0);
785    }
786
787    /**
788     * @return {@link #name} (A label for human use intended to distinguish like teams.  E.g. the "red" vs. "green" trauma teams.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
789     */
790    public StringType getNameElement() { 
791      if (this.name == null)
792        if (Configuration.errorOnAutoCreate())
793          throw new Error("Attempt to auto-create CareTeam.name");
794        else if (Configuration.doAutoCreate())
795          this.name = new StringType(); // bb
796      return this.name;
797    }
798
799    public boolean hasNameElement() { 
800      return this.name != null && !this.name.isEmpty();
801    }
802
803    public boolean hasName() { 
804      return this.name != null && !this.name.isEmpty();
805    }
806
807    /**
808     * @param value {@link #name} (A label for human use intended to distinguish like teams.  E.g. the "red" vs. "green" trauma teams.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
809     */
810    public CareTeam setNameElement(StringType value) { 
811      this.name = value;
812      return this;
813    }
814
815    /**
816     * @return A label for human use intended to distinguish like teams.  E.g. the "red" vs. "green" trauma teams.
817     */
818    public String getName() { 
819      return this.name == null ? null : this.name.getValue();
820    }
821
822    /**
823     * @param value A label for human use intended to distinguish like teams.  E.g. the "red" vs. "green" trauma teams.
824     */
825    public CareTeam setName(String value) { 
826      if (Utilities.noString(value))
827        this.name = null;
828      else {
829        if (this.name == null)
830          this.name = new StringType();
831        this.name.setValue(value);
832      }
833      return this;
834    }
835
836    /**
837     * @return {@link #subject} (Identifies the patient or group whose intended care is handled by the team.)
838     */
839    public Reference getSubject() { 
840      if (this.subject == null)
841        if (Configuration.errorOnAutoCreate())
842          throw new Error("Attempt to auto-create CareTeam.subject");
843        else if (Configuration.doAutoCreate())
844          this.subject = new Reference(); // cc
845      return this.subject;
846    }
847
848    public boolean hasSubject() { 
849      return this.subject != null && !this.subject.isEmpty();
850    }
851
852    /**
853     * @param value {@link #subject} (Identifies the patient or group whose intended care is handled by the team.)
854     */
855    public CareTeam setSubject(Reference value) { 
856      this.subject = value;
857      return this;
858    }
859
860    /**
861     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the patient or group whose intended care is handled by the team.)
862     */
863    public Resource getSubjectTarget() { 
864      return this.subjectTarget;
865    }
866
867    /**
868     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the patient or group whose intended care is handled by the team.)
869     */
870    public CareTeam setSubjectTarget(Resource value) { 
871      this.subjectTarget = value;
872      return this;
873    }
874
875    /**
876     * @return {@link #context} (The encounter or episode of care that establishes the context for this care team.)
877     */
878    public Reference getContext() { 
879      if (this.context == null)
880        if (Configuration.errorOnAutoCreate())
881          throw new Error("Attempt to auto-create CareTeam.context");
882        else if (Configuration.doAutoCreate())
883          this.context = new Reference(); // cc
884      return this.context;
885    }
886
887    public boolean hasContext() { 
888      return this.context != null && !this.context.isEmpty();
889    }
890
891    /**
892     * @param value {@link #context} (The encounter or episode of care that establishes the context for this care team.)
893     */
894    public CareTeam setContext(Reference value) { 
895      this.context = value;
896      return this;
897    }
898
899    /**
900     * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The encounter or episode of care that establishes the context for this care team.)
901     */
902    public Resource getContextTarget() { 
903      return this.contextTarget;
904    }
905
906    /**
907     * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The encounter or episode of care that establishes the context for this care team.)
908     */
909    public CareTeam setContextTarget(Resource value) { 
910      this.contextTarget = value;
911      return this;
912    }
913
914    /**
915     * @return {@link #period} (Indicates when the team did (or is intended to) come into effect and end.)
916     */
917    public Period getPeriod() { 
918      if (this.period == null)
919        if (Configuration.errorOnAutoCreate())
920          throw new Error("Attempt to auto-create CareTeam.period");
921        else if (Configuration.doAutoCreate())
922          this.period = new Period(); // cc
923      return this.period;
924    }
925
926    public boolean hasPeriod() { 
927      return this.period != null && !this.period.isEmpty();
928    }
929
930    /**
931     * @param value {@link #period} (Indicates when the team did (or is intended to) come into effect and end.)
932     */
933    public CareTeam setPeriod(Period value) { 
934      this.period = value;
935      return this;
936    }
937
938    /**
939     * @return {@link #participant} (Identifies all people and organizations who are expected to be involved in the care team.)
940     */
941    public List<CareTeamParticipantComponent> getParticipant() { 
942      if (this.participant == null)
943        this.participant = new ArrayList<CareTeamParticipantComponent>();
944      return this.participant;
945    }
946
947    /**
948     * @return Returns a reference to <code>this</code> for easy method chaining
949     */
950    public CareTeam setParticipant(List<CareTeamParticipantComponent> theParticipant) { 
951      this.participant = theParticipant;
952      return this;
953    }
954
955    public boolean hasParticipant() { 
956      if (this.participant == null)
957        return false;
958      for (CareTeamParticipantComponent item : this.participant)
959        if (!item.isEmpty())
960          return true;
961      return false;
962    }
963
964    public CareTeamParticipantComponent addParticipant() { //3
965      CareTeamParticipantComponent t = new CareTeamParticipantComponent();
966      if (this.participant == null)
967        this.participant = new ArrayList<CareTeamParticipantComponent>();
968      this.participant.add(t);
969      return t;
970    }
971
972    public CareTeam addParticipant(CareTeamParticipantComponent t) { //3
973      if (t == null)
974        return this;
975      if (this.participant == null)
976        this.participant = new ArrayList<CareTeamParticipantComponent>();
977      this.participant.add(t);
978      return this;
979    }
980
981    /**
982     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist
983     */
984    public CareTeamParticipantComponent getParticipantFirstRep() { 
985      if (getParticipant().isEmpty()) {
986        addParticipant();
987      }
988      return getParticipant().get(0);
989    }
990
991    /**
992     * @return {@link #reasonCode} (Describes why the care team exists.)
993     */
994    public List<CodeableConcept> getReasonCode() { 
995      if (this.reasonCode == null)
996        this.reasonCode = new ArrayList<CodeableConcept>();
997      return this.reasonCode;
998    }
999
1000    /**
1001     * @return Returns a reference to <code>this</code> for easy method chaining
1002     */
1003    public CareTeam setReasonCode(List<CodeableConcept> theReasonCode) { 
1004      this.reasonCode = theReasonCode;
1005      return this;
1006    }
1007
1008    public boolean hasReasonCode() { 
1009      if (this.reasonCode == null)
1010        return false;
1011      for (CodeableConcept item : this.reasonCode)
1012        if (!item.isEmpty())
1013          return true;
1014      return false;
1015    }
1016
1017    public CodeableConcept addReasonCode() { //3
1018      CodeableConcept t = new CodeableConcept();
1019      if (this.reasonCode == null)
1020        this.reasonCode = new ArrayList<CodeableConcept>();
1021      this.reasonCode.add(t);
1022      return t;
1023    }
1024
1025    public CareTeam addReasonCode(CodeableConcept t) { //3
1026      if (t == null)
1027        return this;
1028      if (this.reasonCode == null)
1029        this.reasonCode = new ArrayList<CodeableConcept>();
1030      this.reasonCode.add(t);
1031      return this;
1032    }
1033
1034    /**
1035     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1036     */
1037    public CodeableConcept getReasonCodeFirstRep() { 
1038      if (getReasonCode().isEmpty()) {
1039        addReasonCode();
1040      }
1041      return getReasonCode().get(0);
1042    }
1043
1044    /**
1045     * @return {@link #reasonReference} (Condition(s) that this care team addresses.)
1046     */
1047    public List<Reference> getReasonReference() { 
1048      if (this.reasonReference == null)
1049        this.reasonReference = new ArrayList<Reference>();
1050      return this.reasonReference;
1051    }
1052
1053    /**
1054     * @return Returns a reference to <code>this</code> for easy method chaining
1055     */
1056    public CareTeam setReasonReference(List<Reference> theReasonReference) { 
1057      this.reasonReference = theReasonReference;
1058      return this;
1059    }
1060
1061    public boolean hasReasonReference() { 
1062      if (this.reasonReference == null)
1063        return false;
1064      for (Reference item : this.reasonReference)
1065        if (!item.isEmpty())
1066          return true;
1067      return false;
1068    }
1069
1070    public Reference addReasonReference() { //3
1071      Reference t = new Reference();
1072      if (this.reasonReference == null)
1073        this.reasonReference = new ArrayList<Reference>();
1074      this.reasonReference.add(t);
1075      return t;
1076    }
1077
1078    public CareTeam addReasonReference(Reference t) { //3
1079      if (t == null)
1080        return this;
1081      if (this.reasonReference == null)
1082        this.reasonReference = new ArrayList<Reference>();
1083      this.reasonReference.add(t);
1084      return this;
1085    }
1086
1087    /**
1088     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1089     */
1090    public Reference getReasonReferenceFirstRep() { 
1091      if (getReasonReference().isEmpty()) {
1092        addReasonReference();
1093      }
1094      return getReasonReference().get(0);
1095    }
1096
1097    /**
1098     * @deprecated Use Reference#setResource(IBaseResource) instead
1099     */
1100    @Deprecated
1101    public List<Condition> getReasonReferenceTarget() { 
1102      if (this.reasonReferenceTarget == null)
1103        this.reasonReferenceTarget = new ArrayList<Condition>();
1104      return this.reasonReferenceTarget;
1105    }
1106
1107    /**
1108     * @deprecated Use Reference#setResource(IBaseResource) instead
1109     */
1110    @Deprecated
1111    public Condition addReasonReferenceTarget() { 
1112      Condition r = new Condition();
1113      if (this.reasonReferenceTarget == null)
1114        this.reasonReferenceTarget = new ArrayList<Condition>();
1115      this.reasonReferenceTarget.add(r);
1116      return r;
1117    }
1118
1119    /**
1120     * @return {@link #managingOrganization} (The organization responsible for the care team.)
1121     */
1122    public List<Reference> getManagingOrganization() { 
1123      if (this.managingOrganization == null)
1124        this.managingOrganization = new ArrayList<Reference>();
1125      return this.managingOrganization;
1126    }
1127
1128    /**
1129     * @return Returns a reference to <code>this</code> for easy method chaining
1130     */
1131    public CareTeam setManagingOrganization(List<Reference> theManagingOrganization) { 
1132      this.managingOrganization = theManagingOrganization;
1133      return this;
1134    }
1135
1136    public boolean hasManagingOrganization() { 
1137      if (this.managingOrganization == null)
1138        return false;
1139      for (Reference item : this.managingOrganization)
1140        if (!item.isEmpty())
1141          return true;
1142      return false;
1143    }
1144
1145    public Reference addManagingOrganization() { //3
1146      Reference t = new Reference();
1147      if (this.managingOrganization == null)
1148        this.managingOrganization = new ArrayList<Reference>();
1149      this.managingOrganization.add(t);
1150      return t;
1151    }
1152
1153    public CareTeam addManagingOrganization(Reference t) { //3
1154      if (t == null)
1155        return this;
1156      if (this.managingOrganization == null)
1157        this.managingOrganization = new ArrayList<Reference>();
1158      this.managingOrganization.add(t);
1159      return this;
1160    }
1161
1162    /**
1163     * @return The first repetition of repeating field {@link #managingOrganization}, creating it if it does not already exist
1164     */
1165    public Reference getManagingOrganizationFirstRep() { 
1166      if (getManagingOrganization().isEmpty()) {
1167        addManagingOrganization();
1168      }
1169      return getManagingOrganization().get(0);
1170    }
1171
1172    /**
1173     * @deprecated Use Reference#setResource(IBaseResource) instead
1174     */
1175    @Deprecated
1176    public List<Organization> getManagingOrganizationTarget() { 
1177      if (this.managingOrganizationTarget == null)
1178        this.managingOrganizationTarget = new ArrayList<Organization>();
1179      return this.managingOrganizationTarget;
1180    }
1181
1182    /**
1183     * @deprecated Use Reference#setResource(IBaseResource) instead
1184     */
1185    @Deprecated
1186    public Organization addManagingOrganizationTarget() { 
1187      Organization r = new Organization();
1188      if (this.managingOrganizationTarget == null)
1189        this.managingOrganizationTarget = new ArrayList<Organization>();
1190      this.managingOrganizationTarget.add(r);
1191      return r;
1192    }
1193
1194    /**
1195     * @return {@link #note} (Comments made about the CareTeam.)
1196     */
1197    public List<Annotation> getNote() { 
1198      if (this.note == null)
1199        this.note = new ArrayList<Annotation>();
1200      return this.note;
1201    }
1202
1203    /**
1204     * @return Returns a reference to <code>this</code> for easy method chaining
1205     */
1206    public CareTeam setNote(List<Annotation> theNote) { 
1207      this.note = theNote;
1208      return this;
1209    }
1210
1211    public boolean hasNote() { 
1212      if (this.note == null)
1213        return false;
1214      for (Annotation item : this.note)
1215        if (!item.isEmpty())
1216          return true;
1217      return false;
1218    }
1219
1220    public Annotation addNote() { //3
1221      Annotation t = new Annotation();
1222      if (this.note == null)
1223        this.note = new ArrayList<Annotation>();
1224      this.note.add(t);
1225      return t;
1226    }
1227
1228    public CareTeam addNote(Annotation t) { //3
1229      if (t == null)
1230        return this;
1231      if (this.note == null)
1232        this.note = new ArrayList<Annotation>();
1233      this.note.add(t);
1234      return this;
1235    }
1236
1237    /**
1238     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1239     */
1240    public Annotation getNoteFirstRep() { 
1241      if (getNote().isEmpty()) {
1242        addNote();
1243      }
1244      return getNote().get(0);
1245    }
1246
1247      protected void listChildren(List<Property> childrenList) {
1248        super.listChildren(childrenList);
1249        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this care team that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.", 0, java.lang.Integer.MAX_VALUE, identifier));
1250        childrenList.add(new Property("status", "code", "Indicates the current state of the care team.", 0, java.lang.Integer.MAX_VALUE, status));
1251        childrenList.add(new Property("category", "CodeableConcept", "Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.", 0, java.lang.Integer.MAX_VALUE, category));
1252        childrenList.add(new Property("name", "string", "A label for human use intended to distinguish like teams.  E.g. the \"red\" vs. \"green\" trauma teams.", 0, java.lang.Integer.MAX_VALUE, name));
1253        childrenList.add(new Property("subject", "Reference(Patient|Group)", "Identifies the patient or group whose intended care is handled by the team.", 0, java.lang.Integer.MAX_VALUE, subject));
1254        childrenList.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care that establishes the context for this care team.", 0, java.lang.Integer.MAX_VALUE, context));
1255        childrenList.add(new Property("period", "Period", "Indicates when the team did (or is intended to) come into effect and end.", 0, java.lang.Integer.MAX_VALUE, period));
1256        childrenList.add(new Property("participant", "", "Identifies all people and organizations who are expected to be involved in the care team.", 0, java.lang.Integer.MAX_VALUE, participant));
1257        childrenList.add(new Property("reasonCode", "CodeableConcept", "Describes why the care team exists.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
1258        childrenList.add(new Property("reasonReference", "Reference(Condition)", "Condition(s) that this care team addresses.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
1259        childrenList.add(new Property("managingOrganization", "Reference(Organization)", "The organization responsible for the care team.", 0, java.lang.Integer.MAX_VALUE, managingOrganization));
1260        childrenList.add(new Property("note", "Annotation", "Comments made about the CareTeam.", 0, java.lang.Integer.MAX_VALUE, note));
1261      }
1262
1263      @Override
1264      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1265        switch (hash) {
1266        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1267        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CareTeamStatus>
1268        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1269        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1270        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1271        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
1272        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1273        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // CareTeamParticipantComponent
1274        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
1275        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
1276        case -2058947787: /*managingOrganization*/ return this.managingOrganization == null ? new Base[0] : this.managingOrganization.toArray(new Base[this.managingOrganization.size()]); // Reference
1277        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1278        default: return super.getProperty(hash, name, checkValid);
1279        }
1280
1281      }
1282
1283      @Override
1284      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1285        switch (hash) {
1286        case -1618432855: // identifier
1287          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1288          return value;
1289        case -892481550: // status
1290          value = new CareTeamStatusEnumFactory().fromType(castToCode(value));
1291          this.status = (Enumeration) value; // Enumeration<CareTeamStatus>
1292          return value;
1293        case 50511102: // category
1294          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
1295          return value;
1296        case 3373707: // name
1297          this.name = castToString(value); // StringType
1298          return value;
1299        case -1867885268: // subject
1300          this.subject = castToReference(value); // Reference
1301          return value;
1302        case 951530927: // context
1303          this.context = castToReference(value); // Reference
1304          return value;
1305        case -991726143: // period
1306          this.period = castToPeriod(value); // Period
1307          return value;
1308        case 767422259: // participant
1309          this.getParticipant().add((CareTeamParticipantComponent) value); // CareTeamParticipantComponent
1310          return value;
1311        case 722137681: // reasonCode
1312          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
1313          return value;
1314        case -1146218137: // reasonReference
1315          this.getReasonReference().add(castToReference(value)); // Reference
1316          return value;
1317        case -2058947787: // managingOrganization
1318          this.getManagingOrganization().add(castToReference(value)); // Reference
1319          return value;
1320        case 3387378: // note
1321          this.getNote().add(castToAnnotation(value)); // Annotation
1322          return value;
1323        default: return super.setProperty(hash, name, value);
1324        }
1325
1326      }
1327
1328      @Override
1329      public Base setProperty(String name, Base value) throws FHIRException {
1330        if (name.equals("identifier")) {
1331          this.getIdentifier().add(castToIdentifier(value));
1332        } else if (name.equals("status")) {
1333          value = new CareTeamStatusEnumFactory().fromType(castToCode(value));
1334          this.status = (Enumeration) value; // Enumeration<CareTeamStatus>
1335        } else if (name.equals("category")) {
1336          this.getCategory().add(castToCodeableConcept(value));
1337        } else if (name.equals("name")) {
1338          this.name = castToString(value); // StringType
1339        } else if (name.equals("subject")) {
1340          this.subject = castToReference(value); // Reference
1341        } else if (name.equals("context")) {
1342          this.context = castToReference(value); // Reference
1343        } else if (name.equals("period")) {
1344          this.period = castToPeriod(value); // Period
1345        } else if (name.equals("participant")) {
1346          this.getParticipant().add((CareTeamParticipantComponent) value);
1347        } else if (name.equals("reasonCode")) {
1348          this.getReasonCode().add(castToCodeableConcept(value));
1349        } else if (name.equals("reasonReference")) {
1350          this.getReasonReference().add(castToReference(value));
1351        } else if (name.equals("managingOrganization")) {
1352          this.getManagingOrganization().add(castToReference(value));
1353        } else if (name.equals("note")) {
1354          this.getNote().add(castToAnnotation(value));
1355        } else
1356          return super.setProperty(name, value);
1357        return value;
1358      }
1359
1360      @Override
1361      public Base makeProperty(int hash, String name) throws FHIRException {
1362        switch (hash) {
1363        case -1618432855:  return addIdentifier(); 
1364        case -892481550:  return getStatusElement();
1365        case 50511102:  return addCategory(); 
1366        case 3373707:  return getNameElement();
1367        case -1867885268:  return getSubject(); 
1368        case 951530927:  return getContext(); 
1369        case -991726143:  return getPeriod(); 
1370        case 767422259:  return addParticipant(); 
1371        case 722137681:  return addReasonCode(); 
1372        case -1146218137:  return addReasonReference(); 
1373        case -2058947787:  return addManagingOrganization(); 
1374        case 3387378:  return addNote(); 
1375        default: return super.makeProperty(hash, name);
1376        }
1377
1378      }
1379
1380      @Override
1381      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1382        switch (hash) {
1383        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1384        case -892481550: /*status*/ return new String[] {"code"};
1385        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1386        case 3373707: /*name*/ return new String[] {"string"};
1387        case -1867885268: /*subject*/ return new String[] {"Reference"};
1388        case 951530927: /*context*/ return new String[] {"Reference"};
1389        case -991726143: /*period*/ return new String[] {"Period"};
1390        case 767422259: /*participant*/ return new String[] {};
1391        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
1392        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
1393        case -2058947787: /*managingOrganization*/ return new String[] {"Reference"};
1394        case 3387378: /*note*/ return new String[] {"Annotation"};
1395        default: return super.getTypesForProperty(hash, name);
1396        }
1397
1398      }
1399
1400      @Override
1401      public Base addChild(String name) throws FHIRException {
1402        if (name.equals("identifier")) {
1403          return addIdentifier();
1404        }
1405        else if (name.equals("status")) {
1406          throw new FHIRException("Cannot call addChild on a primitive type CareTeam.status");
1407        }
1408        else if (name.equals("category")) {
1409          return addCategory();
1410        }
1411        else if (name.equals("name")) {
1412          throw new FHIRException("Cannot call addChild on a primitive type CareTeam.name");
1413        }
1414        else if (name.equals("subject")) {
1415          this.subject = new Reference();
1416          return this.subject;
1417        }
1418        else if (name.equals("context")) {
1419          this.context = new Reference();
1420          return this.context;
1421        }
1422        else if (name.equals("period")) {
1423          this.period = new Period();
1424          return this.period;
1425        }
1426        else if (name.equals("participant")) {
1427          return addParticipant();
1428        }
1429        else if (name.equals("reasonCode")) {
1430          return addReasonCode();
1431        }
1432        else if (name.equals("reasonReference")) {
1433          return addReasonReference();
1434        }
1435        else if (name.equals("managingOrganization")) {
1436          return addManagingOrganization();
1437        }
1438        else if (name.equals("note")) {
1439          return addNote();
1440        }
1441        else
1442          return super.addChild(name);
1443      }
1444
1445  public String fhirType() {
1446    return "CareTeam";
1447
1448  }
1449
1450      public CareTeam copy() {
1451        CareTeam dst = new CareTeam();
1452        copyValues(dst);
1453        if (identifier != null) {
1454          dst.identifier = new ArrayList<Identifier>();
1455          for (Identifier i : identifier)
1456            dst.identifier.add(i.copy());
1457        };
1458        dst.status = status == null ? null : status.copy();
1459        if (category != null) {
1460          dst.category = new ArrayList<CodeableConcept>();
1461          for (CodeableConcept i : category)
1462            dst.category.add(i.copy());
1463        };
1464        dst.name = name == null ? null : name.copy();
1465        dst.subject = subject == null ? null : subject.copy();
1466        dst.context = context == null ? null : context.copy();
1467        dst.period = period == null ? null : period.copy();
1468        if (participant != null) {
1469          dst.participant = new ArrayList<CareTeamParticipantComponent>();
1470          for (CareTeamParticipantComponent i : participant)
1471            dst.participant.add(i.copy());
1472        };
1473        if (reasonCode != null) {
1474          dst.reasonCode = new ArrayList<CodeableConcept>();
1475          for (CodeableConcept i : reasonCode)
1476            dst.reasonCode.add(i.copy());
1477        };
1478        if (reasonReference != null) {
1479          dst.reasonReference = new ArrayList<Reference>();
1480          for (Reference i : reasonReference)
1481            dst.reasonReference.add(i.copy());
1482        };
1483        if (managingOrganization != null) {
1484          dst.managingOrganization = new ArrayList<Reference>();
1485          for (Reference i : managingOrganization)
1486            dst.managingOrganization.add(i.copy());
1487        };
1488        if (note != null) {
1489          dst.note = new ArrayList<Annotation>();
1490          for (Annotation i : note)
1491            dst.note.add(i.copy());
1492        };
1493        return dst;
1494      }
1495
1496      protected CareTeam typedCopy() {
1497        return copy();
1498      }
1499
1500      @Override
1501      public boolean equalsDeep(Base other) {
1502        if (!super.equalsDeep(other))
1503          return false;
1504        if (!(other instanceof CareTeam))
1505          return false;
1506        CareTeam o = (CareTeam) other;
1507        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
1508           && compareDeep(name, o.name, true) && compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true)
1509           && compareDeep(period, o.period, true) && compareDeep(participant, o.participant, true) && compareDeep(reasonCode, o.reasonCode, true)
1510           && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(managingOrganization, o.managingOrganization, true)
1511           && compareDeep(note, o.note, true);
1512      }
1513
1514      @Override
1515      public boolean equalsShallow(Base other) {
1516        if (!super.equalsShallow(other))
1517          return false;
1518        if (!(other instanceof CareTeam))
1519          return false;
1520        CareTeam o = (CareTeam) other;
1521        return compareValues(status, o.status, true) && compareValues(name, o.name, true);
1522      }
1523
1524      public boolean isEmpty() {
1525        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
1526          , name, subject, context, period, participant, reasonCode, reasonReference, managingOrganization
1527          , note);
1528      }
1529
1530  @Override
1531  public ResourceType getResourceType() {
1532    return ResourceType.CareTeam;
1533   }
1534
1535 /**
1536   * Search parameter: <b>date</b>
1537   * <p>
1538   * Description: <b>Time period team covers</b><br>
1539   * Type: <b>date</b><br>
1540   * Path: <b>CareTeam.period</b><br>
1541   * </p>
1542   */
1543  @SearchParamDefinition(name="date", path="CareTeam.period", description="Time period team covers", type="date" )
1544  public static final String SP_DATE = "date";
1545 /**
1546   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1547   * <p>
1548   * Description: <b>Time period team covers</b><br>
1549   * Type: <b>date</b><br>
1550   * Path: <b>CareTeam.period</b><br>
1551   * </p>
1552   */
1553  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1554
1555 /**
1556   * Search parameter: <b>identifier</b>
1557   * <p>
1558   * Description: <b>External Ids for this team</b><br>
1559   * Type: <b>token</b><br>
1560   * Path: <b>CareTeam.identifier</b><br>
1561   * </p>
1562   */
1563  @SearchParamDefinition(name="identifier", path="CareTeam.identifier", description="External Ids for this team", type="token" )
1564  public static final String SP_IDENTIFIER = "identifier";
1565 /**
1566   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1567   * <p>
1568   * Description: <b>External Ids for this team</b><br>
1569   * Type: <b>token</b><br>
1570   * Path: <b>CareTeam.identifier</b><br>
1571   * </p>
1572   */
1573  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1574
1575 /**
1576   * Search parameter: <b>patient</b>
1577   * <p>
1578   * Description: <b>Who care team is for</b><br>
1579   * Type: <b>reference</b><br>
1580   * Path: <b>CareTeam.subject</b><br>
1581   * </p>
1582   */
1583  @SearchParamDefinition(name="patient", path="CareTeam.subject", description="Who care team is for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1584  public static final String SP_PATIENT = "patient";
1585 /**
1586   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1587   * <p>
1588   * Description: <b>Who care team is for</b><br>
1589   * Type: <b>reference</b><br>
1590   * Path: <b>CareTeam.subject</b><br>
1591   * </p>
1592   */
1593  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1594
1595/**
1596   * Constant for fluent queries to be used to add include statements. Specifies
1597   * the path value of "<b>CareTeam:patient</b>".
1598   */
1599  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("CareTeam:patient").toLocked();
1600
1601 /**
1602   * Search parameter: <b>subject</b>
1603   * <p>
1604   * Description: <b>Who care team is for</b><br>
1605   * Type: <b>reference</b><br>
1606   * Path: <b>CareTeam.subject</b><br>
1607   * </p>
1608   */
1609  @SearchParamDefinition(name="subject", path="CareTeam.subject", description="Who care team is for", type="reference", target={Group.class, Patient.class } )
1610  public static final String SP_SUBJECT = "subject";
1611 /**
1612   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1613   * <p>
1614   * Description: <b>Who care team is for</b><br>
1615   * Type: <b>reference</b><br>
1616   * Path: <b>CareTeam.subject</b><br>
1617   * </p>
1618   */
1619  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1620
1621/**
1622   * Constant for fluent queries to be used to add include statements. Specifies
1623   * the path value of "<b>CareTeam:subject</b>".
1624   */
1625  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("CareTeam:subject").toLocked();
1626
1627 /**
1628   * Search parameter: <b>context</b>
1629   * <p>
1630   * Description: <b>Encounter or episode associated with CareTeam</b><br>
1631   * Type: <b>reference</b><br>
1632   * Path: <b>CareTeam.context</b><br>
1633   * </p>
1634   */
1635  @SearchParamDefinition(name="context", path="CareTeam.context", description="Encounter or episode associated with CareTeam", type="reference", target={Encounter.class, EpisodeOfCare.class } )
1636  public static final String SP_CONTEXT = "context";
1637 /**
1638   * <b>Fluent Client</b> search parameter constant for <b>context</b>
1639   * <p>
1640   * Description: <b>Encounter or episode associated with CareTeam</b><br>
1641   * Type: <b>reference</b><br>
1642   * Path: <b>CareTeam.context</b><br>
1643   * </p>
1644   */
1645  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
1646
1647/**
1648   * Constant for fluent queries to be used to add include statements. Specifies
1649   * the path value of "<b>CareTeam:context</b>".
1650   */
1651  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("CareTeam:context").toLocked();
1652
1653 /**
1654   * Search parameter: <b>encounter</b>
1655   * <p>
1656   * Description: <b>Encounter or episode associated with CareTeam</b><br>
1657   * Type: <b>reference</b><br>
1658   * Path: <b>CareTeam.context</b><br>
1659   * </p>
1660   */
1661  @SearchParamDefinition(name="encounter", path="CareTeam.context", description="Encounter or episode associated with CareTeam", type="reference", target={Encounter.class } )
1662  public static final String SP_ENCOUNTER = "encounter";
1663 /**
1664   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
1665   * <p>
1666   * Description: <b>Encounter or episode associated with CareTeam</b><br>
1667   * Type: <b>reference</b><br>
1668   * Path: <b>CareTeam.context</b><br>
1669   * </p>
1670   */
1671  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
1672
1673/**
1674   * Constant for fluent queries to be used to add include statements. Specifies
1675   * the path value of "<b>CareTeam:encounter</b>".
1676   */
1677  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("CareTeam:encounter").toLocked();
1678
1679 /**
1680   * Search parameter: <b>category</b>
1681   * <p>
1682   * Description: <b>Type of team</b><br>
1683   * Type: <b>token</b><br>
1684   * Path: <b>CareTeam.category</b><br>
1685   * </p>
1686   */
1687  @SearchParamDefinition(name="category", path="CareTeam.category", description="Type of team", type="token" )
1688  public static final String SP_CATEGORY = "category";
1689 /**
1690   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1691   * <p>
1692   * Description: <b>Type of team</b><br>
1693   * Type: <b>token</b><br>
1694   * Path: <b>CareTeam.category</b><br>
1695   * </p>
1696   */
1697  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1698
1699 /**
1700   * Search parameter: <b>participant</b>
1701   * <p>
1702   * Description: <b>Who is involved</b><br>
1703   * Type: <b>reference</b><br>
1704   * Path: <b>CareTeam.participant.member</b><br>
1705   * </p>
1706   */
1707  @SearchParamDefinition(name="participant", path="CareTeam.participant.member", description="Who is involved", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={CareTeam.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
1708  public static final String SP_PARTICIPANT = "participant";
1709 /**
1710   * <b>Fluent Client</b> search parameter constant for <b>participant</b>
1711   * <p>
1712   * Description: <b>Who is involved</b><br>
1713   * Type: <b>reference</b><br>
1714   * Path: <b>CareTeam.participant.member</b><br>
1715   * </p>
1716   */
1717  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTICIPANT);
1718
1719/**
1720   * Constant for fluent queries to be used to add include statements. Specifies
1721   * the path value of "<b>CareTeam:participant</b>".
1722   */
1723  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include("CareTeam:participant").toLocked();
1724
1725 /**
1726   * Search parameter: <b>status</b>
1727   * <p>
1728   * Description: <b>proposed | active | suspended | inactive | entered-in-error</b><br>
1729   * Type: <b>token</b><br>
1730   * Path: <b>CareTeam.status</b><br>
1731   * </p>
1732   */
1733  @SearchParamDefinition(name="status", path="CareTeam.status", description="proposed | active | suspended | inactive | entered-in-error", type="token" )
1734  public static final String SP_STATUS = "status";
1735 /**
1736   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1737   * <p>
1738   * Description: <b>proposed | active | suspended | inactive | entered-in-error</b><br>
1739   * Type: <b>token</b><br>
1740   * Path: <b>CareTeam.status</b><br>
1741   * </p>
1742   */
1743  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1744
1745
1746}
1747