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