001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
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.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * A container for slots of time that may be available for booking appointments.
070 */
071@ResourceDef(name="Schedule", profile="http://hl7.org/fhir/StructureDefinition/Schedule")
072public class Schedule extends DomainResource {
073
074    /**
075     * External Ids for this item.
076     */
077    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
078    @Description(shortDefinition="External Ids for this item", formalDefinition="External Ids for this item." )
079    protected List<Identifier> identifier;
080
081    /**
082     * Whether this schedule record is in active use or should not be used (such as was entered in error).
083     */
084    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
085    @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)." )
086    protected BooleanType active;
087
088    /**
089     * A broad categorization of the service that is to be performed during this appointment.
090     */
091    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
092    @Description(shortDefinition="High-level category", formalDefinition="A broad categorization of the service that is to be performed during this appointment." )
093    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
094    protected List<CodeableConcept> serviceCategory;
095
096    /**
097     * The specific service that is to be performed during this appointment.
098     */
099    @Child(name = "serviceType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
100    @Description(shortDefinition="Specific service", formalDefinition="The specific service that is to be performed during this appointment." )
101    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-type")
102    protected List<CodeableConcept> serviceType;
103
104    /**
105     * The specialty of a practitioner that would be required to perform the service requested in this appointment.
106     */
107    @Child(name = "specialty", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
108    @Description(shortDefinition="Type of specialty needed", formalDefinition="The specialty of a practitioner that would be required to perform the service requested in this appointment." )
109    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
110    protected List<CodeableConcept> specialty;
111
112    /**
113     * Slots that reference this schedule resource provide the availability details to these referenced resource(s).
114     */
115    @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)
116    @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)." )
117    protected List<Reference> actor;
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 = -1624500976L;
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     * @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.)
454     */
455    public Period getPlanningHorizon() { 
456      if (this.planningHorizon == null)
457        if (Configuration.errorOnAutoCreate())
458          throw new Error("Attempt to auto-create Schedule.planningHorizon");
459        else if (Configuration.doAutoCreate())
460          this.planningHorizon = new Period(); // cc
461      return this.planningHorizon;
462    }
463
464    public boolean hasPlanningHorizon() { 
465      return this.planningHorizon != null && !this.planningHorizon.isEmpty();
466    }
467
468    /**
469     * @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.)
470     */
471    public Schedule setPlanningHorizon(Period value) { 
472      this.planningHorizon = value;
473      return this;
474    }
475
476    /**
477     * @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
478     */
479    public StringType getCommentElement() { 
480      if (this.comment == null)
481        if (Configuration.errorOnAutoCreate())
482          throw new Error("Attempt to auto-create Schedule.comment");
483        else if (Configuration.doAutoCreate())
484          this.comment = new StringType(); // bb
485      return this.comment;
486    }
487
488    public boolean hasCommentElement() { 
489      return this.comment != null && !this.comment.isEmpty();
490    }
491
492    public boolean hasComment() { 
493      return this.comment != null && !this.comment.isEmpty();
494    }
495
496    /**
497     * @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
498     */
499    public Schedule setCommentElement(StringType value) { 
500      this.comment = value;
501      return this;
502    }
503
504    /**
505     * @return Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
506     */
507    public String getComment() { 
508      return this.comment == null ? null : this.comment.getValue();
509    }
510
511    /**
512     * @param value Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
513     */
514    public Schedule setComment(String value) { 
515      if (Utilities.noString(value))
516        this.comment = null;
517      else {
518        if (this.comment == null)
519          this.comment = new StringType();
520        this.comment.setValue(value);
521      }
522      return this;
523    }
524
525      protected void listChildren(List<Property> children) {
526        super.listChildren(children);
527        children.add(new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier));
528        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));
529        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));
530        children.add(new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType));
531        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));
532        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));
533        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));
534        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));
535      }
536
537      @Override
538      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
539        switch (_hash) {
540        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier);
541        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);
542        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);
543        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);
544        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);
545        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);
546        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);
547        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);
548        default: return super.getNamedProperty(_hash, _name, _checkValid);
549        }
550
551      }
552
553      @Override
554      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
555        switch (hash) {
556        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
557        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
558        case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : this.serviceCategory.toArray(new Base[this.serviceCategory.size()]); // CodeableConcept
559        case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
560        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
561        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : this.actor.toArray(new Base[this.actor.size()]); // Reference
562        case -1718507650: /*planningHorizon*/ return this.planningHorizon == null ? new Base[0] : new Base[] {this.planningHorizon}; // Period
563        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
564        default: return super.getProperty(hash, name, checkValid);
565        }
566
567      }
568
569      @Override
570      public Base setProperty(int hash, String name, Base value) throws FHIRException {
571        switch (hash) {
572        case -1618432855: // identifier
573          this.getIdentifier().add(castToIdentifier(value)); // Identifier
574          return value;
575        case -1422950650: // active
576          this.active = castToBoolean(value); // BooleanType
577          return value;
578        case 1281188563: // serviceCategory
579          this.getServiceCategory().add(castToCodeableConcept(value)); // CodeableConcept
580          return value;
581        case -1928370289: // serviceType
582          this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
583          return value;
584        case -1694759682: // specialty
585          this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
586          return value;
587        case 92645877: // actor
588          this.getActor().add(castToReference(value)); // Reference
589          return value;
590        case -1718507650: // planningHorizon
591          this.planningHorizon = castToPeriod(value); // Period
592          return value;
593        case 950398559: // comment
594          this.comment = castToString(value); // StringType
595          return value;
596        default: return super.setProperty(hash, name, value);
597        }
598
599      }
600
601      @Override
602      public Base setProperty(String name, Base value) throws FHIRException {
603        if (name.equals("identifier")) {
604          this.getIdentifier().add(castToIdentifier(value));
605        } else if (name.equals("active")) {
606          this.active = castToBoolean(value); // BooleanType
607        } else if (name.equals("serviceCategory")) {
608          this.getServiceCategory().add(castToCodeableConcept(value));
609        } else if (name.equals("serviceType")) {
610          this.getServiceType().add(castToCodeableConcept(value));
611        } else if (name.equals("specialty")) {
612          this.getSpecialty().add(castToCodeableConcept(value));
613        } else if (name.equals("actor")) {
614          this.getActor().add(castToReference(value));
615        } else if (name.equals("planningHorizon")) {
616          this.planningHorizon = castToPeriod(value); // Period
617        } else if (name.equals("comment")) {
618          this.comment = castToString(value); // StringType
619        } else
620          return super.setProperty(name, value);
621        return value;
622      }
623
624      @Override
625      public Base makeProperty(int hash, String name) throws FHIRException {
626        switch (hash) {
627        case -1618432855:  return addIdentifier(); 
628        case -1422950650:  return getActiveElement();
629        case 1281188563:  return addServiceCategory(); 
630        case -1928370289:  return addServiceType(); 
631        case -1694759682:  return addSpecialty(); 
632        case 92645877:  return addActor(); 
633        case -1718507650:  return getPlanningHorizon();
634        case 950398559:  return getCommentElement();
635        default: return super.makeProperty(hash, name);
636        }
637
638      }
639
640      @Override
641      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
642        switch (hash) {
643        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
644        case -1422950650: /*active*/ return new String[] {"boolean"};
645        case 1281188563: /*serviceCategory*/ return new String[] {"CodeableConcept"};
646        case -1928370289: /*serviceType*/ return new String[] {"CodeableConcept"};
647        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
648        case 92645877: /*actor*/ return new String[] {"Reference"};
649        case -1718507650: /*planningHorizon*/ return new String[] {"Period"};
650        case 950398559: /*comment*/ return new String[] {"string"};
651        default: return super.getTypesForProperty(hash, name);
652        }
653
654      }
655
656      @Override
657      public Base addChild(String name) throws FHIRException {
658        if (name.equals("identifier")) {
659          return addIdentifier();
660        }
661        else if (name.equals("active")) {
662          throw new FHIRException("Cannot call addChild on a primitive type Schedule.active");
663        }
664        else if (name.equals("serviceCategory")) {
665          return addServiceCategory();
666        }
667        else if (name.equals("serviceType")) {
668          return addServiceType();
669        }
670        else if (name.equals("specialty")) {
671          return addSpecialty();
672        }
673        else if (name.equals("actor")) {
674          return addActor();
675        }
676        else if (name.equals("planningHorizon")) {
677          this.planningHorizon = new Period();
678          return this.planningHorizon;
679        }
680        else if (name.equals("comment")) {
681          throw new FHIRException("Cannot call addChild on a primitive type Schedule.comment");
682        }
683        else
684          return super.addChild(name);
685      }
686
687  public String fhirType() {
688    return "Schedule";
689
690  }
691
692      public Schedule copy() {
693        Schedule dst = new Schedule();
694        copyValues(dst);
695        return dst;
696      }
697
698      public void copyValues(Schedule dst) {
699        super.copyValues(dst);
700        if (identifier != null) {
701          dst.identifier = new ArrayList<Identifier>();
702          for (Identifier i : identifier)
703            dst.identifier.add(i.copy());
704        };
705        dst.active = active == null ? null : active.copy();
706        if (serviceCategory != null) {
707          dst.serviceCategory = new ArrayList<CodeableConcept>();
708          for (CodeableConcept i : serviceCategory)
709            dst.serviceCategory.add(i.copy());
710        };
711        if (serviceType != null) {
712          dst.serviceType = new ArrayList<CodeableConcept>();
713          for (CodeableConcept i : serviceType)
714            dst.serviceType.add(i.copy());
715        };
716        if (specialty != null) {
717          dst.specialty = new ArrayList<CodeableConcept>();
718          for (CodeableConcept i : specialty)
719            dst.specialty.add(i.copy());
720        };
721        if (actor != null) {
722          dst.actor = new ArrayList<Reference>();
723          for (Reference i : actor)
724            dst.actor.add(i.copy());
725        };
726        dst.planningHorizon = planningHorizon == null ? null : planningHorizon.copy();
727        dst.comment = comment == null ? null : comment.copy();
728      }
729
730      protected Schedule typedCopy() {
731        return copy();
732      }
733
734      @Override
735      public boolean equalsDeep(Base other_) {
736        if (!super.equalsDeep(other_))
737          return false;
738        if (!(other_ instanceof Schedule))
739          return false;
740        Schedule o = (Schedule) other_;
741        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(serviceCategory, o.serviceCategory, true)
742           && compareDeep(serviceType, o.serviceType, true) && compareDeep(specialty, o.specialty, true) && compareDeep(actor, o.actor, true)
743           && compareDeep(planningHorizon, o.planningHorizon, true) && compareDeep(comment, o.comment, true)
744          ;
745      }
746
747      @Override
748      public boolean equalsShallow(Base other_) {
749        if (!super.equalsShallow(other_))
750          return false;
751        if (!(other_ instanceof Schedule))
752          return false;
753        Schedule o = (Schedule) other_;
754        return compareValues(active, o.active, true) && compareValues(comment, o.comment, true);
755      }
756
757      public boolean isEmpty() {
758        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, serviceCategory
759          , serviceType, specialty, actor, planningHorizon, comment);
760      }
761
762  @Override
763  public ResourceType getResourceType() {
764    return ResourceType.Schedule;
765   }
766
767 /**
768   * Search parameter: <b>actor</b>
769   * <p>
770   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
771   * Type: <b>reference</b><br>
772   * Path: <b>Schedule.actor</b><br>
773   * </p>
774   */
775  @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 } )
776  public static final String SP_ACTOR = "actor";
777 /**
778   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
779   * <p>
780   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
781   * Type: <b>reference</b><br>
782   * Path: <b>Schedule.actor</b><br>
783   * </p>
784   */
785  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
786
787/**
788   * Constant for fluent queries to be used to add include statements. Specifies
789   * the path value of "<b>Schedule:actor</b>".
790   */
791  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Schedule:actor").toLocked();
792
793 /**
794   * Search parameter: <b>date</b>
795   * <p>
796   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
797   * Type: <b>date</b><br>
798   * Path: <b>Schedule.planningHorizon</b><br>
799   * </p>
800   */
801  @SearchParamDefinition(name="date", path="Schedule.planningHorizon", description="Search for Schedule resources that have a period that contains this date specified", type="date" )
802  public static final String SP_DATE = "date";
803 /**
804   * <b>Fluent Client</b> search parameter constant for <b>date</b>
805   * <p>
806   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
807   * Type: <b>date</b><br>
808   * Path: <b>Schedule.planningHorizon</b><br>
809   * </p>
810   */
811  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
812
813 /**
814   * Search parameter: <b>identifier</b>
815   * <p>
816   * Description: <b>A Schedule Identifier</b><br>
817   * Type: <b>token</b><br>
818   * Path: <b>Schedule.identifier</b><br>
819   * </p>
820   */
821  @SearchParamDefinition(name="identifier", path="Schedule.identifier", description="A Schedule Identifier", type="token" )
822  public static final String SP_IDENTIFIER = "identifier";
823 /**
824   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
825   * <p>
826   * Description: <b>A Schedule Identifier</b><br>
827   * Type: <b>token</b><br>
828   * Path: <b>Schedule.identifier</b><br>
829   * </p>
830   */
831  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
832
833 /**
834   * Search parameter: <b>specialty</b>
835   * <p>
836   * Description: <b>Type of specialty needed</b><br>
837   * Type: <b>token</b><br>
838   * Path: <b>Schedule.specialty</b><br>
839   * </p>
840   */
841  @SearchParamDefinition(name="specialty", path="Schedule.specialty", description="Type of specialty needed", type="token" )
842  public static final String SP_SPECIALTY = "specialty";
843 /**
844   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
845   * <p>
846   * Description: <b>Type of specialty needed</b><br>
847   * Type: <b>token</b><br>
848   * Path: <b>Schedule.specialty</b><br>
849   * </p>
850   */
851  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIALTY);
852
853 /**
854   * Search parameter: <b>service-category</b>
855   * <p>
856   * Description: <b>High-level category</b><br>
857   * Type: <b>token</b><br>
858   * Path: <b>Schedule.serviceCategory</b><br>
859   * </p>
860   */
861  @SearchParamDefinition(name="service-category", path="Schedule.serviceCategory", description="High-level category", type="token" )
862  public static final String SP_SERVICE_CATEGORY = "service-category";
863 /**
864   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
865   * <p>
866   * Description: <b>High-level category</b><br>
867   * Type: <b>token</b><br>
868   * Path: <b>Schedule.serviceCategory</b><br>
869   * </p>
870   */
871  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_CATEGORY);
872
873 /**
874   * Search parameter: <b>service-type</b>
875   * <p>
876   * Description: <b>The type of appointments that can be booked into associated slot(s)</b><br>
877   * Type: <b>token</b><br>
878   * Path: <b>Schedule.serviceType</b><br>
879   * </p>
880   */
881  @SearchParamDefinition(name="service-type", path="Schedule.serviceType", description="The type of appointments that can be booked into associated slot(s)", type="token" )
882  public static final String SP_SERVICE_TYPE = "service-type";
883 /**
884   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
885   * <p>
886   * Description: <b>The type of appointments that can be booked into associated slot(s)</b><br>
887   * Type: <b>token</b><br>
888   * Path: <b>Schedule.serviceType</b><br>
889   * </p>
890   */
891  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_TYPE);
892
893 /**
894   * Search parameter: <b>active</b>
895   * <p>
896   * Description: <b>Is the schedule in active use</b><br>
897   * Type: <b>token</b><br>
898   * Path: <b>Schedule.active</b><br>
899   * </p>
900   */
901  @SearchParamDefinition(name="active", path="Schedule.active", description="Is the schedule in active use", type="token" )
902  public static final String SP_ACTIVE = "active";
903 /**
904   * <b>Fluent Client</b> search parameter constant for <b>active</b>
905   * <p>
906   * Description: <b>Is the schedule in active use</b><br>
907   * Type: <b>token</b><br>
908   * Path: <b>Schedule.active</b><br>
909   * </p>
910   */
911  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
912
913
914}
915