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