001package org.hl7.fhir.dstu3.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu3
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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
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/Profile/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 categorisation of the service that is to be performed during this appointment.
085     */
086    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
087    @Description(shortDefinition="A broad categorisation of the service that is to be performed during this appointment", formalDefinition="A broad categorisation of the service that is to be performed during this appointment." )
088    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
089    protected 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="The specific service that is to be performed during this appointment", 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="The specialty of a practitioner that would be required to perform the service requested in this appointment", formalDefinition="The specialty of a practitioner that would be required to perform the service requested in this appointment." )
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     * The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.
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="The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson", formalDefinition="The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson." )
112    protected List<Reference> actor;
113    /**
114     * The actual objects that are the target of the reference (The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.)
115     */
116    protected List<Resource> actorTarget;
117
118
119    /**
120     * The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates.
121     */
122    @Child(name = "planningHorizon", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
123    @Description(shortDefinition="The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates", formalDefinition="The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates." )
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 the availability to describe any extended information. Such as custom constraints on the slots that may be associated", formalDefinition="Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated." )
131    protected StringType comment;
132
133    private static final long serialVersionUID = -266680210L;
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 categorisation of the service that is to be performed during this appointment.)
242     */
243    public CodeableConcept getServiceCategory() { 
244      if (this.serviceCategory == null)
245        if (Configuration.errorOnAutoCreate())
246          throw new Error("Attempt to auto-create Schedule.serviceCategory");
247        else if (Configuration.doAutoCreate())
248          this.serviceCategory = new CodeableConcept(); // cc
249      return this.serviceCategory;
250    }
251
252    public boolean hasServiceCategory() { 
253      return this.serviceCategory != null && !this.serviceCategory.isEmpty();
254    }
255
256    /**
257     * @param value {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
258     */
259    public Schedule setServiceCategory(CodeableConcept value)  { 
260      this.serviceCategory = value;
261      return this;
262    }
263
264    /**
265     * @return {@link #serviceType} (The specific service that is to be performed during this appointment.)
266     */
267    public List<CodeableConcept> getServiceType() { 
268      if (this.serviceType == null)
269        this.serviceType = new ArrayList<CodeableConcept>();
270      return this.serviceType;
271    }
272
273    /**
274     * @return Returns a reference to <code>this</code> for easy method chaining
275     */
276    public Schedule setServiceType(List<CodeableConcept> theServiceType) { 
277      this.serviceType = theServiceType;
278      return this;
279    }
280
281    public boolean hasServiceType() { 
282      if (this.serviceType == null)
283        return false;
284      for (CodeableConcept item : this.serviceType)
285        if (!item.isEmpty())
286          return true;
287      return false;
288    }
289
290    public CodeableConcept addServiceType() { //3
291      CodeableConcept t = new CodeableConcept();
292      if (this.serviceType == null)
293        this.serviceType = new ArrayList<CodeableConcept>();
294      this.serviceType.add(t);
295      return t;
296    }
297
298    public Schedule addServiceType(CodeableConcept t) { //3
299      if (t == null)
300        return this;
301      if (this.serviceType == null)
302        this.serviceType = new ArrayList<CodeableConcept>();
303      this.serviceType.add(t);
304      return this;
305    }
306
307    /**
308     * @return The first repetition of repeating field {@link #serviceType}, creating it if it does not already exist
309     */
310    public CodeableConcept getServiceTypeFirstRep() { 
311      if (getServiceType().isEmpty()) {
312        addServiceType();
313      }
314      return getServiceType().get(0);
315    }
316
317    /**
318     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
319     */
320    public List<CodeableConcept> getSpecialty() { 
321      if (this.specialty == null)
322        this.specialty = new ArrayList<CodeableConcept>();
323      return this.specialty;
324    }
325
326    /**
327     * @return Returns a reference to <code>this</code> for easy method chaining
328     */
329    public Schedule setSpecialty(List<CodeableConcept> theSpecialty) { 
330      this.specialty = theSpecialty;
331      return this;
332    }
333
334    public boolean hasSpecialty() { 
335      if (this.specialty == null)
336        return false;
337      for (CodeableConcept item : this.specialty)
338        if (!item.isEmpty())
339          return true;
340      return false;
341    }
342
343    public CodeableConcept addSpecialty() { //3
344      CodeableConcept t = new CodeableConcept();
345      if (this.specialty == null)
346        this.specialty = new ArrayList<CodeableConcept>();
347      this.specialty.add(t);
348      return t;
349    }
350
351    public Schedule addSpecialty(CodeableConcept t) { //3
352      if (t == null)
353        return this;
354      if (this.specialty == null)
355        this.specialty = new ArrayList<CodeableConcept>();
356      this.specialty.add(t);
357      return this;
358    }
359
360    /**
361     * @return The first repetition of repeating field {@link #specialty}, creating it if it does not already exist
362     */
363    public CodeableConcept getSpecialtyFirstRep() { 
364      if (getSpecialty().isEmpty()) {
365        addSpecialty();
366      }
367      return getSpecialty().get(0);
368    }
369
370    /**
371     * @return {@link #actor} (The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.)
372     */
373    public List<Reference> getActor() { 
374      if (this.actor == null)
375        this.actor = new ArrayList<Reference>();
376      return this.actor;
377    }
378
379    /**
380     * @return Returns a reference to <code>this</code> for easy method chaining
381     */
382    public Schedule setActor(List<Reference> theActor) { 
383      this.actor = theActor;
384      return this;
385    }
386
387    public boolean hasActor() { 
388      if (this.actor == null)
389        return false;
390      for (Reference item : this.actor)
391        if (!item.isEmpty())
392          return true;
393      return false;
394    }
395
396    public Reference addActor() { //3
397      Reference t = new Reference();
398      if (this.actor == null)
399        this.actor = new ArrayList<Reference>();
400      this.actor.add(t);
401      return t;
402    }
403
404    public Schedule addActor(Reference t) { //3
405      if (t == null)
406        return this;
407      if (this.actor == null)
408        this.actor = new ArrayList<Reference>();
409      this.actor.add(t);
410      return this;
411    }
412
413    /**
414     * @return The first repetition of repeating field {@link #actor}, creating it if it does not already exist
415     */
416    public Reference getActorFirstRep() { 
417      if (getActor().isEmpty()) {
418        addActor();
419      }
420      return getActor().get(0);
421    }
422
423    /**
424     * @deprecated Use Reference#setResource(IBaseResource) instead
425     */
426    @Deprecated
427    public List<Resource> getActorTarget() { 
428      if (this.actorTarget == null)
429        this.actorTarget = new ArrayList<Resource>();
430      return this.actorTarget;
431    }
432
433    /**
434     * @return {@link #planningHorizon} (The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates.)
435     */
436    public Period getPlanningHorizon() { 
437      if (this.planningHorizon == null)
438        if (Configuration.errorOnAutoCreate())
439          throw new Error("Attempt to auto-create Schedule.planningHorizon");
440        else if (Configuration.doAutoCreate())
441          this.planningHorizon = new Period(); // cc
442      return this.planningHorizon;
443    }
444
445    public boolean hasPlanningHorizon() { 
446      return this.planningHorizon != null && !this.planningHorizon.isEmpty();
447    }
448
449    /**
450     * @param value {@link #planningHorizon} (The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates.)
451     */
452    public Schedule setPlanningHorizon(Period value)  { 
453      this.planningHorizon = value;
454      return this;
455    }
456
457    /**
458     * @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
459     */
460    public StringType getCommentElement() { 
461      if (this.comment == null)
462        if (Configuration.errorOnAutoCreate())
463          throw new Error("Attempt to auto-create Schedule.comment");
464        else if (Configuration.doAutoCreate())
465          this.comment = new StringType(); // bb
466      return this.comment;
467    }
468
469    public boolean hasCommentElement() { 
470      return this.comment != null && !this.comment.isEmpty();
471    }
472
473    public boolean hasComment() { 
474      return this.comment != null && !this.comment.isEmpty();
475    }
476
477    /**
478     * @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
479     */
480    public Schedule setCommentElement(StringType value) { 
481      this.comment = value;
482      return this;
483    }
484
485    /**
486     * @return Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
487     */
488    public String getComment() { 
489      return this.comment == null ? null : this.comment.getValue();
490    }
491
492    /**
493     * @param value Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.
494     */
495    public Schedule setComment(String value) { 
496      if (Utilities.noString(value))
497        this.comment = null;
498      else {
499        if (this.comment == null)
500          this.comment = new StringType();
501        this.comment.setValue(value);
502      }
503      return this;
504    }
505
506      protected void listChildren(List<Property> children) {
507        super.listChildren(children);
508        children.add(new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier));
509        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));
510        children.add(new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, 1, serviceCategory));
511        children.add(new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType));
512        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));
513        children.add(new Property("actor", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)", "The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.", 0, java.lang.Integer.MAX_VALUE, actor));
514        children.add(new Property("planningHorizon", "Period", "The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates.", 0, 1, planningHorizon));
515        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));
516      }
517
518      @Override
519      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
520        switch (_hash) {
521        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier);
522        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);
523        case 1281188563: /*serviceCategory*/  return new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, 1, serviceCategory);
524        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);
525        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);
526        case 92645877: /*actor*/  return new Property("actor", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)", "The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.", 0, java.lang.Integer.MAX_VALUE, actor);
527        case -1718507650: /*planningHorizon*/  return new Property("planningHorizon", "Period", "The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates.", 0, 1, planningHorizon);
528        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);
529        default: return super.getNamedProperty(_hash, _name, _checkValid);
530        }
531
532      }
533
534      @Override
535      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
536        switch (hash) {
537        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
538        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
539        case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : new Base[] {this.serviceCategory}; // CodeableConcept
540        case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
541        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
542        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : this.actor.toArray(new Base[this.actor.size()]); // Reference
543        case -1718507650: /*planningHorizon*/ return this.planningHorizon == null ? new Base[0] : new Base[] {this.planningHorizon}; // Period
544        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
545        default: return super.getProperty(hash, name, checkValid);
546        }
547
548      }
549
550      @Override
551      public Base setProperty(int hash, String name, Base value) throws FHIRException {
552        switch (hash) {
553        case -1618432855: // identifier
554          this.getIdentifier().add(castToIdentifier(value)); // Identifier
555          return value;
556        case -1422950650: // active
557          this.active = castToBoolean(value); // BooleanType
558          return value;
559        case 1281188563: // serviceCategory
560          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
561          return value;
562        case -1928370289: // serviceType
563          this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
564          return value;
565        case -1694759682: // specialty
566          this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
567          return value;
568        case 92645877: // actor
569          this.getActor().add(castToReference(value)); // Reference
570          return value;
571        case -1718507650: // planningHorizon
572          this.planningHorizon = castToPeriod(value); // Period
573          return value;
574        case 950398559: // comment
575          this.comment = castToString(value); // StringType
576          return value;
577        default: return super.setProperty(hash, name, value);
578        }
579
580      }
581
582      @Override
583      public Base setProperty(String name, Base value) throws FHIRException {
584        if (name.equals("identifier")) {
585          this.getIdentifier().add(castToIdentifier(value));
586        } else if (name.equals("active")) {
587          this.active = castToBoolean(value); // BooleanType
588        } else if (name.equals("serviceCategory")) {
589          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
590        } else if (name.equals("serviceType")) {
591          this.getServiceType().add(castToCodeableConcept(value));
592        } else if (name.equals("specialty")) {
593          this.getSpecialty().add(castToCodeableConcept(value));
594        } else if (name.equals("actor")) {
595          this.getActor().add(castToReference(value));
596        } else if (name.equals("planningHorizon")) {
597          this.planningHorizon = castToPeriod(value); // Period
598        } else if (name.equals("comment")) {
599          this.comment = castToString(value); // StringType
600        } else
601          return super.setProperty(name, value);
602        return value;
603      }
604
605      @Override
606      public Base makeProperty(int hash, String name) throws FHIRException {
607        switch (hash) {
608        case -1618432855:  return addIdentifier(); 
609        case -1422950650:  return getActiveElement();
610        case 1281188563:  return getServiceCategory(); 
611        case -1928370289:  return addServiceType(); 
612        case -1694759682:  return addSpecialty(); 
613        case 92645877:  return addActor(); 
614        case -1718507650:  return getPlanningHorizon(); 
615        case 950398559:  return getCommentElement();
616        default: return super.makeProperty(hash, name);
617        }
618
619      }
620
621      @Override
622      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
623        switch (hash) {
624        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
625        case -1422950650: /*active*/ return new String[] {"boolean"};
626        case 1281188563: /*serviceCategory*/ return new String[] {"CodeableConcept"};
627        case -1928370289: /*serviceType*/ return new String[] {"CodeableConcept"};
628        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
629        case 92645877: /*actor*/ return new String[] {"Reference"};
630        case -1718507650: /*planningHorizon*/ return new String[] {"Period"};
631        case 950398559: /*comment*/ return new String[] {"string"};
632        default: return super.getTypesForProperty(hash, name);
633        }
634
635      }
636
637      @Override
638      public Base addChild(String name) throws FHIRException {
639        if (name.equals("identifier")) {
640          return addIdentifier();
641        }
642        else if (name.equals("active")) {
643          throw new FHIRException("Cannot call addChild on a primitive type Schedule.active");
644        }
645        else if (name.equals("serviceCategory")) {
646          this.serviceCategory = new CodeableConcept();
647          return this.serviceCategory;
648        }
649        else if (name.equals("serviceType")) {
650          return addServiceType();
651        }
652        else if (name.equals("specialty")) {
653          return addSpecialty();
654        }
655        else if (name.equals("actor")) {
656          return addActor();
657        }
658        else if (name.equals("planningHorizon")) {
659          this.planningHorizon = new Period();
660          return this.planningHorizon;
661        }
662        else if (name.equals("comment")) {
663          throw new FHIRException("Cannot call addChild on a primitive type Schedule.comment");
664        }
665        else
666          return super.addChild(name);
667      }
668
669  public String fhirType() {
670    return "Schedule";
671
672  }
673
674      public Schedule copy() {
675        Schedule dst = new Schedule();
676        copyValues(dst);
677        if (identifier != null) {
678          dst.identifier = new ArrayList<Identifier>();
679          for (Identifier i : identifier)
680            dst.identifier.add(i.copy());
681        };
682        dst.active = active == null ? null : active.copy();
683        dst.serviceCategory = serviceCategory == null ? null : serviceCategory.copy();
684        if (serviceType != null) {
685          dst.serviceType = new ArrayList<CodeableConcept>();
686          for (CodeableConcept i : serviceType)
687            dst.serviceType.add(i.copy());
688        };
689        if (specialty != null) {
690          dst.specialty = new ArrayList<CodeableConcept>();
691          for (CodeableConcept i : specialty)
692            dst.specialty.add(i.copy());
693        };
694        if (actor != null) {
695          dst.actor = new ArrayList<Reference>();
696          for (Reference i : actor)
697            dst.actor.add(i.copy());
698        };
699        dst.planningHorizon = planningHorizon == null ? null : planningHorizon.copy();
700        dst.comment = comment == null ? null : comment.copy();
701        return dst;
702      }
703
704      protected Schedule typedCopy() {
705        return copy();
706      }
707
708      @Override
709      public boolean equalsDeep(Base other_) {
710        if (!super.equalsDeep(other_))
711          return false;
712        if (!(other_ instanceof Schedule))
713          return false;
714        Schedule o = (Schedule) other_;
715        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(serviceCategory, o.serviceCategory, true)
716           && compareDeep(serviceType, o.serviceType, true) && compareDeep(specialty, o.specialty, true) && compareDeep(actor, o.actor, true)
717           && compareDeep(planningHorizon, o.planningHorizon, true) && compareDeep(comment, o.comment, true)
718          ;
719      }
720
721      @Override
722      public boolean equalsShallow(Base other_) {
723        if (!super.equalsShallow(other_))
724          return false;
725        if (!(other_ instanceof Schedule))
726          return false;
727        Schedule o = (Schedule) other_;
728        return compareValues(active, o.active, true) && compareValues(comment, o.comment, true);
729      }
730
731      public boolean isEmpty() {
732        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, serviceCategory
733          , serviceType, specialty, actor, planningHorizon, comment);
734      }
735
736  @Override
737  public ResourceType getResourceType() {
738    return ResourceType.Schedule;
739   }
740
741 /**
742   * Search parameter: <b>actor</b>
743   * <p>
744   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
745   * Type: <b>reference</b><br>
746   * Path: <b>Schedule.actor</b><br>
747   * </p>
748   */
749  @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 } )
750  public static final String SP_ACTOR = "actor";
751 /**
752   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
753   * <p>
754   * Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for</b><br>
755   * Type: <b>reference</b><br>
756   * Path: <b>Schedule.actor</b><br>
757   * </p>
758   */
759  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
760
761/**
762   * Constant for fluent queries to be used to add include statements. Specifies
763   * the path value of "<b>Schedule:actor</b>".
764   */
765  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Schedule:actor").toLocked();
766
767 /**
768   * Search parameter: <b>date</b>
769   * <p>
770   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
771   * Type: <b>date</b><br>
772   * Path: <b>Schedule.planningHorizon</b><br>
773   * </p>
774   */
775  @SearchParamDefinition(name="date", path="Schedule.planningHorizon", description="Search for Schedule resources that have a period that contains this date specified", type="date" )
776  public static final String SP_DATE = "date";
777 /**
778   * <b>Fluent Client</b> search parameter constant for <b>date</b>
779   * <p>
780   * Description: <b>Search for Schedule resources that have a period that contains this date specified</b><br>
781   * Type: <b>date</b><br>
782   * Path: <b>Schedule.planningHorizon</b><br>
783   * </p>
784   */
785  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
786
787 /**
788   * Search parameter: <b>identifier</b>
789   * <p>
790   * Description: <b>A Schedule Identifier</b><br>
791   * Type: <b>token</b><br>
792   * Path: <b>Schedule.identifier</b><br>
793   * </p>
794   */
795  @SearchParamDefinition(name="identifier", path="Schedule.identifier", description="A Schedule Identifier", type="token" )
796  public static final String SP_IDENTIFIER = "identifier";
797 /**
798   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
799   * <p>
800   * Description: <b>A Schedule Identifier</b><br>
801   * Type: <b>token</b><br>
802   * Path: <b>Schedule.identifier</b><br>
803   * </p>
804   */
805  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
806
807 /**
808   * Search parameter: <b>active</b>
809   * <p>
810   * Description: <b>Is the schedule in active use</b><br>
811   * Type: <b>token</b><br>
812   * Path: <b>Schedule.active</b><br>
813   * </p>
814   */
815  @SearchParamDefinition(name="active", path="Schedule.active", description="Is the schedule in active use", type="token" )
816  public static final String SP_ACTIVE = "active";
817 /**
818   * <b>Fluent Client</b> search parameter constant for <b>active</b>
819   * <p>
820   * Description: <b>Is the schedule in active use</b><br>
821   * Type: <b>token</b><br>
822   * Path: <b>Schedule.active</b><br>
823   * </p>
824   */
825  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
826
827 /**
828   * Search parameter: <b>type</b>
829   * <p>
830   * Description: <b>The type of appointments that can be booked into associated slot(s)</b><br>
831   * Type: <b>token</b><br>
832   * Path: <b>Schedule.serviceType</b><br>
833   * </p>
834   */
835  @SearchParamDefinition(name="type", path="Schedule.serviceType", description="The type of appointments that can be booked into associated slot(s)", type="token" )
836  public static final String SP_TYPE = "type";
837 /**
838   * <b>Fluent Client</b> search parameter constant for <b>type</b>
839   * <p>
840   * Description: <b>The type of appointments that can be booked into associated slot(s)</b><br>
841   * Type: <b>token</b><br>
842   * Path: <b>Schedule.serviceType</b><br>
843   * </p>
844   */
845  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
846
847
848}
849