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