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