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