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