001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.r5.model.Enumerations.*;
059import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.instance.model.api.ICompositeType;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069
070/**
071 * A container for slots of time that may be available for booking appointments.
072 */
073@ResourceDef(name="Schedule", profile="http://hl7.org/fhir/StructureDefinition/Schedule")
074public class Schedule extends DomainResource {
075
076    /**
077     * External Ids for this item.
078     */
079    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
080    @Description(shortDefinition="External Ids for this item", formalDefinition="External Ids for this item." )
081    protected List<Identifier> identifier;
082
083    /**
084     * Whether this schedule record is in active use or should not be used (such as was entered in error).
085     */
086    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
087    @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)." )
088    protected BooleanType active;
089
090    /**
091     * A broad categorization of the service that is to be performed during this appointment.
092     */
093    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
094    @Description(shortDefinition="High-level category", formalDefinition="A broad categorization of the service that is to be performed during this appointment." )
095    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
096    protected List<CodeableConcept> serviceCategory;
097
098    /**
099     * The specific service that is to be performed during this appointment.
100     */
101    @Child(name = "serviceType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
102    @Description(shortDefinition="Specific service", formalDefinition="The specific service that is to be performed during this appointment." )
103    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-type")
104    protected List<CodeableConcept> serviceType;
105
106    /**
107     * The specialty of a practitioner that would be required to perform the service requested in this appointment.
108     */
109    @Child(name = "specialty", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
110    @Description(shortDefinition="Type of specialty needed", formalDefinition="The specialty of a practitioner that would be required to perform the service requested in this appointment." )
111    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
112    protected List<CodeableConcept> specialty;
113
114    /**
115     * Slots that reference this schedule resource provide the availability details to these referenced resource(s).
116     */
117    @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)
118    @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)." )
119    protected List<Reference> actor;
120
121    /**
122     * 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.
123     */
124    @Child(name = "planningHorizon", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
125    @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." )
126    protected Period planningHorizon;
127
128    /**
129     * Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
130     */
131    @Child(name = "comment", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
132    @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." )
133    protected StringType comment;
134
135    private static final long serialVersionUID = -1624500976L;
136
137  /**
138   * Constructor
139   */
140    public Schedule() {
141      super();
142    }
143
144  /**
145   * Constructor
146   */
147    public Schedule(Reference actor) {
148      super();
149      this.addActor(actor);
150    }
151
152    /**
153     * @return {@link #identifier} (External Ids for this item.)
154     */
155    public List<Identifier> getIdentifier() { 
156      if (this.identifier == null)
157        this.identifier = new ArrayList<Identifier>();
158      return this.identifier;
159    }
160
161    /**
162     * @return Returns a reference to <code>this</code> for easy method chaining
163     */
164    public Schedule setIdentifier(List<Identifier> theIdentifier) { 
165      this.identifier = theIdentifier;
166      return this;
167    }
168
169    public boolean hasIdentifier() { 
170      if (this.identifier == null)
171        return false;
172      for (Identifier item : this.identifier)
173        if (!item.isEmpty())
174          return true;
175      return false;
176    }
177
178    public Identifier addIdentifier() { //3
179      Identifier t = new Identifier();
180      if (this.identifier == null)
181        this.identifier = new ArrayList<Identifier>();
182      this.identifier.add(t);
183      return t;
184    }
185
186    public Schedule addIdentifier(Identifier t) { //3
187      if (t == null)
188        return this;
189      if (this.identifier == null)
190        this.identifier = new ArrayList<Identifier>();
191      this.identifier.add(t);
192      return this;
193    }
194
195    /**
196     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
197     */
198    public Identifier getIdentifierFirstRep() { 
199      if (getIdentifier().isEmpty()) {
200        addIdentifier();
201      }
202      return getIdentifier().get(0);
203    }
204
205    /**
206     * @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
207     */
208    public BooleanType getActiveElement() { 
209      if (this.active == null)
210        if (Configuration.errorOnAutoCreate())
211          throw new Error("Attempt to auto-create Schedule.active");
212        else if (Configuration.doAutoCreate())
213          this.active = new BooleanType(); // bb
214      return this.active;
215    }
216
217    public boolean hasActiveElement() { 
218      return this.active != null && !this.active.isEmpty();
219    }
220
221    public boolean hasActive() { 
222      return this.active != null && !this.active.isEmpty();
223    }
224
225    /**
226     * @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
227     */
228    public Schedule setActiveElement(BooleanType value) { 
229      this.active = value;
230      return this;
231    }
232
233    /**
234     * @return Whether this schedule record is in active use or should not be used (such as was entered in error).
235     */
236    public boolean getActive() { 
237      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
238    }
239
240    /**
241     * @param value Whether this schedule record is in active use or should not be used (such as was entered in error).
242     */
243    public Schedule setActive(boolean value) { 
244        if (this.active == null)
245          this.active = new BooleanType();
246        this.active.setValue(value);
247      return this;
248    }
249
250    /**
251     * @return {@link #serviceCategory} (A broad categorization of the service that is to be performed during this appointment.)
252     */
253    public List<CodeableConcept> getServiceCategory() { 
254      if (this.serviceCategory == null)
255        this.serviceCategory = new ArrayList<CodeableConcept>();
256      return this.serviceCategory;
257    }
258
259    /**
260     * @return Returns a reference to <code>this</code> for easy method chaining
261     */
262    public Schedule setServiceCategory(List<CodeableConcept> theServiceCategory) { 
263      this.serviceCategory = theServiceCategory;
264      return this;
265    }
266
267    public boolean hasServiceCategory() { 
268      if (this.serviceCategory == null)
269        return false;
270      for (CodeableConcept item : this.serviceCategory)
271        if (!item.isEmpty())
272          return true;
273      return false;
274    }
275
276    public CodeableConcept addServiceCategory() { //3
277      CodeableConcept t = new CodeableConcept();
278      if (this.serviceCategory == null)
279        this.serviceCategory = new ArrayList<CodeableConcept>();
280      this.serviceCategory.add(t);
281      return t;
282    }
283
284    public Schedule addServiceCategory(CodeableConcept t) { //3
285      if (t == null)
286        return this;
287      if (this.serviceCategory == null)
288        this.serviceCategory = new ArrayList<CodeableConcept>();
289      this.serviceCategory.add(t);
290      return this;
291    }
292
293    /**
294     * @return The first repetition of repeating field {@link #serviceCategory}, creating it if it does not already exist {3}
295     */
296    public CodeableConcept getServiceCategoryFirstRep() { 
297      if (getServiceCategory().isEmpty()) {
298        addServiceCategory();
299      }
300      return getServiceCategory().get(0);
301    }
302
303    /**
304     * @return {@link #serviceType} (The specific service that is to be performed during this appointment.)
305     */
306    public List<CodeableConcept> getServiceType() { 
307      if (this.serviceType == null)
308        this.serviceType = new ArrayList<CodeableConcept>();
309      return this.serviceType;
310    }
311
312    /**
313     * @return Returns a reference to <code>this</code> for easy method chaining
314     */
315    public Schedule setServiceType(List<CodeableConcept> theServiceType) { 
316      this.serviceType = theServiceType;
317      return this;
318    }
319
320    public boolean hasServiceType() { 
321      if (this.serviceType == null)
322        return false;
323      for (CodeableConcept item : this.serviceType)
324        if (!item.isEmpty())
325          return true;
326      return false;
327    }
328
329    public CodeableConcept addServiceType() { //3
330      CodeableConcept t = new CodeableConcept();
331      if (this.serviceType == null)
332        this.serviceType = new ArrayList<CodeableConcept>();
333      this.serviceType.add(t);
334      return t;
335    }
336
337    public Schedule addServiceType(CodeableConcept t) { //3
338      if (t == null)
339        return this;
340      if (this.serviceType == null)
341        this.serviceType = new ArrayList<CodeableConcept>();
342      this.serviceType.add(t);
343      return this;
344    }
345
346    /**
347     * @return The first repetition of repeating field {@link #serviceType}, creating it if it does not already exist {3}
348     */
349    public CodeableConcept getServiceTypeFirstRep() { 
350      if (getServiceType().isEmpty()) {
351        addServiceType();
352      }
353      return getServiceType().get(0);
354    }
355
356    /**
357     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
358     */
359    public List<CodeableConcept> getSpecialty() { 
360      if (this.specialty == null)
361        this.specialty = new ArrayList<CodeableConcept>();
362      return this.specialty;
363    }
364
365    /**
366     * @return Returns a reference to <code>this</code> for easy method chaining
367     */
368    public Schedule setSpecialty(List<CodeableConcept> theSpecialty) { 
369      this.specialty = theSpecialty;
370      return this;
371    }
372
373    public boolean hasSpecialty() { 
374      if (this.specialty == null)
375        return false;
376      for (CodeableConcept item : this.specialty)
377        if (!item.isEmpty())
378          return true;
379      return false;
380    }
381
382    public CodeableConcept addSpecialty() { //3
383      CodeableConcept t = new CodeableConcept();
384      if (this.specialty == null)
385        this.specialty = new ArrayList<CodeableConcept>();
386      this.specialty.add(t);
387      return t;
388    }
389
390    public Schedule addSpecialty(CodeableConcept t) { //3
391      if (t == null)
392        return this;
393      if (this.specialty == null)
394        this.specialty = new ArrayList<CodeableConcept>();
395      this.specialty.add(t);
396      return this;
397    }
398
399    /**
400     * @return The first repetition of repeating field {@link #specialty}, creating it if it does not already exist {3}
401     */
402    public CodeableConcept getSpecialtyFirstRep() { 
403      if (getSpecialty().isEmpty()) {
404        addSpecialty();
405      }
406      return getSpecialty().get(0);
407    }
408
409    /**
410     * @return {@link #actor} (Slots that reference this schedule resource provide the availability details to these referenced resource(s).)
411     */
412    public List<Reference> getActor() { 
413      if (this.actor == null)
414        this.actor = new ArrayList<Reference>();
415      return this.actor;
416    }
417
418    /**
419     * @return Returns a reference to <code>this</code> for easy method chaining
420     */
421    public Schedule setActor(List<Reference> theActor) { 
422      this.actor = theActor;
423      return this;
424    }
425
426    public boolean hasActor() { 
427      if (this.actor == null)
428        return false;
429      for (Reference item : this.actor)
430        if (!item.isEmpty())
431          return true;
432      return false;
433    }
434
435    public Reference addActor() { //3
436      Reference t = new Reference();
437      if (this.actor == null)
438        this.actor = new ArrayList<Reference>();
439      this.actor.add(t);
440      return t;
441    }
442
443    public Schedule addActor(Reference t) { //3
444      if (t == null)
445        return this;
446      if (this.actor == null)
447        this.actor = new ArrayList<Reference>();
448      this.actor.add(t);
449      return this;
450    }
451
452    /**
453     * @return The first repetition of repeating field {@link #actor}, creating it if it does not already exist {3}
454     */
455    public Reference getActorFirstRep() { 
456      if (getActor().isEmpty()) {
457        addActor();
458      }
459      return getActor().get(0);
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(TypeConvertor.castToIdentifier(value)); // Identifier
584          return value;
585        case -1422950650: // active
586          this.active = TypeConvertor.castToBoolean(value); // BooleanType
587          return value;
588        case 1281188563: // serviceCategory
589          this.getServiceCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
590          return value;
591        case -1928370289: // serviceType
592          this.getServiceType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
593          return value;
594        case -1694759682: // specialty
595          this.getSpecialty().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
596          return value;
597        case 92645877: // actor
598          this.getActor().add(TypeConvertor.castToReference(value)); // Reference
599          return value;
600        case -1718507650: // planningHorizon
601          this.planningHorizon = TypeConvertor.castToPeriod(value); // Period
602          return value;
603        case 950398559: // comment
604          this.comment = TypeConvertor.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(TypeConvertor.castToIdentifier(value));
615        } else if (name.equals("active")) {
616          this.active = TypeConvertor.castToBoolean(value); // BooleanType
617        } else if (name.equals("serviceCategory")) {
618          this.getServiceCategory().add(TypeConvertor.castToCodeableConcept(value));
619        } else if (name.equals("serviceType")) {
620          this.getServiceType().add(TypeConvertor.castToCodeableConcept(value));
621        } else if (name.equals("specialty")) {
622          this.getSpecialty().add(TypeConvertor.castToCodeableConcept(value));
623        } else if (name.equals("actor")) {
624          this.getActor().add(TypeConvertor.castToReference(value));
625        } else if (name.equals("planningHorizon")) {
626          this.planningHorizon = TypeConvertor.castToPeriod(value); // Period
627        } else if (name.equals("comment")) {
628          this.comment = TypeConvertor.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        return dst;
706      }
707
708      public void copyValues(Schedule dst) {
709        super.copyValues(dst);
710        if (identifier != null) {
711          dst.identifier = new ArrayList<Identifier>();
712          for (Identifier i : identifier)
713            dst.identifier.add(i.copy());
714        };
715        dst.active = active == null ? null : active.copy();
716        if (serviceCategory != null) {
717          dst.serviceCategory = new ArrayList<CodeableConcept>();
718          for (CodeableConcept i : serviceCategory)
719            dst.serviceCategory.add(i.copy());
720        };
721        if (serviceType != null) {
722          dst.serviceType = new ArrayList<CodeableConcept>();
723          for (CodeableConcept i : serviceType)
724            dst.serviceType.add(i.copy());
725        };
726        if (specialty != null) {
727          dst.specialty = new ArrayList<CodeableConcept>();
728          for (CodeableConcept i : specialty)
729            dst.specialty.add(i.copy());
730        };
731        if (actor != null) {
732          dst.actor = new ArrayList<Reference>();
733          for (Reference i : actor)
734            dst.actor.add(i.copy());
735        };
736        dst.planningHorizon = planningHorizon == null ? null : planningHorizon.copy();
737        dst.comment = comment == null ? null : comment.copy();
738      }
739
740      protected Schedule typedCopy() {
741        return copy();
742      }
743
744      @Override
745      public boolean equalsDeep(Base other_) {
746        if (!super.equalsDeep(other_))
747          return false;
748        if (!(other_ instanceof Schedule))
749          return false;
750        Schedule o = (Schedule) other_;
751        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(serviceCategory, o.serviceCategory, true)
752           && compareDeep(serviceType, o.serviceType, true) && compareDeep(specialty, o.specialty, true) && compareDeep(actor, o.actor, true)
753           && compareDeep(planningHorizon, o.planningHorizon, true) && compareDeep(comment, o.comment, true)
754          ;
755      }
756
757      @Override
758      public boolean equalsShallow(Base other_) {
759        if (!super.equalsShallow(other_))
760          return false;
761        if (!(other_ instanceof Schedule))
762          return false;
763        Schedule o = (Schedule) other_;
764        return compareValues(active, o.active, true) && compareValues(comment, o.comment, true);
765      }
766
767      public boolean isEmpty() {
768        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, serviceCategory
769          , serviceType, specialty, actor, planningHorizon, comment);
770      }
771
772  @Override
773  public ResourceType getResourceType() {
774    return ResourceType.Schedule;
775   }
776
777 /**
778   * Search parameter: <b>active</b>
779   * <p>
780   * Description: <b>Is the schedule in active use</b><br>
781   * Type: <b>token</b><br>
782   * Path: <b>Schedule.active</b><br>
783   * </p>
784   */
785  @SearchParamDefinition(name="active", path="Schedule.active", description="Is the schedule in active use", type="token" )
786  public static final String SP_ACTIVE = "active";
787 /**
788   * <b>Fluent Client</b> search parameter constant for <b>active</b>
789   * <p>
790   * Description: <b>Is the schedule in active use</b><br>
791   * Type: <b>token</b><br>
792   * Path: <b>Schedule.active</b><br>
793   * </p>
794   */
795  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
796
797 /**
798   * Search parameter: <b>actor</b>
799   * <p>
800   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
801   * Type: <b>reference</b><br>
802   * Path: <b>Schedule.actor</b><br>
803   * </p>
804   */
805  @SearchParamDefinition(name="actor", path="Schedule.actor", description="The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={Device.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
806  public static final String SP_ACTOR = "actor";
807 /**
808   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
809   * <p>
810   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
811   * Type: <b>reference</b><br>
812   * Path: <b>Schedule.actor</b><br>
813   * </p>
814   */
815  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
816
817/**
818   * Constant for fluent queries to be used to add include statements. Specifies
819   * the path value of "<b>Schedule:actor</b>".
820   */
821  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Schedule:actor").toLocked();
822
823 /**
824   * Search parameter: <b>date</b>
825   * <p>
826   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
827   * Type: <b>date</b><br>
828   * Path: <b>Schedule.planningHorizon</b><br>
829   * </p>
830   */
831  @SearchParamDefinition(name="date", path="Schedule.planningHorizon", description="Search for Schedule resources that have a period that contains this date specified", type="date" )
832  public static final String SP_DATE = "date";
833 /**
834   * <b>Fluent Client</b> search parameter constant for <b>date</b>
835   * <p>
836   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
837   * Type: <b>date</b><br>
838   * Path: <b>Schedule.planningHorizon</b><br>
839   * </p>
840   */
841  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
842
843 /**
844   * Search parameter: <b>identifier</b>
845   * <p>
846   * Description: <b>A Schedule Identifier</b><br>
847   * Type: <b>token</b><br>
848   * Path: <b>Schedule.identifier</b><br>
849   * </p>
850   */
851  @SearchParamDefinition(name="identifier", path="Schedule.identifier", description="A Schedule Identifier", type="token" )
852  public static final String SP_IDENTIFIER = "identifier";
853 /**
854   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
855   * <p>
856   * Description: <b>A Schedule Identifier</b><br>
857   * Type: <b>token</b><br>
858   * Path: <b>Schedule.identifier</b><br>
859   * </p>
860   */
861  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
862
863 /**
864   * Search parameter: <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  @SearchParamDefinition(name="service-category", path="Schedule.serviceCategory", description="High-level category", type="token" )
872  public static final String SP_SERVICE_CATEGORY = "service-category";
873 /**
874   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
875   * <p>
876   * Description: <b>High-level category</b><br>
877   * Type: <b>token</b><br>
878   * Path: <b>Schedule.serviceCategory</b><br>
879   * </p>
880   */
881  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_CATEGORY);
882
883 /**
884   * Search parameter: <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  @SearchParamDefinition(name="service-type", path="Schedule.serviceType", description="The type of appointments that can be booked into associated slot(s)", type="token" )
892  public static final String SP_SERVICE_TYPE = "service-type";
893 /**
894   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
895   * <p>
896   * Description: <b>The type of appointments that can be booked into associated slot(s)</b><br>
897   * Type: <b>token</b><br>
898   * Path: <b>Schedule.serviceType</b><br>
899   * </p>
900   */
901  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_TYPE);
902
903 /**
904   * Search parameter: <b>specialty</b>
905   * <p>
906   * Description: <b>Type of specialty needed</b><br>
907   * Type: <b>token</b><br>
908   * Path: <b>Schedule.specialty</b><br>
909   * </p>
910   */
911  @SearchParamDefinition(name="specialty", path="Schedule.specialty", description="Type of specialty needed", type="token" )
912  public static final String SP_SPECIALTY = "specialty";
913 /**
914   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
915   * <p>
916   * Description: <b>Type of specialty needed</b><br>
917   * Type: <b>token</b><br>
918   * Path: <b>Schedule.specialty</b><br>
919   * </p>
920   */
921  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIALTY);
922
923
924}
925