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