001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.utilities.Utilities;
039
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044/**
045 * A slot of time on a schedule that may be available for booking appointments.
046 */
047@ResourceDef(name="Slot", profile="http://hl7.org/fhir/Profile/Slot")
048public class Slot extends DomainResource {
049
050    public enum SlotStatus {
051        /**
052         * Indicates that the time interval is busy because one  or more events have been scheduled for that interval.
053         */
054        BUSY, 
055        /**
056         * Indicates that the time interval is free for scheduling.
057         */
058        FREE, 
059        /**
060         * Indicates that the time interval is busy and that the interval can not be scheduled.
061         */
062        BUSYUNAVAILABLE, 
063        /**
064         * Indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval.
065         */
066        BUSYTENTATIVE, 
067        /**
068         * added to help the parsers
069         */
070        NULL;
071        public static SlotStatus fromCode(String codeString) throws FHIRException {
072            if (codeString == null || "".equals(codeString))
073                return null;
074        if ("busy".equals(codeString))
075          return BUSY;
076        if ("free".equals(codeString))
077          return FREE;
078        if ("busy-unavailable".equals(codeString))
079          return BUSYUNAVAILABLE;
080        if ("busy-tentative".equals(codeString))
081          return BUSYTENTATIVE;
082        throw new FHIRException("Unknown SlotStatus code '"+codeString+"'");
083        }
084        public String toCode() {
085          switch (this) {
086            case BUSY: return "busy";
087            case FREE: return "free";
088            case BUSYUNAVAILABLE: return "busy-unavailable";
089            case BUSYTENTATIVE: return "busy-tentative";
090            default: return "?";
091          }
092        }
093        public String getSystem() {
094          switch (this) {
095            case BUSY: return "http://hl7.org/fhir/slotstatus";
096            case FREE: return "http://hl7.org/fhir/slotstatus";
097            case BUSYUNAVAILABLE: return "http://hl7.org/fhir/slotstatus";
098            case BUSYTENTATIVE: return "http://hl7.org/fhir/slotstatus";
099            default: return "?";
100          }
101        }
102        public String getDefinition() {
103          switch (this) {
104            case BUSY: return "Indicates that the time interval is busy because one  or more events have been scheduled for that interval.";
105            case FREE: return "Indicates that the time interval is free for scheduling.";
106            case BUSYUNAVAILABLE: return "Indicates that the time interval is busy and that the interval can not be scheduled.";
107            case BUSYTENTATIVE: return "Indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval.";
108            default: return "?";
109          }
110        }
111        public String getDisplay() {
112          switch (this) {
113            case BUSY: return "Busy";
114            case FREE: return "Free";
115            case BUSYUNAVAILABLE: return "Busy (Unavailable)";
116            case BUSYTENTATIVE: return "Busy (Tentative)";
117            default: return "?";
118          }
119        }
120    }
121
122  public static class SlotStatusEnumFactory implements EnumFactory<SlotStatus> {
123    public SlotStatus fromCode(String codeString) throws IllegalArgumentException {
124      if (codeString == null || "".equals(codeString))
125            if (codeString == null || "".equals(codeString))
126                return null;
127        if ("busy".equals(codeString))
128          return SlotStatus.BUSY;
129        if ("free".equals(codeString))
130          return SlotStatus.FREE;
131        if ("busy-unavailable".equals(codeString))
132          return SlotStatus.BUSYUNAVAILABLE;
133        if ("busy-tentative".equals(codeString))
134          return SlotStatus.BUSYTENTATIVE;
135        throw new IllegalArgumentException("Unknown SlotStatus code '"+codeString+"'");
136        }
137        public Enumeration<SlotStatus> fromType(Base code) throws FHIRException {
138          if (code == null || code.isEmpty())
139            return null;
140          String codeString = ((PrimitiveType) code).asStringValue();
141          if (codeString == null || "".equals(codeString))
142            return null;
143        if ("busy".equals(codeString))
144          return new Enumeration<SlotStatus>(this, SlotStatus.BUSY);
145        if ("free".equals(codeString))
146          return new Enumeration<SlotStatus>(this, SlotStatus.FREE);
147        if ("busy-unavailable".equals(codeString))
148          return new Enumeration<SlotStatus>(this, SlotStatus.BUSYUNAVAILABLE);
149        if ("busy-tentative".equals(codeString))
150          return new Enumeration<SlotStatus>(this, SlotStatus.BUSYTENTATIVE);
151        throw new FHIRException("Unknown SlotStatus code '"+codeString+"'");
152        }
153    public String toCode(SlotStatus code) {
154      if (code == SlotStatus.BUSY)
155        return "busy";
156      if (code == SlotStatus.FREE)
157        return "free";
158      if (code == SlotStatus.BUSYUNAVAILABLE)
159        return "busy-unavailable";
160      if (code == SlotStatus.BUSYTENTATIVE)
161        return "busy-tentative";
162      return "?";
163      }
164    public String toSystem(SlotStatus code) {
165      return code.getSystem();
166      }
167    }
168
169    /**
170     * External Ids for this item.
171     */
172    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
173    @Description(shortDefinition="External Ids for this item", formalDefinition="External Ids for this item." )
174    protected List<Identifier> identifier;
175
176    /**
177     * A broad categorisation of the service that is to be performed during this appointment.
178     */
179    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
180    @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." )
181    protected CodeableConcept serviceCategory;
182
183    /**
184     * The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource.
185     */
186    @Child(name = "serviceType", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
187    @Description(shortDefinition="The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource", formalDefinition="The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource." )
188    protected List<CodeableConcept> serviceType;
189
190    /**
191     * The specialty of a practitioner that would be required to perform the service requested in this appointment.
192     */
193    @Child(name = "specialty", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
194    @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." )
195    protected List<CodeableConcept> specialty;
196
197    /**
198     * The style of appointment or patient that has been booked in the slot (not service type).
199     */
200    @Child(name = "appointmentType", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
201    @Description(shortDefinition="The style of appointment or patient that has been booked in the slot (not service type)", formalDefinition="The style of appointment or patient that has been booked in the slot (not service type)." )
202    protected CodeableConcept appointmentType;
203
204    /**
205     * The schedule resource that this slot defines an interval of status information.
206     */
207    @Child(name = "schedule", type = {Schedule.class}, order=5, min=1, max=1, modifier=false, summary=true)
208    @Description(shortDefinition="The schedule resource that this slot defines an interval of status information", formalDefinition="The schedule resource that this slot defines an interval of status information." )
209    protected Reference schedule;
210
211    /**
212     * The actual object that is the target of the reference (The schedule resource that this slot defines an interval of status information.)
213     */
214    protected Schedule scheduleTarget;
215
216    /**
217     * busy | free | busy-unavailable | busy-tentative.
218     */
219    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=false, summary=true)
220    @Description(shortDefinition="busy | free | busy-unavailable | busy-tentative", formalDefinition="busy | free | busy-unavailable | busy-tentative." )
221    protected Enumeration<SlotStatus> status;
222
223    /**
224     * Date/Time that the slot is to begin.
225     */
226    @Child(name = "start", type = {InstantType.class}, order=7, min=1, max=1, modifier=false, summary=true)
227    @Description(shortDefinition="Date/Time that the slot is to begin", formalDefinition="Date/Time that the slot is to begin." )
228    protected InstantType start;
229
230    /**
231     * Date/Time that the slot is to conclude.
232     */
233    @Child(name = "end", type = {InstantType.class}, order=8, min=1, max=1, modifier=false, summary=true)
234    @Description(shortDefinition="Date/Time that the slot is to conclude", formalDefinition="Date/Time that the slot is to conclude." )
235    protected InstantType end;
236
237    /**
238     * This slot has already been overbooked, appointments are unlikely to be accepted for this time.
239     */
240    @Child(name = "overbooked", type = {BooleanType.class}, order=9, min=0, max=1, modifier=false, summary=false)
241    @Description(shortDefinition="This slot has already been overbooked, appointments are unlikely to be accepted for this time", formalDefinition="This slot has already been overbooked, appointments are unlikely to be accepted for this time." )
242    protected BooleanType overbooked;
243
244    /**
245     * Comments on the slot to describe any extended information. Such as custom constraints on the slot.
246     */
247    @Child(name = "comment", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
248    @Description(shortDefinition="Comments on the slot to describe any extended information. Such as custom constraints on the slot", formalDefinition="Comments on the slot to describe any extended information. Such as custom constraints on the slot." )
249    protected StringType comment;
250
251    private static final long serialVersionUID = 2085594970L;
252
253  /**
254   * Constructor
255   */
256    public Slot() {
257      super();
258    }
259
260  /**
261   * Constructor
262   */
263    public Slot(Reference schedule, Enumeration<SlotStatus> status, InstantType start, InstantType end) {
264      super();
265      this.schedule = schedule;
266      this.status = status;
267      this.start = start;
268      this.end = end;
269    }
270
271    /**
272     * @return {@link #identifier} (External Ids for this item.)
273     */
274    public List<Identifier> getIdentifier() { 
275      if (this.identifier == null)
276        this.identifier = new ArrayList<Identifier>();
277      return this.identifier;
278    }
279
280    public boolean hasIdentifier() { 
281      if (this.identifier == null)
282        return false;
283      for (Identifier item : this.identifier)
284        if (!item.isEmpty())
285          return true;
286      return false;
287    }
288
289    /**
290     * @return {@link #identifier} (External Ids for this item.)
291     */
292    // syntactic sugar
293    public Identifier addIdentifier() { //3
294      Identifier t = new Identifier();
295      if (this.identifier == null)
296        this.identifier = new ArrayList<Identifier>();
297      this.identifier.add(t);
298      return t;
299    }
300
301    // syntactic sugar
302    public Slot addIdentifier(Identifier t) { //3
303      if (t == null)
304        return this;
305      if (this.identifier == null)
306        this.identifier = new ArrayList<Identifier>();
307      this.identifier.add(t);
308      return this;
309    }
310
311    /**
312     * @return {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
313     */
314    public CodeableConcept getServiceCategory() { 
315      if (this.serviceCategory == null)
316        if (Configuration.errorOnAutoCreate())
317          throw new Error("Attempt to auto-create Slot.serviceCategory");
318        else if (Configuration.doAutoCreate())
319          this.serviceCategory = new CodeableConcept(); // cc
320      return this.serviceCategory;
321    }
322
323    public boolean hasServiceCategory() { 
324      return this.serviceCategory != null && !this.serviceCategory.isEmpty();
325    }
326
327    /**
328     * @param value {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
329     */
330    public Slot setServiceCategory(CodeableConcept value) { 
331      this.serviceCategory = value;
332      return this;
333    }
334
335    /**
336     * @return {@link #serviceType} (The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource.)
337     */
338    public List<CodeableConcept> getServiceType() { 
339      if (this.serviceType == null)
340        this.serviceType = new ArrayList<CodeableConcept>();
341      return this.serviceType;
342    }
343
344    public boolean hasServiceType() { 
345      if (this.serviceType == null)
346        return false;
347      for (CodeableConcept item : this.serviceType)
348        if (!item.isEmpty())
349          return true;
350      return false;
351    }
352
353    /**
354     * @return {@link #serviceType} (The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource.)
355     */
356    // syntactic sugar
357    public CodeableConcept addServiceType() { //3
358      CodeableConcept t = new CodeableConcept();
359      if (this.serviceType == null)
360        this.serviceType = new ArrayList<CodeableConcept>();
361      this.serviceType.add(t);
362      return t;
363    }
364
365    // syntactic sugar
366    public Slot addServiceType(CodeableConcept t) { //3
367      if (t == null)
368        return this;
369      if (this.serviceType == null)
370        this.serviceType = new ArrayList<CodeableConcept>();
371      this.serviceType.add(t);
372      return this;
373    }
374
375    /**
376     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
377     */
378    public List<CodeableConcept> getSpecialty() { 
379      if (this.specialty == null)
380        this.specialty = new ArrayList<CodeableConcept>();
381      return this.specialty;
382    }
383
384    public boolean hasSpecialty() { 
385      if (this.specialty == null)
386        return false;
387      for (CodeableConcept item : this.specialty)
388        if (!item.isEmpty())
389          return true;
390      return false;
391    }
392
393    /**
394     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
395     */
396    // syntactic sugar
397    public CodeableConcept addSpecialty() { //3
398      CodeableConcept t = new CodeableConcept();
399      if (this.specialty == null)
400        this.specialty = new ArrayList<CodeableConcept>();
401      this.specialty.add(t);
402      return t;
403    }
404
405    // syntactic sugar
406    public Slot addSpecialty(CodeableConcept t) { //3
407      if (t == null)
408        return this;
409      if (this.specialty == null)
410        this.specialty = new ArrayList<CodeableConcept>();
411      this.specialty.add(t);
412      return this;
413    }
414
415    /**
416     * @return {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
417     */
418    public CodeableConcept getAppointmentType() { 
419      if (this.appointmentType == null)
420        if (Configuration.errorOnAutoCreate())
421          throw new Error("Attempt to auto-create Slot.appointmentType");
422        else if (Configuration.doAutoCreate())
423          this.appointmentType = new CodeableConcept(); // cc
424      return this.appointmentType;
425    }
426
427    public boolean hasAppointmentType() { 
428      return this.appointmentType != null && !this.appointmentType.isEmpty();
429    }
430
431    /**
432     * @param value {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
433     */
434    public Slot setAppointmentType(CodeableConcept value) { 
435      this.appointmentType = value;
436      return this;
437    }
438
439    /**
440     * @return {@link #schedule} (The schedule resource that this slot defines an interval of status information.)
441     */
442    public Reference getSchedule() { 
443      if (this.schedule == null)
444        if (Configuration.errorOnAutoCreate())
445          throw new Error("Attempt to auto-create Slot.schedule");
446        else if (Configuration.doAutoCreate())
447          this.schedule = new Reference(); // cc
448      return this.schedule;
449    }
450
451    public boolean hasSchedule() { 
452      return this.schedule != null && !this.schedule.isEmpty();
453    }
454
455    /**
456     * @param value {@link #schedule} (The schedule resource that this slot defines an interval of status information.)
457     */
458    public Slot setSchedule(Reference value) { 
459      this.schedule = value;
460      return this;
461    }
462
463    /**
464     * @return {@link #schedule} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The schedule resource that this slot defines an interval of status information.)
465     */
466    public Schedule getScheduleTarget() { 
467      if (this.scheduleTarget == null)
468        if (Configuration.errorOnAutoCreate())
469          throw new Error("Attempt to auto-create Slot.schedule");
470        else if (Configuration.doAutoCreate())
471          this.scheduleTarget = new Schedule(); // aa
472      return this.scheduleTarget;
473    }
474
475    /**
476     * @param value {@link #schedule} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The schedule resource that this slot defines an interval of status information.)
477     */
478    public Slot setScheduleTarget(Schedule value) { 
479      this.scheduleTarget = value;
480      return this;
481    }
482
483    /**
484     * @return {@link #status} (busy | free | busy-unavailable | busy-tentative.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
485     */
486    public Enumeration<SlotStatus> getStatusElement() { 
487      if (this.status == null)
488        if (Configuration.errorOnAutoCreate())
489          throw new Error("Attempt to auto-create Slot.status");
490        else if (Configuration.doAutoCreate())
491          this.status = new Enumeration<SlotStatus>(new SlotStatusEnumFactory()); // bb
492      return this.status;
493    }
494
495    public boolean hasStatusElement() { 
496      return this.status != null && !this.status.isEmpty();
497    }
498
499    public boolean hasStatus() { 
500      return this.status != null && !this.status.isEmpty();
501    }
502
503    /**
504     * @param value {@link #status} (busy | free | busy-unavailable | busy-tentative.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
505     */
506    public Slot setStatusElement(Enumeration<SlotStatus> value) { 
507      this.status = value;
508      return this;
509    }
510
511    /**
512     * @return busy | free | busy-unavailable | busy-tentative.
513     */
514    public SlotStatus getStatus() { 
515      return this.status == null ? null : this.status.getValue();
516    }
517
518    /**
519     * @param value busy | free | busy-unavailable | busy-tentative.
520     */
521    public Slot setStatus(SlotStatus value) { 
522        if (this.status == null)
523          this.status = new Enumeration<SlotStatus>(new SlotStatusEnumFactory());
524        this.status.setValue(value);
525      return this;
526    }
527
528    /**
529     * @return {@link #start} (Date/Time that the slot is to begin.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
530     */
531    public InstantType getStartElement() { 
532      if (this.start == null)
533        if (Configuration.errorOnAutoCreate())
534          throw new Error("Attempt to auto-create Slot.start");
535        else if (Configuration.doAutoCreate())
536          this.start = new InstantType(); // bb
537      return this.start;
538    }
539
540    public boolean hasStartElement() { 
541      return this.start != null && !this.start.isEmpty();
542    }
543
544    public boolean hasStart() { 
545      return this.start != null && !this.start.isEmpty();
546    }
547
548    /**
549     * @param value {@link #start} (Date/Time that the slot is to begin.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
550     */
551    public Slot setStartElement(InstantType value) { 
552      this.start = value;
553      return this;
554    }
555
556    /**
557     * @return Date/Time that the slot is to begin.
558     */
559    public Date getStart() { 
560      return this.start == null ? null : this.start.getValue();
561    }
562
563    /**
564     * @param value Date/Time that the slot is to begin.
565     */
566    public Slot setStart(Date value) { 
567        if (this.start == null)
568          this.start = new InstantType();
569        this.start.setValue(value);
570      return this;
571    }
572
573    /**
574     * @return {@link #end} (Date/Time that the slot is to conclude.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
575     */
576    public InstantType getEndElement() { 
577      if (this.end == null)
578        if (Configuration.errorOnAutoCreate())
579          throw new Error("Attempt to auto-create Slot.end");
580        else if (Configuration.doAutoCreate())
581          this.end = new InstantType(); // bb
582      return this.end;
583    }
584
585    public boolean hasEndElement() { 
586      return this.end != null && !this.end.isEmpty();
587    }
588
589    public boolean hasEnd() { 
590      return this.end != null && !this.end.isEmpty();
591    }
592
593    /**
594     * @param value {@link #end} (Date/Time that the slot is to conclude.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
595     */
596    public Slot setEndElement(InstantType value) { 
597      this.end = value;
598      return this;
599    }
600
601    /**
602     * @return Date/Time that the slot is to conclude.
603     */
604    public Date getEnd() { 
605      return this.end == null ? null : this.end.getValue();
606    }
607
608    /**
609     * @param value Date/Time that the slot is to conclude.
610     */
611    public Slot setEnd(Date value) { 
612        if (this.end == null)
613          this.end = new InstantType();
614        this.end.setValue(value);
615      return this;
616    }
617
618    /**
619     * @return {@link #overbooked} (This slot has already been overbooked, appointments are unlikely to be accepted for this time.). This is the underlying object with id, value and extensions. The accessor "getOverbooked" gives direct access to the value
620     */
621    public BooleanType getOverbookedElement() { 
622      if (this.overbooked == null)
623        if (Configuration.errorOnAutoCreate())
624          throw new Error("Attempt to auto-create Slot.overbooked");
625        else if (Configuration.doAutoCreate())
626          this.overbooked = new BooleanType(); // bb
627      return this.overbooked;
628    }
629
630    public boolean hasOverbookedElement() { 
631      return this.overbooked != null && !this.overbooked.isEmpty();
632    }
633
634    public boolean hasOverbooked() { 
635      return this.overbooked != null && !this.overbooked.isEmpty();
636    }
637
638    /**
639     * @param value {@link #overbooked} (This slot has already been overbooked, appointments are unlikely to be accepted for this time.). This is the underlying object with id, value and extensions. The accessor "getOverbooked" gives direct access to the value
640     */
641    public Slot setOverbookedElement(BooleanType value) { 
642      this.overbooked = value;
643      return this;
644    }
645
646    /**
647     * @return This slot has already been overbooked, appointments are unlikely to be accepted for this time.
648     */
649    public boolean getOverbooked() { 
650      return this.overbooked == null || this.overbooked.isEmpty() ? false : this.overbooked.getValue();
651    }
652
653    /**
654     * @param value This slot has already been overbooked, appointments are unlikely to be accepted for this time.
655     */
656    public Slot setOverbooked(boolean value) { 
657        if (this.overbooked == null)
658          this.overbooked = new BooleanType();
659        this.overbooked.setValue(value);
660      return this;
661    }
662
663    /**
664     * @return {@link #comment} (Comments on the slot to describe any extended information. Such as custom constraints on the slot.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
665     */
666    public StringType getCommentElement() { 
667      if (this.comment == null)
668        if (Configuration.errorOnAutoCreate())
669          throw new Error("Attempt to auto-create Slot.comment");
670        else if (Configuration.doAutoCreate())
671          this.comment = new StringType(); // bb
672      return this.comment;
673    }
674
675    public boolean hasCommentElement() { 
676      return this.comment != null && !this.comment.isEmpty();
677    }
678
679    public boolean hasComment() { 
680      return this.comment != null && !this.comment.isEmpty();
681    }
682
683    /**
684     * @param value {@link #comment} (Comments on the slot to describe any extended information. Such as custom constraints on the slot.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
685     */
686    public Slot setCommentElement(StringType value) { 
687      this.comment = value;
688      return this;
689    }
690
691    /**
692     * @return Comments on the slot to describe any extended information. Such as custom constraints on the slot.
693     */
694    public String getComment() { 
695      return this.comment == null ? null : this.comment.getValue();
696    }
697
698    /**
699     * @param value Comments on the slot to describe any extended information. Such as custom constraints on the slot.
700     */
701    public Slot setComment(String value) { 
702      if (Utilities.noString(value))
703        this.comment = null;
704      else {
705        if (this.comment == null)
706          this.comment = new StringType();
707        this.comment.setValue(value);
708      }
709      return this;
710    }
711
712      protected void listChildren(List<Property> childrenList) {
713        super.listChildren(childrenList);
714        childrenList.add(new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier));
715        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));
716        childrenList.add(new Property("serviceType", "CodeableConcept", "The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource.", 0, java.lang.Integer.MAX_VALUE, serviceType));
717        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));
718        childrenList.add(new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, java.lang.Integer.MAX_VALUE, appointmentType));
719        childrenList.add(new Property("schedule", "Reference(Schedule)", "The schedule resource that this slot defines an interval of status information.", 0, java.lang.Integer.MAX_VALUE, schedule));
720        childrenList.add(new Property("status", "code", "busy | free | busy-unavailable | busy-tentative.", 0, java.lang.Integer.MAX_VALUE, status));
721        childrenList.add(new Property("start", "instant", "Date/Time that the slot is to begin.", 0, java.lang.Integer.MAX_VALUE, start));
722        childrenList.add(new Property("end", "instant", "Date/Time that the slot is to conclude.", 0, java.lang.Integer.MAX_VALUE, end));
723        childrenList.add(new Property("overbooked", "boolean", "This slot has already been overbooked, appointments are unlikely to be accepted for this time.", 0, java.lang.Integer.MAX_VALUE, overbooked));
724        childrenList.add(new Property("comment", "string", "Comments on the slot to describe any extended information. Such as custom constraints on the slot.", 0, java.lang.Integer.MAX_VALUE, comment));
725      }
726
727      @Override
728      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
729        switch (hash) {
730        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
731        case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : new Base[] {this.serviceCategory}; // CodeableConcept
732        case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
733        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
734        case -1596426375: /*appointmentType*/ return this.appointmentType == null ? new Base[0] : new Base[] {this.appointmentType}; // CodeableConcept
735        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // Reference
736        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SlotStatus>
737        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // InstantType
738        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
739        case 2068545308: /*overbooked*/ return this.overbooked == null ? new Base[0] : new Base[] {this.overbooked}; // BooleanType
740        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
741        default: return super.getProperty(hash, name, checkValid);
742        }
743
744      }
745
746      @Override
747      public void setProperty(int hash, String name, Base value) throws FHIRException {
748        switch (hash) {
749        case -1618432855: // identifier
750          this.getIdentifier().add(castToIdentifier(value)); // Identifier
751          break;
752        case 1281188563: // serviceCategory
753          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
754          break;
755        case -1928370289: // serviceType
756          this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
757          break;
758        case -1694759682: // specialty
759          this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
760          break;
761        case -1596426375: // appointmentType
762          this.appointmentType = castToCodeableConcept(value); // CodeableConcept
763          break;
764        case -697920873: // schedule
765          this.schedule = castToReference(value); // Reference
766          break;
767        case -892481550: // status
768          this.status = new SlotStatusEnumFactory().fromType(value); // Enumeration<SlotStatus>
769          break;
770        case 109757538: // start
771          this.start = castToInstant(value); // InstantType
772          break;
773        case 100571: // end
774          this.end = castToInstant(value); // InstantType
775          break;
776        case 2068545308: // overbooked
777          this.overbooked = castToBoolean(value); // BooleanType
778          break;
779        case 950398559: // comment
780          this.comment = castToString(value); // StringType
781          break;
782        default: super.setProperty(hash, name, value);
783        }
784
785      }
786
787      @Override
788      public void setProperty(String name, Base value) throws FHIRException {
789        if (name.equals("identifier"))
790          this.getIdentifier().add(castToIdentifier(value));
791        else if (name.equals("serviceCategory"))
792          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
793        else if (name.equals("serviceType"))
794          this.getServiceType().add(castToCodeableConcept(value));
795        else if (name.equals("specialty"))
796          this.getSpecialty().add(castToCodeableConcept(value));
797        else if (name.equals("appointmentType"))
798          this.appointmentType = castToCodeableConcept(value); // CodeableConcept
799        else if (name.equals("schedule"))
800          this.schedule = castToReference(value); // Reference
801        else if (name.equals("status"))
802          this.status = new SlotStatusEnumFactory().fromType(value); // Enumeration<SlotStatus>
803        else if (name.equals("start"))
804          this.start = castToInstant(value); // InstantType
805        else if (name.equals("end"))
806          this.end = castToInstant(value); // InstantType
807        else if (name.equals("overbooked"))
808          this.overbooked = castToBoolean(value); // BooleanType
809        else if (name.equals("comment"))
810          this.comment = castToString(value); // StringType
811        else
812          super.setProperty(name, value);
813      }
814
815      @Override
816      public Base makeProperty(int hash, String name) throws FHIRException {
817        switch (hash) {
818        case -1618432855:  return addIdentifier(); // Identifier
819        case 1281188563:  return getServiceCategory(); // CodeableConcept
820        case -1928370289:  return addServiceType(); // CodeableConcept
821        case -1694759682:  return addSpecialty(); // CodeableConcept
822        case -1596426375:  return getAppointmentType(); // CodeableConcept
823        case -697920873:  return getSchedule(); // Reference
824        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<SlotStatus>
825        case 109757538: throw new FHIRException("Cannot make property start as it is not a complex type"); // InstantType
826        case 100571: throw new FHIRException("Cannot make property end as it is not a complex type"); // InstantType
827        case 2068545308: throw new FHIRException("Cannot make property overbooked as it is not a complex type"); // BooleanType
828        case 950398559: throw new FHIRException("Cannot make property comment as it is not a complex type"); // StringType
829        default: return super.makeProperty(hash, name);
830        }
831
832      }
833
834      @Override
835      public Base addChild(String name) throws FHIRException {
836        if (name.equals("identifier")) {
837          return addIdentifier();
838        }
839        else if (name.equals("serviceCategory")) {
840          this.serviceCategory = new CodeableConcept();
841          return this.serviceCategory;
842        }
843        else if (name.equals("serviceType")) {
844          return addServiceType();
845        }
846        else if (name.equals("specialty")) {
847          return addSpecialty();
848        }
849        else if (name.equals("appointmentType")) {
850          this.appointmentType = new CodeableConcept();
851          return this.appointmentType;
852        }
853        else if (name.equals("schedule")) {
854          this.schedule = new Reference();
855          return this.schedule;
856        }
857        else if (name.equals("status")) {
858          throw new FHIRException("Cannot call addChild on a primitive type Slot.status");
859        }
860        else if (name.equals("start")) {
861          throw new FHIRException("Cannot call addChild on a primitive type Slot.start");
862        }
863        else if (name.equals("end")) {
864          throw new FHIRException("Cannot call addChild on a primitive type Slot.end");
865        }
866        else if (name.equals("overbooked")) {
867          throw new FHIRException("Cannot call addChild on a primitive type Slot.overbooked");
868        }
869        else if (name.equals("comment")) {
870          throw new FHIRException("Cannot call addChild on a primitive type Slot.comment");
871        }
872        else
873          return super.addChild(name);
874      }
875
876  public String fhirType() {
877    return "Slot";
878
879  }
880
881      public Slot copy() {
882        Slot dst = new Slot();
883        copyValues(dst);
884        if (identifier != null) {
885          dst.identifier = new ArrayList<Identifier>();
886          for (Identifier i : identifier)
887            dst.identifier.add(i.copy());
888        };
889        dst.serviceCategory = serviceCategory == null ? null : serviceCategory.copy();
890        if (serviceType != null) {
891          dst.serviceType = new ArrayList<CodeableConcept>();
892          for (CodeableConcept i : serviceType)
893            dst.serviceType.add(i.copy());
894        };
895        if (specialty != null) {
896          dst.specialty = new ArrayList<CodeableConcept>();
897          for (CodeableConcept i : specialty)
898            dst.specialty.add(i.copy());
899        };
900        dst.appointmentType = appointmentType == null ? null : appointmentType.copy();
901        dst.schedule = schedule == null ? null : schedule.copy();
902        dst.status = status == null ? null : status.copy();
903        dst.start = start == null ? null : start.copy();
904        dst.end = end == null ? null : end.copy();
905        dst.overbooked = overbooked == null ? null : overbooked.copy();
906        dst.comment = comment == null ? null : comment.copy();
907        return dst;
908      }
909
910      protected Slot typedCopy() {
911        return copy();
912      }
913
914      @Override
915      public boolean equalsDeep(Base other) {
916        if (!super.equalsDeep(other))
917          return false;
918        if (!(other instanceof Slot))
919          return false;
920        Slot o = (Slot) other;
921        return compareDeep(identifier, o.identifier, true) && compareDeep(serviceCategory, o.serviceCategory, true)
922           && compareDeep(serviceType, o.serviceType, true) && compareDeep(specialty, o.specialty, true) && compareDeep(appointmentType, o.appointmentType, true)
923           && compareDeep(schedule, o.schedule, true) && compareDeep(status, o.status, true) && compareDeep(start, o.start, true)
924           && compareDeep(end, o.end, true) && compareDeep(overbooked, o.overbooked, true) && compareDeep(comment, o.comment, true)
925          ;
926      }
927
928      @Override
929      public boolean equalsShallow(Base other) {
930        if (!super.equalsShallow(other))
931          return false;
932        if (!(other instanceof Slot))
933          return false;
934        Slot o = (Slot) other;
935        return compareValues(status, o.status, true) && compareValues(start, o.start, true) && compareValues(end, o.end, true)
936           && compareValues(overbooked, o.overbooked, true) && compareValues(comment, o.comment, true);
937      }
938
939      public boolean isEmpty() {
940        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (serviceCategory == null || serviceCategory.isEmpty())
941           && (serviceType == null || serviceType.isEmpty()) && (specialty == null || specialty.isEmpty())
942           && (appointmentType == null || appointmentType.isEmpty()) && (schedule == null || schedule.isEmpty())
943           && (status == null || status.isEmpty()) && (start == null || start.isEmpty()) && (end == null || end.isEmpty())
944           && (overbooked == null || overbooked.isEmpty()) && (comment == null || comment.isEmpty())
945          ;
946      }
947
948  @Override
949  public ResourceType getResourceType() {
950    return ResourceType.Slot;
951   }
952
953 /**
954   * Search parameter: <b>schedule</b>
955   * <p>
956   * Description: <b>The Schedule Resource that we are seeking a slot within</b><br>
957   * Type: <b>reference</b><br>
958   * Path: <b>Slot.schedule</b><br>
959   * </p>
960   */
961  @SearchParamDefinition(name="schedule", path="Slot.schedule", description="The Schedule Resource that we are seeking a slot within", type="reference" )
962  public static final String SP_SCHEDULE = "schedule";
963 /**
964   * <b>Fluent Client</b> search parameter constant for <b>schedule</b>
965   * <p>
966   * Description: <b>The Schedule Resource that we are seeking a slot within</b><br>
967   * Type: <b>reference</b><br>
968   * Path: <b>Slot.schedule</b><br>
969   * </p>
970   */
971  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SCHEDULE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SCHEDULE);
972
973/**
974   * Constant for fluent queries to be used to add include statements. Specifies
975   * the path value of "<b>Slot:schedule</b>".
976   */
977  public static final ca.uhn.fhir.model.api.Include INCLUDE_SCHEDULE = new ca.uhn.fhir.model.api.Include("Slot:schedule").toLocked();
978
979 /**
980   * Search parameter: <b>status</b>
981   * <p>
982   * Description: <b>The free/busy status of the appointment</b><br>
983   * Type: <b>token</b><br>
984   * Path: <b>Slot.status</b><br>
985   * </p>
986   */
987  @SearchParamDefinition(name="status", path="Slot.status", description="The free/busy status of the appointment", type="token" )
988  public static final String SP_STATUS = "status";
989 /**
990   * <b>Fluent Client</b> search parameter constant for <b>status</b>
991   * <p>
992   * Description: <b>The free/busy status of the appointment</b><br>
993   * Type: <b>token</b><br>
994   * Path: <b>Slot.status</b><br>
995   * </p>
996   */
997  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
998
999 /**
1000   * Search parameter: <b>start</b>
1001   * <p>
1002   * Description: <b>Appointment date/time.</b><br>
1003   * Type: <b>date</b><br>
1004   * Path: <b>Slot.start</b><br>
1005   * </p>
1006   */
1007  @SearchParamDefinition(name="start", path="Slot.start", description="Appointment date/time.", type="date" )
1008  public static final String SP_START = "start";
1009 /**
1010   * <b>Fluent Client</b> search parameter constant for <b>start</b>
1011   * <p>
1012   * Description: <b>Appointment date/time.</b><br>
1013   * Type: <b>date</b><br>
1014   * Path: <b>Slot.start</b><br>
1015   * </p>
1016   */
1017  public static final ca.uhn.fhir.rest.gclient.DateClientParam START = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_START);
1018
1019 /**
1020   * Search parameter: <b>slot-type</b>
1021   * <p>
1022   * Description: <b>The type of appointments that can be booked into the slot</b><br>
1023   * Type: <b>token</b><br>
1024   * Path: <b>Slot.serviceType</b><br>
1025   * </p>
1026   */
1027  @SearchParamDefinition(name="slot-type", path="Slot.serviceType", description="The type of appointments that can be booked into the slot", type="token" )
1028  public static final String SP_SLOT_TYPE = "slot-type";
1029 /**
1030   * <b>Fluent Client</b> search parameter constant for <b>slot-type</b>
1031   * <p>
1032   * Description: <b>The type of appointments that can be booked into the slot</b><br>
1033   * Type: <b>token</b><br>
1034   * Path: <b>Slot.serviceType</b><br>
1035   * </p>
1036   */
1037  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SLOT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SLOT_TYPE);
1038
1039 /**
1040   * Search parameter: <b>identifier</b>
1041   * <p>
1042   * Description: <b>A Slot Identifier</b><br>
1043   * Type: <b>token</b><br>
1044   * Path: <b>Slot.identifier</b><br>
1045   * </p>
1046   */
1047  @SearchParamDefinition(name="identifier", path="Slot.identifier", description="A Slot Identifier", type="token" )
1048  public static final String SP_IDENTIFIER = "identifier";
1049 /**
1050   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1051   * <p>
1052   * Description: <b>A Slot Identifier</b><br>
1053   * Type: <b>token</b><br>
1054   * Path: <b>Slot.identifier</b><br>
1055   * </p>
1056   */
1057  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1058
1059
1060}
1061