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 Fri, Mar 16, 2018 15:21+1100 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;
045import org.hl7.fhir.exceptions.FHIRFormatError;
046/**
047 * A container for slots of time that may be available for booking appointments.
048 */
049@ResourceDef(name="Schedule", profile="http://hl7.org/fhir/StructureDefinition/Schedule")
050public class Schedule extends DomainResource {
051
052    /**
053     * External Ids for this item.
054     */
055    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
056    @Description(shortDefinition="External Ids for this item", formalDefinition="External Ids for this item." )
057    protected List<Identifier> identifier;
058
059    /**
060     * Whether this schedule record is in active use, or should not be used (such as was entered in error).
061     */
062    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
063    @Description(shortDefinition="Whether this schedule is in active use", formalDefinition="Whether this schedule record is in active use, or should not be used (such as was entered in error)." )
064    protected BooleanType active;
065
066    /**
067     * A broad categorisation of the service that is to be performed during this appointment.
068     */
069    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
070    @Description(shortDefinition="A broad categorisation of the service that is to be performed during this appointment", formalDefinition="A broad categorisation of the service that is to be performed during this appointment." )
071    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
072    protected CodeableConcept serviceCategory;
073
074    /**
075     * The specific service that is to be performed during this appointment.
076     */
077    @Child(name = "serviceType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
078    @Description(shortDefinition="The specific service that is to be performed during this appointment", formalDefinition="The specific service that is to be performed during this appointment." )
079    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-type")
080    protected List<CodeableConcept> serviceType;
081
082    /**
083     * The specialty of a practitioner that would be required to perform the service requested in this appointment.
084     */
085    @Child(name = "specialty", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
086    @Description(shortDefinition="The specialty of a practitioner that would be required to perform the service requested in this appointment", formalDefinition="The specialty of a practitioner that would be required to perform the service requested in this appointment." )
087    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
088    protected List<CodeableConcept> specialty;
089
090    /**
091     * The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.
092     */
093    @Child(name = "actor", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=5, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
094    @Description(shortDefinition="The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson", formalDefinition="The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson." )
095    protected List<Reference> actor;
096    /**
097     * The actual objects that are the target of the reference (The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.)
098     */
099    protected List<Resource> actorTarget;
100
101
102    /**
103     * The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates.
104     */
105    @Child(name = "planningHorizon", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
106    @Description(shortDefinition="The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates", formalDefinition="The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates." )
107    protected Period planningHorizon;
108
109    /**
110     * Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
111     */
112    @Child(name = "comment", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
113    @Description(shortDefinition="Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated", formalDefinition="Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated." )
114    protected StringType comment;
115
116    private static final long serialVersionUID = -266680210L;
117
118  /**
119   * Constructor
120   */
121    public Schedule() {
122      super();
123    }
124
125    /**
126     * @return {@link #identifier} (External Ids for this item.)
127     */
128    public List<Identifier> getIdentifier() { 
129      if (this.identifier == null)
130        this.identifier = new ArrayList<Identifier>();
131      return this.identifier;
132    }
133
134    /**
135     * @return Returns a reference to <code>this</code> for easy method chaining
136     */
137    public Schedule setIdentifier(List<Identifier> theIdentifier) { 
138      this.identifier = theIdentifier;
139      return this;
140    }
141
142    public boolean hasIdentifier() { 
143      if (this.identifier == null)
144        return false;
145      for (Identifier item : this.identifier)
146        if (!item.isEmpty())
147          return true;
148      return false;
149    }
150
151    public Identifier addIdentifier() { //3
152      Identifier t = new Identifier();
153      if (this.identifier == null)
154        this.identifier = new ArrayList<Identifier>();
155      this.identifier.add(t);
156      return t;
157    }
158
159    public Schedule addIdentifier(Identifier t) { //3
160      if (t == null)
161        return this;
162      if (this.identifier == null)
163        this.identifier = new ArrayList<Identifier>();
164      this.identifier.add(t);
165      return this;
166    }
167
168    /**
169     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
170     */
171    public Identifier getIdentifierFirstRep() { 
172      if (getIdentifier().isEmpty()) {
173        addIdentifier();
174      }
175      return getIdentifier().get(0);
176    }
177
178    /**
179     * @return {@link #active} (Whether this schedule record is in active use, or should not be used (such as was entered in error).). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
180     */
181    public BooleanType getActiveElement() { 
182      if (this.active == null)
183        if (Configuration.errorOnAutoCreate())
184          throw new Error("Attempt to auto-create Schedule.active");
185        else if (Configuration.doAutoCreate())
186          this.active = new BooleanType(); // bb
187      return this.active;
188    }
189
190    public boolean hasActiveElement() { 
191      return this.active != null && !this.active.isEmpty();
192    }
193
194    public boolean hasActive() { 
195      return this.active != null && !this.active.isEmpty();
196    }
197
198    /**
199     * @param value {@link #active} (Whether this schedule record is in active use, or should not be used (such as was entered in error).). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
200     */
201    public Schedule setActiveElement(BooleanType value) { 
202      this.active = value;
203      return this;
204    }
205
206    /**
207     * @return Whether this schedule record is in active use, or should not be used (such as was entered in error).
208     */
209    public boolean getActive() { 
210      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
211    }
212
213    /**
214     * @param value Whether this schedule record is in active use, or should not be used (such as was entered in error).
215     */
216    public Schedule setActive(boolean value) { 
217        if (this.active == null)
218          this.active = new BooleanType();
219        this.active.setValue(value);
220      return this;
221    }
222
223    /**
224     * @return {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
225     */
226    public CodeableConcept getServiceCategory() { 
227      if (this.serviceCategory == null)
228        if (Configuration.errorOnAutoCreate())
229          throw new Error("Attempt to auto-create Schedule.serviceCategory");
230        else if (Configuration.doAutoCreate())
231          this.serviceCategory = new CodeableConcept(); // cc
232      return this.serviceCategory;
233    }
234
235    public boolean hasServiceCategory() { 
236      return this.serviceCategory != null && !this.serviceCategory.isEmpty();
237    }
238
239    /**
240     * @param value {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
241     */
242    public Schedule setServiceCategory(CodeableConcept value)  { 
243      this.serviceCategory = value;
244      return this;
245    }
246
247    /**
248     * @return {@link #serviceType} (The specific service that is to be performed during this appointment.)
249     */
250    public List<CodeableConcept> getServiceType() { 
251      if (this.serviceType == null)
252        this.serviceType = new ArrayList<CodeableConcept>();
253      return this.serviceType;
254    }
255
256    /**
257     * @return Returns a reference to <code>this</code> for easy method chaining
258     */
259    public Schedule setServiceType(List<CodeableConcept> theServiceType) { 
260      this.serviceType = theServiceType;
261      return this;
262    }
263
264    public boolean hasServiceType() { 
265      if (this.serviceType == null)
266        return false;
267      for (CodeableConcept item : this.serviceType)
268        if (!item.isEmpty())
269          return true;
270      return false;
271    }
272
273    public CodeableConcept addServiceType() { //3
274      CodeableConcept t = new CodeableConcept();
275      if (this.serviceType == null)
276        this.serviceType = new ArrayList<CodeableConcept>();
277      this.serviceType.add(t);
278      return t;
279    }
280
281    public Schedule addServiceType(CodeableConcept t) { //3
282      if (t == null)
283        return this;
284      if (this.serviceType == null)
285        this.serviceType = new ArrayList<CodeableConcept>();
286      this.serviceType.add(t);
287      return this;
288    }
289
290    /**
291     * @return The first repetition of repeating field {@link #serviceType}, creating it if it does not already exist
292     */
293    public CodeableConcept getServiceTypeFirstRep() { 
294      if (getServiceType().isEmpty()) {
295        addServiceType();
296      }
297      return getServiceType().get(0);
298    }
299
300    /**
301     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
302     */
303    public List<CodeableConcept> getSpecialty() { 
304      if (this.specialty == null)
305        this.specialty = new ArrayList<CodeableConcept>();
306      return this.specialty;
307    }
308
309    /**
310     * @return Returns a reference to <code>this</code> for easy method chaining
311     */
312    public Schedule setSpecialty(List<CodeableConcept> theSpecialty) { 
313      this.specialty = theSpecialty;
314      return this;
315    }
316
317    public boolean hasSpecialty() { 
318      if (this.specialty == null)
319        return false;
320      for (CodeableConcept item : this.specialty)
321        if (!item.isEmpty())
322          return true;
323      return false;
324    }
325
326    public CodeableConcept addSpecialty() { //3
327      CodeableConcept t = new CodeableConcept();
328      if (this.specialty == null)
329        this.specialty = new ArrayList<CodeableConcept>();
330      this.specialty.add(t);
331      return t;
332    }
333
334    public Schedule addSpecialty(CodeableConcept t) { //3
335      if (t == null)
336        return this;
337      if (this.specialty == null)
338        this.specialty = new ArrayList<CodeableConcept>();
339      this.specialty.add(t);
340      return this;
341    }
342
343    /**
344     * @return The first repetition of repeating field {@link #specialty}, creating it if it does not already exist
345     */
346    public CodeableConcept getSpecialtyFirstRep() { 
347      if (getSpecialty().isEmpty()) {
348        addSpecialty();
349      }
350      return getSpecialty().get(0);
351    }
352
353    /**
354     * @return {@link #actor} (The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.)
355     */
356    public List<Reference> getActor() { 
357      if (this.actor == null)
358        this.actor = new ArrayList<Reference>();
359      return this.actor;
360    }
361
362    /**
363     * @return Returns a reference to <code>this</code> for easy method chaining
364     */
365    public Schedule setActor(List<Reference> theActor) { 
366      this.actor = theActor;
367      return this;
368    }
369
370    public boolean hasActor() { 
371      if (this.actor == null)
372        return false;
373      for (Reference item : this.actor)
374        if (!item.isEmpty())
375          return true;
376      return false;
377    }
378
379    public Reference addActor() { //3
380      Reference t = new Reference();
381      if (this.actor == null)
382        this.actor = new ArrayList<Reference>();
383      this.actor.add(t);
384      return t;
385    }
386
387    public Schedule addActor(Reference t) { //3
388      if (t == null)
389        return this;
390      if (this.actor == null)
391        this.actor = new ArrayList<Reference>();
392      this.actor.add(t);
393      return this;
394    }
395
396    /**
397     * @return The first repetition of repeating field {@link #actor}, creating it if it does not already exist
398     */
399    public Reference getActorFirstRep() { 
400      if (getActor().isEmpty()) {
401        addActor();
402      }
403      return getActor().get(0);
404    }
405
406    /**
407     * @deprecated Use Reference#setResource(IBaseResource) instead
408     */
409    @Deprecated
410    public List<Resource> getActorTarget() { 
411      if (this.actorTarget == null)
412        this.actorTarget = new ArrayList<Resource>();
413      return this.actorTarget;
414    }
415
416    /**
417     * @return {@link #planningHorizon} (The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates.)
418     */
419    public Period getPlanningHorizon() { 
420      if (this.planningHorizon == null)
421        if (Configuration.errorOnAutoCreate())
422          throw new Error("Attempt to auto-create Schedule.planningHorizon");
423        else if (Configuration.doAutoCreate())
424          this.planningHorizon = new Period(); // cc
425      return this.planningHorizon;
426    }
427
428    public boolean hasPlanningHorizon() { 
429      return this.planningHorizon != null && !this.planningHorizon.isEmpty();
430    }
431
432    /**
433     * @param value {@link #planningHorizon} (The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates.)
434     */
435    public Schedule setPlanningHorizon(Period value)  { 
436      this.planningHorizon = value;
437      return this;
438    }
439
440    /**
441     * @return {@link #comment} (Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
442     */
443    public StringType getCommentElement() { 
444      if (this.comment == null)
445        if (Configuration.errorOnAutoCreate())
446          throw new Error("Attempt to auto-create Schedule.comment");
447        else if (Configuration.doAutoCreate())
448          this.comment = new StringType(); // bb
449      return this.comment;
450    }
451
452    public boolean hasCommentElement() { 
453      return this.comment != null && !this.comment.isEmpty();
454    }
455
456    public boolean hasComment() { 
457      return this.comment != null && !this.comment.isEmpty();
458    }
459
460    /**
461     * @param value {@link #comment} (Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
462     */
463    public Schedule setCommentElement(StringType value) { 
464      this.comment = value;
465      return this;
466    }
467
468    /**
469     * @return Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
470     */
471    public String getComment() { 
472      return this.comment == null ? null : this.comment.getValue();
473    }
474
475    /**
476     * @param value Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
477     */
478    public Schedule setComment(String value) { 
479      if (Utilities.noString(value))
480        this.comment = null;
481      else {
482        if (this.comment == null)
483          this.comment = new StringType();
484        this.comment.setValue(value);
485      }
486      return this;
487    }
488
489      protected void listChildren(List<Property> children) {
490        super.listChildren(children);
491        children.add(new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier));
492        children.add(new Property("active", "boolean", "Whether this schedule record is in active use, or should not be used (such as was entered in error).", 0, 1, active));
493        children.add(new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, 1, serviceCategory));
494        children.add(new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType));
495        children.add(new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty));
496        children.add(new Property("actor", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)", "The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.", 0, java.lang.Integer.MAX_VALUE, actor));
497        children.add(new Property("planningHorizon", "Period", "The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates.", 0, 1, planningHorizon));
498        children.add(new Property("comment", "string", "Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.", 0, 1, comment));
499      }
500
501      @Override
502      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
503        switch (_hash) {
504        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier);
505        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this schedule record is in active use, or should not be used (such as was entered in error).", 0, 1, active);
506        case 1281188563: /*serviceCategory*/  return new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, 1, serviceCategory);
507        case -1928370289: /*serviceType*/  return new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType);
508        case -1694759682: /*specialty*/  return new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty);
509        case 92645877: /*actor*/  return new Property("actor", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)", "The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.", 0, java.lang.Integer.MAX_VALUE, actor);
510        case -1718507650: /*planningHorizon*/  return new Property("planningHorizon", "Period", "The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates.", 0, 1, planningHorizon);
511        case 950398559: /*comment*/  return new Property("comment", "string", "Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.", 0, 1, comment);
512        default: return super.getNamedProperty(_hash, _name, _checkValid);
513        }
514
515      }
516
517      @Override
518      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
519        switch (hash) {
520        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
521        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
522        case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : new Base[] {this.serviceCategory}; // CodeableConcept
523        case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
524        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
525        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : this.actor.toArray(new Base[this.actor.size()]); // Reference
526        case -1718507650: /*planningHorizon*/ return this.planningHorizon == null ? new Base[0] : new Base[] {this.planningHorizon}; // Period
527        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
528        default: return super.getProperty(hash, name, checkValid);
529        }
530
531      }
532
533      @Override
534      public Base setProperty(int hash, String name, Base value) throws FHIRException {
535        switch (hash) {
536        case -1618432855: // identifier
537          this.getIdentifier().add(castToIdentifier(value)); // Identifier
538          return value;
539        case -1422950650: // active
540          this.active = castToBoolean(value); // BooleanType
541          return value;
542        case 1281188563: // serviceCategory
543          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
544          return value;
545        case -1928370289: // serviceType
546          this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
547          return value;
548        case -1694759682: // specialty
549          this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
550          return value;
551        case 92645877: // actor
552          this.getActor().add(castToReference(value)); // Reference
553          return value;
554        case -1718507650: // planningHorizon
555          this.planningHorizon = castToPeriod(value); // Period
556          return value;
557        case 950398559: // comment
558          this.comment = castToString(value); // StringType
559          return value;
560        default: return super.setProperty(hash, name, value);
561        }
562
563      }
564
565      @Override
566      public Base setProperty(String name, Base value) throws FHIRException {
567        if (name.equals("identifier")) {
568          this.getIdentifier().add(castToIdentifier(value));
569        } else if (name.equals("active")) {
570          this.active = castToBoolean(value); // BooleanType
571        } else if (name.equals("serviceCategory")) {
572          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
573        } else if (name.equals("serviceType")) {
574          this.getServiceType().add(castToCodeableConcept(value));
575        } else if (name.equals("specialty")) {
576          this.getSpecialty().add(castToCodeableConcept(value));
577        } else if (name.equals("actor")) {
578          this.getActor().add(castToReference(value));
579        } else if (name.equals("planningHorizon")) {
580          this.planningHorizon = castToPeriod(value); // Period
581        } else if (name.equals("comment")) {
582          this.comment = castToString(value); // StringType
583        } else
584          return super.setProperty(name, value);
585        return value;
586      }
587
588      @Override
589      public Base makeProperty(int hash, String name) throws FHIRException {
590        switch (hash) {
591        case -1618432855:  return addIdentifier(); 
592        case -1422950650:  return getActiveElement();
593        case 1281188563:  return getServiceCategory(); 
594        case -1928370289:  return addServiceType(); 
595        case -1694759682:  return addSpecialty(); 
596        case 92645877:  return addActor(); 
597        case -1718507650:  return getPlanningHorizon(); 
598        case 950398559:  return getCommentElement();
599        default: return super.makeProperty(hash, name);
600        }
601
602      }
603
604      @Override
605      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
606        switch (hash) {
607        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
608        case -1422950650: /*active*/ return new String[] {"boolean"};
609        case 1281188563: /*serviceCategory*/ return new String[] {"CodeableConcept"};
610        case -1928370289: /*serviceType*/ return new String[] {"CodeableConcept"};
611        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
612        case 92645877: /*actor*/ return new String[] {"Reference"};
613        case -1718507650: /*planningHorizon*/ return new String[] {"Period"};
614        case 950398559: /*comment*/ return new String[] {"string"};
615        default: return super.getTypesForProperty(hash, name);
616        }
617
618      }
619
620      @Override
621      public Base addChild(String name) throws FHIRException {
622        if (name.equals("identifier")) {
623          return addIdentifier();
624        }
625        else if (name.equals("active")) {
626          throw new FHIRException("Cannot call addChild on a primitive type Schedule.active");
627        }
628        else if (name.equals("serviceCategory")) {
629          this.serviceCategory = new CodeableConcept();
630          return this.serviceCategory;
631        }
632        else if (name.equals("serviceType")) {
633          return addServiceType();
634        }
635        else if (name.equals("specialty")) {
636          return addSpecialty();
637        }
638        else if (name.equals("actor")) {
639          return addActor();
640        }
641        else if (name.equals("planningHorizon")) {
642          this.planningHorizon = new Period();
643          return this.planningHorizon;
644        }
645        else if (name.equals("comment")) {
646          throw new FHIRException("Cannot call addChild on a primitive type Schedule.comment");
647        }
648        else
649          return super.addChild(name);
650      }
651
652  public String fhirType() {
653    return "Schedule";
654
655  }
656
657      public Schedule copy() {
658        Schedule dst = new Schedule();
659        copyValues(dst);
660        if (identifier != null) {
661          dst.identifier = new ArrayList<Identifier>();
662          for (Identifier i : identifier)
663            dst.identifier.add(i.copy());
664        };
665        dst.active = active == null ? null : active.copy();
666        dst.serviceCategory = serviceCategory == null ? null : serviceCategory.copy();
667        if (serviceType != null) {
668          dst.serviceType = new ArrayList<CodeableConcept>();
669          for (CodeableConcept i : serviceType)
670            dst.serviceType.add(i.copy());
671        };
672        if (specialty != null) {
673          dst.specialty = new ArrayList<CodeableConcept>();
674          for (CodeableConcept i : specialty)
675            dst.specialty.add(i.copy());
676        };
677        if (actor != null) {
678          dst.actor = new ArrayList<Reference>();
679          for (Reference i : actor)
680            dst.actor.add(i.copy());
681        };
682        dst.planningHorizon = planningHorizon == null ? null : planningHorizon.copy();
683        dst.comment = comment == null ? null : comment.copy();
684        return dst;
685      }
686
687      protected Schedule typedCopy() {
688        return copy();
689      }
690
691      @Override
692      public boolean equalsDeep(Base other_) {
693        if (!super.equalsDeep(other_))
694          return false;
695        if (!(other_ instanceof Schedule))
696          return false;
697        Schedule o = (Schedule) other_;
698        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(serviceCategory, o.serviceCategory, true)
699           && compareDeep(serviceType, o.serviceType, true) && compareDeep(specialty, o.specialty, true) && compareDeep(actor, o.actor, true)
700           && compareDeep(planningHorizon, o.planningHorizon, true) && compareDeep(comment, o.comment, true)
701          ;
702      }
703
704      @Override
705      public boolean equalsShallow(Base other_) {
706        if (!super.equalsShallow(other_))
707          return false;
708        if (!(other_ instanceof Schedule))
709          return false;
710        Schedule o = (Schedule) other_;
711        return compareValues(active, o.active, true) && compareValues(comment, o.comment, true);
712      }
713
714      public boolean isEmpty() {
715        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, serviceCategory
716          , serviceType, specialty, actor, planningHorizon, comment);
717      }
718
719  @Override
720  public ResourceType getResourceType() {
721    return ResourceType.Schedule;
722   }
723
724 /**
725   * Search parameter: <b>actor</b>
726   * <p>
727   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
728   * Type: <b>reference</b><br>
729   * Path: <b>Schedule.actor</b><br>
730   * </p>
731   */
732  @SearchParamDefinition(name="actor", path="Schedule.actor", description="The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @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={Device.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
733  public static final String SP_ACTOR = "actor";
734 /**
735   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
736   * <p>
737   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
738   * Type: <b>reference</b><br>
739   * Path: <b>Schedule.actor</b><br>
740   * </p>
741   */
742  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
743
744/**
745   * Constant for fluent queries to be used to add include statements. Specifies
746   * the path value of "<b>Schedule:actor</b>".
747   */
748  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Schedule:actor").toLocked();
749
750 /**
751   * Search parameter: <b>date</b>
752   * <p>
753   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
754   * Type: <b>date</b><br>
755   * Path: <b>Schedule.planningHorizon</b><br>
756   * </p>
757   */
758  @SearchParamDefinition(name="date", path="Schedule.planningHorizon", description="Search for Schedule resources that have a period that contains this date specified", type="date" )
759  public static final String SP_DATE = "date";
760 /**
761   * <b>Fluent Client</b> search parameter constant for <b>date</b>
762   * <p>
763   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
764   * Type: <b>date</b><br>
765   * Path: <b>Schedule.planningHorizon</b><br>
766   * </p>
767   */
768  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
769
770 /**
771   * Search parameter: <b>identifier</b>
772   * <p>
773   * Description: <b>A Schedule Identifier</b><br>
774   * Type: <b>token</b><br>
775   * Path: <b>Schedule.identifier</b><br>
776   * </p>
777   */
778  @SearchParamDefinition(name="identifier", path="Schedule.identifier", description="A Schedule Identifier", type="token" )
779  public static final String SP_IDENTIFIER = "identifier";
780 /**
781   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
782   * <p>
783   * Description: <b>A Schedule Identifier</b><br>
784   * Type: <b>token</b><br>
785   * Path: <b>Schedule.identifier</b><br>
786   * </p>
787   */
788  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
789
790 /**
791   * Search parameter: <b>active</b>
792   * <p>
793   * Description: <b>Is the schedule in active use</b><br>
794   * Type: <b>token</b><br>
795   * Path: <b>Schedule.active</b><br>
796   * </p>
797   */
798  @SearchParamDefinition(name="active", path="Schedule.active", description="Is the schedule in active use", type="token" )
799  public static final String SP_ACTIVE = "active";
800 /**
801   * <b>Fluent Client</b> search parameter constant for <b>active</b>
802   * <p>
803   * Description: <b>Is the schedule in active use</b><br>
804   * Type: <b>token</b><br>
805   * Path: <b>Schedule.active</b><br>
806   * </p>
807   */
808  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
809
810 /**
811   * Search parameter: <b>type</b>
812   * <p>
813   * Description: <b>The type of appointments that can be booked into associated slot(s)</b><br>
814   * Type: <b>token</b><br>
815   * Path: <b>Schedule.serviceType</b><br>
816   * </p>
817   */
818  @SearchParamDefinition(name="type", path="Schedule.serviceType", description="The type of appointments that can be booked into associated slot(s)", type="token" )
819  public static final String SP_TYPE = "type";
820 /**
821   * <b>Fluent Client</b> search parameter constant for <b>type</b>
822   * <p>
823   * Description: <b>The type of appointments that can be booked into associated slot(s)</b><br>
824   * Type: <b>token</b><br>
825   * Path: <b>Schedule.serviceType</b><br>
826   * </p>
827   */
828  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
829
830
831}
832