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