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