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