001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043
044/**
045 * A container for slots of time that may be available for booking appointments.
046 */
047@ResourceDef(name = "Schedule", profile = "http://hl7.org/fhir/StructureDefinition/Schedule")
048public class Schedule extends DomainResource {
049
050  /**
051   * External Ids for this item.
052   */
053  @Child(name = "identifier", type = {
054      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
060   * was entered in error).
061   */
062  @Child(name = "active", type = { BooleanType.class }, order = 1, min = 0, max = 1, modifier = true, summary = true)
063  @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).")
064  protected BooleanType active;
065
066  /**
067   * A broad categorization of the service that is to be performed during this
068   * appointment.
069   */
070  @Child(name = "serviceCategory", type = {
071      CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
072  @Description(shortDefinition = "High-level category", formalDefinition = "A broad categorization of the service that is to be performed during this appointment.")
073  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-category")
074  protected List<CodeableConcept> serviceCategory;
075
076  /**
077   * The specific service that is to be performed during this appointment.
078   */
079  @Child(name = "serviceType", type = {
080      CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
081  @Description(shortDefinition = "Specific service", formalDefinition = "The specific service that is to be performed during this appointment.")
082  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-type")
083  protected List<CodeableConcept> serviceType;
084
085  /**
086   * The specialty of a practitioner that would be required to perform the service
087   * requested in this appointment.
088   */
089  @Child(name = "specialty", type = {
090      CodeableConcept.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
091  @Description(shortDefinition = "Type of specialty needed", formalDefinition = "The specialty of a practitioner that would be required to perform the service requested in this appointment.")
092  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/c80-practice-codes")
093  protected List<CodeableConcept> specialty;
094
095  /**
096   * Slots that reference this schedule resource provide the availability details
097   * to these referenced resource(s).
098   */
099  @Child(name = "actor", type = { Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class,
100      Device.class, HealthcareService.class,
101      Location.class }, order = 5, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
102  @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).")
103  protected List<Reference> actor;
104  /**
105   * The actual objects that are the target of the reference (Slots that reference
106   * this schedule resource provide the availability details to these referenced
107   * resource(s).)
108   */
109  protected List<Resource> actorTarget;
110
111  /**
112   * The period of time that the slots that reference this Schedule resource cover
113   * (even if none exist). These cover the amount of time that an organization's
114   * planning horizon; the interval for which they are currently accepting
115   * appointments. This does not define a "template" for planning outside these
116   * dates.
117   */
118  @Child(name = "planningHorizon", type = {
119      Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
120  @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.")
121  protected Period planningHorizon;
122
123  /**
124   * Comments on the availability to describe any extended information. Such as
125   * custom constraints on the slots that may be associated.
126   */
127  @Child(name = "comment", type = { StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
128  @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.")
129  protected StringType comment;
130
131  private static final long serialVersionUID = 203182600L;
132
133  /**
134   * Constructor
135   */
136  public Schedule() {
137    super();
138  }
139
140  /**
141   * @return {@link #identifier} (External Ids for this item.)
142   */
143  public List<Identifier> getIdentifier() {
144    if (this.identifier == null)
145      this.identifier = new ArrayList<Identifier>();
146    return this.identifier;
147  }
148
149  /**
150   * @return Returns a reference to <code>this</code> for easy method chaining
151   */
152  public Schedule setIdentifier(List<Identifier> theIdentifier) {
153    this.identifier = theIdentifier;
154    return this;
155  }
156
157  public boolean hasIdentifier() {
158    if (this.identifier == null)
159      return false;
160    for (Identifier item : this.identifier)
161      if (!item.isEmpty())
162        return true;
163    return false;
164  }
165
166  public Identifier addIdentifier() { // 3
167    Identifier t = new Identifier();
168    if (this.identifier == null)
169      this.identifier = new ArrayList<Identifier>();
170    this.identifier.add(t);
171    return t;
172  }
173
174  public Schedule addIdentifier(Identifier t) { // 3
175    if (t == null)
176      return this;
177    if (this.identifier == null)
178      this.identifier = new ArrayList<Identifier>();
179    this.identifier.add(t);
180    return this;
181  }
182
183  /**
184   * @return The first repetition of repeating field {@link #identifier}, creating
185   *         it if it does not already exist
186   */
187  public Identifier getIdentifierFirstRep() {
188    if (getIdentifier().isEmpty()) {
189      addIdentifier();
190    }
191    return getIdentifier().get(0);
192  }
193
194  /**
195   * @return {@link #active} (Whether this schedule record is in active use or
196   *         should not be used (such as was entered in error).). This is the
197   *         underlying object with id, value and extensions. The accessor
198   *         "getActive" gives direct access to the value
199   */
200  public BooleanType getActiveElement() {
201    if (this.active == null)
202      if (Configuration.errorOnAutoCreate())
203        throw new Error("Attempt to auto-create Schedule.active");
204      else if (Configuration.doAutoCreate())
205        this.active = new BooleanType(); // bb
206    return this.active;
207  }
208
209  public boolean hasActiveElement() {
210    return this.active != null && !this.active.isEmpty();
211  }
212
213  public boolean hasActive() {
214    return this.active != null && !this.active.isEmpty();
215  }
216
217  /**
218   * @param value {@link #active} (Whether this schedule record is in active use
219   *              or should not be used (such as was entered in error).). This is
220   *              the underlying object with id, value and extensions. The
221   *              accessor "getActive" gives direct access to the value
222   */
223  public Schedule setActiveElement(BooleanType value) {
224    this.active = value;
225    return this;
226  }
227
228  /**
229   * @return Whether this schedule record is in active use or should not be used
230   *         (such as was entered in error).
231   */
232  public boolean getActive() {
233    return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
234  }
235
236  /**
237   * @param value Whether this schedule record is in active use or should not be
238   *              used (such as was entered in error).
239   */
240  public Schedule setActive(boolean value) {
241    if (this.active == null)
242      this.active = new BooleanType();
243    this.active.setValue(value);
244    return this;
245  }
246
247  /**
248   * @return {@link #serviceCategory} (A broad categorization of the service that
249   *         is to be performed during this appointment.)
250   */
251  public List<CodeableConcept> getServiceCategory() {
252    if (this.serviceCategory == null)
253      this.serviceCategory = new ArrayList<CodeableConcept>();
254    return this.serviceCategory;
255  }
256
257  /**
258   * @return Returns a reference to <code>this</code> for easy method chaining
259   */
260  public Schedule setServiceCategory(List<CodeableConcept> theServiceCategory) {
261    this.serviceCategory = theServiceCategory;
262    return this;
263  }
264
265  public boolean hasServiceCategory() {
266    if (this.serviceCategory == null)
267      return false;
268    for (CodeableConcept item : this.serviceCategory)
269      if (!item.isEmpty())
270        return true;
271    return false;
272  }
273
274  public CodeableConcept addServiceCategory() { // 3
275    CodeableConcept t = new CodeableConcept();
276    if (this.serviceCategory == null)
277      this.serviceCategory = new ArrayList<CodeableConcept>();
278    this.serviceCategory.add(t);
279    return t;
280  }
281
282  public Schedule addServiceCategory(CodeableConcept t) { // 3
283    if (t == null)
284      return this;
285    if (this.serviceCategory == null)
286      this.serviceCategory = new ArrayList<CodeableConcept>();
287    this.serviceCategory.add(t);
288    return this;
289  }
290
291  /**
292   * @return The first repetition of repeating field {@link #serviceCategory},
293   *         creating it if it does not already exist
294   */
295  public CodeableConcept getServiceCategoryFirstRep() {
296    if (getServiceCategory().isEmpty()) {
297      addServiceCategory();
298    }
299    return getServiceCategory().get(0);
300  }
301
302  /**
303   * @return {@link #serviceType} (The specific service that is to be performed
304   *         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},
348   *         creating it if it does not already exist
349   */
350  public CodeableConcept getServiceTypeFirstRep() {
351    if (getServiceType().isEmpty()) {
352      addServiceType();
353    }
354    return getServiceType().get(0);
355  }
356
357  /**
358   * @return {@link #specialty} (The specialty of a practitioner that would be
359   *         required to perform the service requested in this appointment.)
360   */
361  public List<CodeableConcept> getSpecialty() {
362    if (this.specialty == null)
363      this.specialty = new ArrayList<CodeableConcept>();
364    return this.specialty;
365  }
366
367  /**
368   * @return Returns a reference to <code>this</code> for easy method chaining
369   */
370  public Schedule setSpecialty(List<CodeableConcept> theSpecialty) {
371    this.specialty = theSpecialty;
372    return this;
373  }
374
375  public boolean hasSpecialty() {
376    if (this.specialty == null)
377      return false;
378    for (CodeableConcept item : this.specialty)
379      if (!item.isEmpty())
380        return true;
381    return false;
382  }
383
384  public CodeableConcept addSpecialty() { // 3
385    CodeableConcept t = new CodeableConcept();
386    if (this.specialty == null)
387      this.specialty = new ArrayList<CodeableConcept>();
388    this.specialty.add(t);
389    return t;
390  }
391
392  public Schedule addSpecialty(CodeableConcept t) { // 3
393    if (t == null)
394      return this;
395    if (this.specialty == null)
396      this.specialty = new ArrayList<CodeableConcept>();
397    this.specialty.add(t);
398    return this;
399  }
400
401  /**
402   * @return The first repetition of repeating field {@link #specialty}, creating
403   *         it if it does not already exist
404   */
405  public CodeableConcept getSpecialtyFirstRep() {
406    if (getSpecialty().isEmpty()) {
407      addSpecialty();
408    }
409    return getSpecialty().get(0);
410  }
411
412  /**
413   * @return {@link #actor} (Slots that reference this schedule resource provide
414   *         the availability details to these referenced resource(s).)
415   */
416  public List<Reference> getActor() {
417    if (this.actor == null)
418      this.actor = new ArrayList<Reference>();
419    return this.actor;
420  }
421
422  /**
423   * @return Returns a reference to <code>this</code> for easy method chaining
424   */
425  public Schedule setActor(List<Reference> theActor) {
426    this.actor = theActor;
427    return this;
428  }
429
430  public boolean hasActor() {
431    if (this.actor == null)
432      return false;
433    for (Reference item : this.actor)
434      if (!item.isEmpty())
435        return true;
436    return false;
437  }
438
439  public Reference addActor() { // 3
440    Reference t = new Reference();
441    if (this.actor == null)
442      this.actor = new ArrayList<Reference>();
443    this.actor.add(t);
444    return t;
445  }
446
447  public Schedule addActor(Reference t) { // 3
448    if (t == null)
449      return this;
450    if (this.actor == null)
451      this.actor = new ArrayList<Reference>();
452    this.actor.add(t);
453    return this;
454  }
455
456  /**
457   * @return The first repetition of repeating field {@link #actor}, creating it
458   *         if it does not already exist
459   */
460  public Reference getActorFirstRep() {
461    if (getActor().isEmpty()) {
462      addActor();
463    }
464    return getActor().get(0);
465  }
466
467  /**
468   * @return {@link #planningHorizon} (The period of time that the slots that
469   *         reference this Schedule resource cover (even if none exist). These
470   *         cover the amount of time that an organization's planning horizon; the
471   *         interval for which they are currently accepting appointments. This
472   *         does not define a "template" for planning outside these dates.)
473   */
474  public Period getPlanningHorizon() {
475    if (this.planningHorizon == null)
476      if (Configuration.errorOnAutoCreate())
477        throw new Error("Attempt to auto-create Schedule.planningHorizon");
478      else if (Configuration.doAutoCreate())
479        this.planningHorizon = new Period(); // cc
480    return this.planningHorizon;
481  }
482
483  public boolean hasPlanningHorizon() {
484    return this.planningHorizon != null && !this.planningHorizon.isEmpty();
485  }
486
487  /**
488   * @param value {@link #planningHorizon} (The period of time that the slots that
489   *              reference this Schedule resource cover (even if none exist).
490   *              These cover the amount of time that an organization's planning
491   *              horizon; the interval for which they are currently accepting
492   *              appointments. This does not define a "template" for planning
493   *              outside these dates.)
494   */
495  public Schedule setPlanningHorizon(Period value) {
496    this.planningHorizon = value;
497    return this;
498  }
499
500  /**
501   * @return {@link #comment} (Comments on the availability to describe any
502   *         extended information. Such as custom constraints on the slots that
503   *         may be associated.). This is the underlying object with id, value and
504   *         extensions. The accessor "getComment" gives direct access to the
505   *         value
506   */
507  public StringType getCommentElement() {
508    if (this.comment == null)
509      if (Configuration.errorOnAutoCreate())
510        throw new Error("Attempt to auto-create Schedule.comment");
511      else if (Configuration.doAutoCreate())
512        this.comment = new StringType(); // bb
513    return this.comment;
514  }
515
516  public boolean hasCommentElement() {
517    return this.comment != null && !this.comment.isEmpty();
518  }
519
520  public boolean hasComment() {
521    return this.comment != null && !this.comment.isEmpty();
522  }
523
524  /**
525   * @param value {@link #comment} (Comments on the availability to describe any
526   *              extended information. Such as custom constraints on the slots
527   *              that may be associated.). This is the underlying object with id,
528   *              value and extensions. The accessor "getComment" gives direct
529   *              access to the value
530   */
531  public Schedule setCommentElement(StringType value) {
532    this.comment = value;
533    return this;
534  }
535
536  /**
537   * @return Comments on the availability to describe any extended information.
538   *         Such as custom constraints on the slots that may be associated.
539   */
540  public String getComment() {
541    return this.comment == null ? null : this.comment.getValue();
542  }
543
544  /**
545   * @param value Comments on the availability to describe any extended
546   *              information. Such as custom constraints on the slots that may be
547   *              associated.
548   */
549  public Schedule setComment(String value) {
550    if (Utilities.noString(value))
551      this.comment = null;
552    else {
553      if (this.comment == null)
554        this.comment = new StringType();
555      this.comment.setValue(value);
556    }
557    return this;
558  }
559
560  protected void listChildren(List<Property> children) {
561    super.listChildren(children);
562    children.add(new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE,
563        identifier));
564    children.add(new Property("active", "boolean",
565        "Whether this schedule record is in active use or should not be used (such as was entered in error).", 0, 1,
566        active));
567    children.add(new Property("serviceCategory", "CodeableConcept",
568        "A broad categorization of the service that is to be performed during this appointment.", 0,
569        java.lang.Integer.MAX_VALUE, serviceCategory));
570    children.add(new Property("serviceType", "CodeableConcept",
571        "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE,
572        serviceType));
573    children.add(new Property("specialty", "CodeableConcept",
574        "The specialty of a practitioner that would be required to perform the service requested in this appointment.",
575        0, java.lang.Integer.MAX_VALUE, specialty));
576    children.add(new Property("actor",
577        "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)",
578        "Slots that reference this schedule resource provide the availability details to these referenced resource(s).",
579        0, java.lang.Integer.MAX_VALUE, actor));
580    children.add(new Property("planningHorizon", "Period",
581        "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.",
582        0, 1, planningHorizon));
583    children.add(new Property("comment", "string",
584        "Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.",
585        0, 1, comment));
586  }
587
588  @Override
589  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
590    switch (_hash) {
591    case -1618432855:
592      /* identifier */ return new Property("identifier", "Identifier", "External Ids for this item.", 0,
593          java.lang.Integer.MAX_VALUE, identifier);
594    case -1422950650:
595      /* active */ return new Property("active", "boolean",
596          "Whether this schedule record is in active use or should not be used (such as was entered in error).", 0, 1,
597          active);
598    case 1281188563:
599      /* serviceCategory */ return new Property("serviceCategory", "CodeableConcept",
600          "A broad categorization of the service that is to be performed during this appointment.", 0,
601          java.lang.Integer.MAX_VALUE, serviceCategory);
602    case -1928370289:
603      /* serviceType */ return new Property("serviceType", "CodeableConcept",
604          "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE,
605          serviceType);
606    case -1694759682:
607      /* specialty */ return new Property("specialty", "CodeableConcept",
608          "The specialty of a practitioner that would be required to perform the service requested in this appointment.",
609          0, java.lang.Integer.MAX_VALUE, specialty);
610    case 92645877:
611      /* actor */ return new Property("actor",
612          "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)",
613          "Slots that reference this schedule resource provide the availability details to these referenced resource(s).",
614          0, java.lang.Integer.MAX_VALUE, actor);
615    case -1718507650:
616      /* planningHorizon */ return new Property("planningHorizon", "Period",
617          "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.",
618          0, 1, planningHorizon);
619    case 950398559:
620      /* comment */ return new Property("comment", "string",
621          "Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.",
622          0, 1, comment);
623    default:
624      return super.getNamedProperty(_hash, _name, _checkValid);
625    }
626
627  }
628
629  @Override
630  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
631    switch (hash) {
632    case -1618432855:
633      /* identifier */ return this.identifier == null ? new Base[0]
634          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
635    case -1422950650:
636      /* active */ return this.active == null ? new Base[0] : new Base[] { this.active }; // BooleanType
637    case 1281188563:
638      /* serviceCategory */ return this.serviceCategory == null ? new Base[0]
639          : this.serviceCategory.toArray(new Base[this.serviceCategory.size()]); // CodeableConcept
640    case -1928370289:
641      /* serviceType */ return this.serviceType == null ? new Base[0]
642          : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
643    case -1694759682:
644      /* specialty */ return this.specialty == null ? new Base[0]
645          : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
646    case 92645877:
647      /* actor */ return this.actor == null ? new Base[0] : this.actor.toArray(new Base[this.actor.size()]); // Reference
648    case -1718507650:
649      /* planningHorizon */ return this.planningHorizon == null ? new Base[0] : new Base[] { this.planningHorizon }; // Period
650    case 950398559:
651      /* comment */ return this.comment == null ? new Base[0] : new Base[] { this.comment }; // StringType
652    default:
653      return super.getProperty(hash, name, checkValid);
654    }
655
656  }
657
658  @Override
659  public Base setProperty(int hash, String name, Base value) throws FHIRException {
660    switch (hash) {
661    case -1618432855: // identifier
662      this.getIdentifier().add(castToIdentifier(value)); // Identifier
663      return value;
664    case -1422950650: // active
665      this.active = castToBoolean(value); // BooleanType
666      return value;
667    case 1281188563: // serviceCategory
668      this.getServiceCategory().add(castToCodeableConcept(value)); // CodeableConcept
669      return value;
670    case -1928370289: // serviceType
671      this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
672      return value;
673    case -1694759682: // specialty
674      this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
675      return value;
676    case 92645877: // actor
677      this.getActor().add(castToReference(value)); // Reference
678      return value;
679    case -1718507650: // planningHorizon
680      this.planningHorizon = castToPeriod(value); // Period
681      return value;
682    case 950398559: // comment
683      this.comment = castToString(value); // StringType
684      return value;
685    default:
686      return super.setProperty(hash, name, value);
687    }
688
689  }
690
691  @Override
692  public Base setProperty(String name, Base value) throws FHIRException {
693    if (name.equals("identifier")) {
694      this.getIdentifier().add(castToIdentifier(value));
695    } else if (name.equals("active")) {
696      this.active = castToBoolean(value); // BooleanType
697    } else if (name.equals("serviceCategory")) {
698      this.getServiceCategory().add(castToCodeableConcept(value));
699    } else if (name.equals("serviceType")) {
700      this.getServiceType().add(castToCodeableConcept(value));
701    } else if (name.equals("specialty")) {
702      this.getSpecialty().add(castToCodeableConcept(value));
703    } else if (name.equals("actor")) {
704      this.getActor().add(castToReference(value));
705    } else if (name.equals("planningHorizon")) {
706      this.planningHorizon = castToPeriod(value); // Period
707    } else if (name.equals("comment")) {
708      this.comment = castToString(value); // StringType
709    } else
710      return super.setProperty(name, value);
711    return value;
712  }
713
714  @Override
715  public void removeChild(String name, Base value) throws FHIRException {
716    if (name.equals("identifier")) {
717      this.getIdentifier().remove(castToIdentifier(value));
718    } else if (name.equals("active")) {
719      this.active = null;
720    } else if (name.equals("serviceCategory")) {
721      this.getServiceCategory().remove(castToCodeableConcept(value));
722    } else if (name.equals("serviceType")) {
723      this.getServiceType().remove(castToCodeableConcept(value));
724    } else if (name.equals("specialty")) {
725      this.getSpecialty().remove(castToCodeableConcept(value));
726    } else if (name.equals("actor")) {
727      this.getActor().remove(castToReference(value));
728    } else if (name.equals("planningHorizon")) {
729      this.planningHorizon = null;
730    } else if (name.equals("comment")) {
731      this.comment = null;
732    } else
733      super.removeChild(name, value);
734    
735  }
736
737  @Override
738  public Base makeProperty(int hash, String name) throws FHIRException {
739    switch (hash) {
740    case -1618432855:
741      return addIdentifier();
742    case -1422950650:
743      return getActiveElement();
744    case 1281188563:
745      return addServiceCategory();
746    case -1928370289:
747      return addServiceType();
748    case -1694759682:
749      return addSpecialty();
750    case 92645877:
751      return addActor();
752    case -1718507650:
753      return getPlanningHorizon();
754    case 950398559:
755      return getCommentElement();
756    default:
757      return super.makeProperty(hash, name);
758    }
759
760  }
761
762  @Override
763  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
764    switch (hash) {
765    case -1618432855:
766      /* identifier */ return new String[] { "Identifier" };
767    case -1422950650:
768      /* active */ return new String[] { "boolean" };
769    case 1281188563:
770      /* serviceCategory */ return new String[] { "CodeableConcept" };
771    case -1928370289:
772      /* serviceType */ return new String[] { "CodeableConcept" };
773    case -1694759682:
774      /* specialty */ return new String[] { "CodeableConcept" };
775    case 92645877:
776      /* actor */ return new String[] { "Reference" };
777    case -1718507650:
778      /* planningHorizon */ return new String[] { "Period" };
779    case 950398559:
780      /* comment */ return new String[] { "string" };
781    default:
782      return super.getTypesForProperty(hash, name);
783    }
784
785  }
786
787  @Override
788  public Base addChild(String name) throws FHIRException {
789    if (name.equals("identifier")) {
790      return addIdentifier();
791    } else if (name.equals("active")) {
792      throw new FHIRException("Cannot call addChild on a singleton property Schedule.active");
793    } else if (name.equals("serviceCategory")) {
794      return addServiceCategory();
795    } else if (name.equals("serviceType")) {
796      return addServiceType();
797    } else if (name.equals("specialty")) {
798      return addSpecialty();
799    } else if (name.equals("actor")) {
800      return addActor();
801    } else if (name.equals("planningHorizon")) {
802      this.planningHorizon = new Period();
803      return this.planningHorizon;
804    } else if (name.equals("comment")) {
805      throw new FHIRException("Cannot call addChild on a singleton property Schedule.comment");
806    } else
807      return super.addChild(name);
808  }
809
810  public String fhirType() {
811    return "Schedule";
812
813  }
814
815  public Schedule copy() {
816    Schedule dst = new Schedule();
817    copyValues(dst);
818    return dst;
819  }
820
821  public void copyValues(Schedule dst) {
822    super.copyValues(dst);
823    if (identifier != null) {
824      dst.identifier = new ArrayList<Identifier>();
825      for (Identifier i : identifier)
826        dst.identifier.add(i.copy());
827    }
828    ;
829    dst.active = active == null ? null : active.copy();
830    if (serviceCategory != null) {
831      dst.serviceCategory = new ArrayList<CodeableConcept>();
832      for (CodeableConcept i : serviceCategory)
833        dst.serviceCategory.add(i.copy());
834    }
835    ;
836    if (serviceType != null) {
837      dst.serviceType = new ArrayList<CodeableConcept>();
838      for (CodeableConcept i : serviceType)
839        dst.serviceType.add(i.copy());
840    }
841    ;
842    if (specialty != null) {
843      dst.specialty = new ArrayList<CodeableConcept>();
844      for (CodeableConcept i : specialty)
845        dst.specialty.add(i.copy());
846    }
847    ;
848    if (actor != null) {
849      dst.actor = new ArrayList<Reference>();
850      for (Reference i : actor)
851        dst.actor.add(i.copy());
852    }
853    ;
854    dst.planningHorizon = planningHorizon == null ? null : planningHorizon.copy();
855    dst.comment = comment == null ? null : comment.copy();
856  }
857
858  protected Schedule typedCopy() {
859    return copy();
860  }
861
862  @Override
863  public boolean equalsDeep(Base other_) {
864    if (!super.equalsDeep(other_))
865      return false;
866    if (!(other_ instanceof Schedule))
867      return false;
868    Schedule o = (Schedule) other_;
869    return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true)
870        && compareDeep(serviceCategory, o.serviceCategory, true) && compareDeep(serviceType, o.serviceType, true)
871        && compareDeep(specialty, o.specialty, true) && compareDeep(actor, o.actor, true)
872        && compareDeep(planningHorizon, o.planningHorizon, true) && compareDeep(comment, o.comment, true);
873  }
874
875  @Override
876  public boolean equalsShallow(Base other_) {
877    if (!super.equalsShallow(other_))
878      return false;
879    if (!(other_ instanceof Schedule))
880      return false;
881    Schedule o = (Schedule) other_;
882    return compareValues(active, o.active, true) && compareValues(comment, o.comment, true);
883  }
884
885  public boolean isEmpty() {
886    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, serviceCategory, serviceType,
887        specialty, actor, planningHorizon, comment);
888  }
889
890  @Override
891  public ResourceType getResourceType() {
892    return ResourceType.Schedule;
893  }
894
895  /**
896   * Search parameter: <b>actor</b>
897   * <p>
898   * Description: <b>The individual(HealthcareService, Practitioner, Location,
899   * ...) to find a Schedule for</b><br>
900   * Type: <b>reference</b><br>
901   * Path: <b>Schedule.actor</b><br>
902   * </p>
903   */
904  @SearchParamDefinition(name = "actor", path = "Schedule.actor", description = "The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for", type = "reference", providesMembershipIn = {
905      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
906      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
907      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
908      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class,
909          HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class,
910          RelatedPerson.class })
911  public static final String SP_ACTOR = "actor";
912  /**
913   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
914   * <p>
915   * Description: <b>The individual(HealthcareService, Practitioner, Location,
916   * ...) to find a Schedule for</b><br>
917   * Type: <b>reference</b><br>
918   * Path: <b>Schedule.actor</b><br>
919   * </p>
920   */
921  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
922      SP_ACTOR);
923
924  /**
925   * Constant for fluent queries to be used to add include statements. Specifies
926   * the path value of "<b>Schedule:actor</b>".
927   */
928  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Schedule:actor")
929      .toLocked();
930
931  /**
932   * Search parameter: <b>date</b>
933   * <p>
934   * Description: <b>Search for Schedule resources that have a period that
935   * contains this date specified</b><br>
936   * Type: <b>date</b><br>
937   * Path: <b>Schedule.planningHorizon</b><br>
938   * </p>
939   */
940  @SearchParamDefinition(name = "date", path = "Schedule.planningHorizon", description = "Search for Schedule resources that have a period that contains this date specified", type = "date")
941  public static final String SP_DATE = "date";
942  /**
943   * <b>Fluent Client</b> search parameter constant for <b>date</b>
944   * <p>
945   * Description: <b>Search for Schedule resources that have a period that
946   * contains this date specified</b><br>
947   * Type: <b>date</b><br>
948   * Path: <b>Schedule.planningHorizon</b><br>
949   * </p>
950   */
951  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
952      SP_DATE);
953
954  /**
955   * Search parameter: <b>identifier</b>
956   * <p>
957   * Description: <b>A Schedule Identifier</b><br>
958   * Type: <b>token</b><br>
959   * Path: <b>Schedule.identifier</b><br>
960   * </p>
961   */
962  @SearchParamDefinition(name = "identifier", path = "Schedule.identifier", description = "A Schedule Identifier", type = "token")
963  public static final String SP_IDENTIFIER = "identifier";
964  /**
965   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
966   * <p>
967   * Description: <b>A Schedule Identifier</b><br>
968   * Type: <b>token</b><br>
969   * Path: <b>Schedule.identifier</b><br>
970   * </p>
971   */
972  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
973      SP_IDENTIFIER);
974
975  /**
976   * Search parameter: <b>specialty</b>
977   * <p>
978   * Description: <b>Type of specialty needed</b><br>
979   * Type: <b>token</b><br>
980   * Path: <b>Schedule.specialty</b><br>
981   * </p>
982   */
983  @SearchParamDefinition(name = "specialty", path = "Schedule.specialty", description = "Type of specialty needed", type = "token")
984  public static final String SP_SPECIALTY = "specialty";
985  /**
986   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
987   * <p>
988   * Description: <b>Type of specialty needed</b><br>
989   * Type: <b>token</b><br>
990   * Path: <b>Schedule.specialty</b><br>
991   * </p>
992   */
993  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
994      SP_SPECIALTY);
995
996  /**
997   * Search parameter: <b>service-category</b>
998   * <p>
999   * Description: <b>High-level category</b><br>
1000   * Type: <b>token</b><br>
1001   * Path: <b>Schedule.serviceCategory</b><br>
1002   * </p>
1003   */
1004  @SearchParamDefinition(name = "service-category", path = "Schedule.serviceCategory", description = "High-level category", type = "token")
1005  public static final String SP_SERVICE_CATEGORY = "service-category";
1006  /**
1007   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
1008   * <p>
1009   * Description: <b>High-level category</b><br>
1010   * Type: <b>token</b><br>
1011   * Path: <b>Schedule.serviceCategory</b><br>
1012   * </p>
1013   */
1014  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1015      SP_SERVICE_CATEGORY);
1016
1017  /**
1018   * Search parameter: <b>service-type</b>
1019   * <p>
1020   * Description: <b>The type of appointments that can be booked into associated
1021   * slot(s)</b><br>
1022   * Type: <b>token</b><br>
1023   * Path: <b>Schedule.serviceType</b><br>
1024   * </p>
1025   */
1026  @SearchParamDefinition(name = "service-type", path = "Schedule.serviceType", description = "The type of appointments that can be booked into associated slot(s)", type = "token")
1027  public static final String SP_SERVICE_TYPE = "service-type";
1028  /**
1029   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
1030   * <p>
1031   * Description: <b>The type of appointments that can be booked into associated
1032   * slot(s)</b><br>
1033   * Type: <b>token</b><br>
1034   * Path: <b>Schedule.serviceType</b><br>
1035   * </p>
1036   */
1037  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1038      SP_SERVICE_TYPE);
1039
1040  /**
1041   * Search parameter: <b>active</b>
1042   * <p>
1043   * Description: <b>Is the schedule in active use</b><br>
1044   * Type: <b>token</b><br>
1045   * Path: <b>Schedule.active</b><br>
1046   * </p>
1047   */
1048  @SearchParamDefinition(name = "active", path = "Schedule.active", description = "Is the schedule in active use", type = "token")
1049  public static final String SP_ACTIVE = "active";
1050  /**
1051   * <b>Fluent Client</b> search parameter constant for <b>active</b>
1052   * <p>
1053   * Description: <b>Is the schedule in active use</b><br>
1054   * Type: <b>token</b><br>
1055   * Path: <b>Schedule.active</b><br>
1056   * </p>
1057   */
1058  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1059      SP_ACTIVE);
1060
1061}