001package org.hl7.fhir.dstu2.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, 
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this 
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, 
034     this list of conditions and the following disclaimer in the documentation 
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
049  POSSIBILITY OF SUCH DAMAGE.
050  
051*/
052
053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057
058import ca.uhn.fhir.model.api.annotation.Child;
059import ca.uhn.fhir.model.api.annotation.Description;
060import ca.uhn.fhir.model.api.annotation.ResourceDef;
061import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
062import org.hl7.fhir.exceptions.FHIRException;
063import org.hl7.fhir.utilities.Utilities;
064/**
065 * A slot of time on a schedule that may be available for booking appointments.
066 */
067@ResourceDef(name="Slot", profile="http://hl7.org/fhir/Profile/Slot")
068public class Slot extends DomainResource {
069
070    public enum SlotStatus {
071        /**
072         * Indicates that the time interval is busy because one  or more events have been scheduled for that interval.
073         */
074        BUSY, 
075        /**
076         * Indicates that the time interval is free for scheduling.
077         */
078        FREE, 
079        /**
080         * Indicates that the time interval is busy and that the interval can not be scheduled.
081         */
082        BUSYUNAVAILABLE, 
083        /**
084         * Indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval.
085         */
086        BUSYTENTATIVE, 
087        /**
088         * added to help the parsers
089         */
090        NULL;
091        public static SlotStatus fromCode(String codeString) throws FHIRException {
092            if (codeString == null || "".equals(codeString))
093                return null;
094        if ("busy".equals(codeString))
095          return BUSY;
096        if ("free".equals(codeString))
097          return FREE;
098        if ("busy-unavailable".equals(codeString))
099          return BUSYUNAVAILABLE;
100        if ("busy-tentative".equals(codeString))
101          return BUSYTENTATIVE;
102        throw new FHIRException("Unknown SlotStatus code '"+codeString+"'");
103        }
104        public String toCode() {
105          switch (this) {
106            case BUSY: return "busy";
107            case FREE: return "free";
108            case BUSYUNAVAILABLE: return "busy-unavailable";
109            case BUSYTENTATIVE: return "busy-tentative";
110            default: return "?";
111          }
112        }
113        public String getSystem() {
114          switch (this) {
115            case BUSY: return "http://hl7.org/fhir/slotstatus";
116            case FREE: return "http://hl7.org/fhir/slotstatus";
117            case BUSYUNAVAILABLE: return "http://hl7.org/fhir/slotstatus";
118            case BUSYTENTATIVE: return "http://hl7.org/fhir/slotstatus";
119            default: return "?";
120          }
121        }
122        public String getDefinition() {
123          switch (this) {
124            case BUSY: return "Indicates that the time interval is busy because one  or more events have been scheduled for that interval.";
125            case FREE: return "Indicates that the time interval is free for scheduling.";
126            case BUSYUNAVAILABLE: return "Indicates that the time interval is busy and that the interval can not be scheduled.";
127            case BUSYTENTATIVE: return "Indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval.";
128            default: return "?";
129          }
130        }
131        public String getDisplay() {
132          switch (this) {
133            case BUSY: return "Busy";
134            case FREE: return "Free";
135            case BUSYUNAVAILABLE: return "Busy (Unavailable)";
136            case BUSYTENTATIVE: return "Busy (Tentative)";
137            default: return "?";
138          }
139        }
140    }
141
142  public static class SlotStatusEnumFactory implements EnumFactory<SlotStatus> {
143    public SlotStatus fromCode(String codeString) throws IllegalArgumentException {
144      if (codeString == null || "".equals(codeString))
145            if (codeString == null || "".equals(codeString))
146                return null;
147        if ("busy".equals(codeString))
148          return SlotStatus.BUSY;
149        if ("free".equals(codeString))
150          return SlotStatus.FREE;
151        if ("busy-unavailable".equals(codeString))
152          return SlotStatus.BUSYUNAVAILABLE;
153        if ("busy-tentative".equals(codeString))
154          return SlotStatus.BUSYTENTATIVE;
155        throw new IllegalArgumentException("Unknown SlotStatus code '"+codeString+"'");
156        }
157        public Enumeration<SlotStatus> fromType(Base code) throws FHIRException {
158          if (code == null || code.isEmpty())
159            return null;
160          String codeString = ((PrimitiveType) code).asStringValue();
161          if (codeString == null || "".equals(codeString))
162            return null;
163        if ("busy".equals(codeString))
164          return new Enumeration<SlotStatus>(this, SlotStatus.BUSY);
165        if ("free".equals(codeString))
166          return new Enumeration<SlotStatus>(this, SlotStatus.FREE);
167        if ("busy-unavailable".equals(codeString))
168          return new Enumeration<SlotStatus>(this, SlotStatus.BUSYUNAVAILABLE);
169        if ("busy-tentative".equals(codeString))
170          return new Enumeration<SlotStatus>(this, SlotStatus.BUSYTENTATIVE);
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      return "?";
183      }
184    }
185
186    /**
187     * External Ids for this item.
188     */
189    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
190    @Description(shortDefinition="External Ids for this item", formalDefinition="External Ids for this item." )
191    protected List<Identifier> identifier;
192
193    /**
194     * 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     */
196    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
197    @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." )
198    protected CodeableConcept type;
199
200    /**
201     * The schedule resource that this slot defines an interval of status information.
202     */
203    @Child(name = "schedule", type = {Schedule.class}, order=2, min=1, max=1, modifier=false, summary=true)
204    @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." )
205    protected Reference schedule;
206
207    /**
208     * The actual object that is the target of the reference (The schedule resource that this slot defines an interval of status information.)
209     */
210    protected Schedule scheduleTarget;
211
212    /**
213     * busy | free | busy-unavailable | busy-tentative.
214     */
215    @Child(name = "freeBusyType", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
216    @Description(shortDefinition="busy | free | busy-unavailable | busy-tentative", formalDefinition="busy | free | busy-unavailable | busy-tentative." )
217    protected Enumeration<SlotStatus> freeBusyType;
218
219    /**
220     * Date/Time that the slot is to begin.
221     */
222    @Child(name = "start", type = {InstantType.class}, order=4, min=1, max=1, modifier=false, summary=true)
223    @Description(shortDefinition="Date/Time that the slot is to begin", formalDefinition="Date/Time that the slot is to begin." )
224    protected InstantType start;
225
226    /**
227     * Date/Time that the slot is to conclude.
228     */
229    @Child(name = "end", type = {InstantType.class}, order=5, min=1, max=1, modifier=false, summary=true)
230    @Description(shortDefinition="Date/Time that the slot is to conclude", formalDefinition="Date/Time that the slot is to conclude." )
231    protected InstantType end;
232
233    /**
234     * This slot has already been overbooked, appointments are unlikely to be accepted for this time.
235     */
236    @Child(name = "overbooked", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=false)
237    @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." )
238    protected BooleanType overbooked;
239
240    /**
241     * Comments on the slot to describe any extended information. Such as custom constraints on the slot.
242     */
243    @Child(name = "comment", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
244    @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." )
245    protected StringType comment;
246
247    private static final long serialVersionUID = 1984269299L;
248
249  /*
250   * Constructor
251   */
252    public Slot() {
253      super();
254    }
255
256  /*
257   * Constructor
258   */
259    public Slot(Reference schedule, Enumeration<SlotStatus> freeBusyType, InstantType start, InstantType end) {
260      super();
261      this.schedule = schedule;
262      this.freeBusyType = freeBusyType;
263      this.start = start;
264      this.end = end;
265    }
266
267    /**
268     * @return {@link #identifier} (External Ids for this item.)
269     */
270    public List<Identifier> getIdentifier() { 
271      if (this.identifier == null)
272        this.identifier = new ArrayList<Identifier>();
273      return this.identifier;
274    }
275
276    public boolean hasIdentifier() { 
277      if (this.identifier == null)
278        return false;
279      for (Identifier item : this.identifier)
280        if (!item.isEmpty())
281          return true;
282      return false;
283    }
284
285    /**
286     * @return {@link #identifier} (External Ids for this item.)
287     */
288    // syntactic sugar
289    public Identifier addIdentifier() { //3
290      Identifier t = new Identifier();
291      if (this.identifier == null)
292        this.identifier = new ArrayList<Identifier>();
293      this.identifier.add(t);
294      return t;
295    }
296
297    // syntactic sugar
298    public Slot addIdentifier(Identifier t) { //3
299      if (t == null)
300        return this;
301      if (this.identifier == null)
302        this.identifier = new ArrayList<Identifier>();
303      this.identifier.add(t);
304      return this;
305    }
306
307    /**
308     * @return {@link #type} (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.)
309     */
310    public CodeableConcept getType() { 
311      if (this.type == null)
312        if (Configuration.errorOnAutoCreate())
313          throw new Error("Attempt to auto-create Slot.type");
314        else if (Configuration.doAutoCreate())
315          this.type = new CodeableConcept(); // cc
316      return this.type;
317    }
318
319    public boolean hasType() { 
320      return this.type != null && !this.type.isEmpty();
321    }
322
323    /**
324     * @param value {@link #type} (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.)
325     */
326    public Slot setType(CodeableConcept value) { 
327      this.type = value;
328      return this;
329    }
330
331    /**
332     * @return {@link #schedule} (The schedule resource that this slot defines an interval of status information.)
333     */
334    public Reference getSchedule() { 
335      if (this.schedule == null)
336        if (Configuration.errorOnAutoCreate())
337          throw new Error("Attempt to auto-create Slot.schedule");
338        else if (Configuration.doAutoCreate())
339          this.schedule = new Reference(); // cc
340      return this.schedule;
341    }
342
343    public boolean hasSchedule() { 
344      return this.schedule != null && !this.schedule.isEmpty();
345    }
346
347    /**
348     * @param value {@link #schedule} (The schedule resource that this slot defines an interval of status information.)
349     */
350    public Slot setSchedule(Reference value) { 
351      this.schedule = value;
352      return this;
353    }
354
355    /**
356     * @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.)
357     */
358    public Schedule getScheduleTarget() { 
359      if (this.scheduleTarget == null)
360        if (Configuration.errorOnAutoCreate())
361          throw new Error("Attempt to auto-create Slot.schedule");
362        else if (Configuration.doAutoCreate())
363          this.scheduleTarget = new Schedule(); // aa
364      return this.scheduleTarget;
365    }
366
367    /**
368     * @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.)
369     */
370    public Slot setScheduleTarget(Schedule value) { 
371      this.scheduleTarget = value;
372      return this;
373    }
374
375    /**
376     * @return {@link #freeBusyType} (busy | free | busy-unavailable | busy-tentative.). This is the underlying object with id, value and extensions. The accessor "getFreeBusyType" gives direct access to the value
377     */
378    public Enumeration<SlotStatus> getFreeBusyTypeElement() { 
379      if (this.freeBusyType == null)
380        if (Configuration.errorOnAutoCreate())
381          throw new Error("Attempt to auto-create Slot.freeBusyType");
382        else if (Configuration.doAutoCreate())
383          this.freeBusyType = new Enumeration<SlotStatus>(new SlotStatusEnumFactory()); // bb
384      return this.freeBusyType;
385    }
386
387    public boolean hasFreeBusyTypeElement() { 
388      return this.freeBusyType != null && !this.freeBusyType.isEmpty();
389    }
390
391    public boolean hasFreeBusyType() { 
392      return this.freeBusyType != null && !this.freeBusyType.isEmpty();
393    }
394
395    /**
396     * @param value {@link #freeBusyType} (busy | free | busy-unavailable | busy-tentative.). This is the underlying object with id, value and extensions. The accessor "getFreeBusyType" gives direct access to the value
397     */
398    public Slot setFreeBusyTypeElement(Enumeration<SlotStatus> value) { 
399      this.freeBusyType = value;
400      return this;
401    }
402
403    /**
404     * @return busy | free | busy-unavailable | busy-tentative.
405     */
406    public SlotStatus getFreeBusyType() { 
407      return this.freeBusyType == null ? null : this.freeBusyType.getValue();
408    }
409
410    /**
411     * @param value busy | free | busy-unavailable | busy-tentative.
412     */
413    public Slot setFreeBusyType(SlotStatus value) { 
414        if (this.freeBusyType == null)
415          this.freeBusyType = new Enumeration<SlotStatus>(new SlotStatusEnumFactory());
416        this.freeBusyType.setValue(value);
417      return this;
418    }
419
420    /**
421     * @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
422     */
423    public InstantType getStartElement() { 
424      if (this.start == null)
425        if (Configuration.errorOnAutoCreate())
426          throw new Error("Attempt to auto-create Slot.start");
427        else if (Configuration.doAutoCreate())
428          this.start = new InstantType(); // bb
429      return this.start;
430    }
431
432    public boolean hasStartElement() { 
433      return this.start != null && !this.start.isEmpty();
434    }
435
436    public boolean hasStart() { 
437      return this.start != null && !this.start.isEmpty();
438    }
439
440    /**
441     * @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
442     */
443    public Slot setStartElement(InstantType value) { 
444      this.start = value;
445      return this;
446    }
447
448    /**
449     * @return Date/Time that the slot is to begin.
450     */
451    public Date getStart() { 
452      return this.start == null ? null : this.start.getValue();
453    }
454
455    /**
456     * @param value Date/Time that the slot is to begin.
457     */
458    public Slot setStart(Date value) { 
459        if (this.start == null)
460          this.start = new InstantType();
461        this.start.setValue(value);
462      return this;
463    }
464
465    /**
466     * @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
467     */
468    public InstantType getEndElement() { 
469      if (this.end == null)
470        if (Configuration.errorOnAutoCreate())
471          throw new Error("Attempt to auto-create Slot.end");
472        else if (Configuration.doAutoCreate())
473          this.end = new InstantType(); // bb
474      return this.end;
475    }
476
477    public boolean hasEndElement() { 
478      return this.end != null && !this.end.isEmpty();
479    }
480
481    public boolean hasEnd() { 
482      return this.end != null && !this.end.isEmpty();
483    }
484
485    /**
486     * @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
487     */
488    public Slot setEndElement(InstantType value) { 
489      this.end = value;
490      return this;
491    }
492
493    /**
494     * @return Date/Time that the slot is to conclude.
495     */
496    public Date getEnd() { 
497      return this.end == null ? null : this.end.getValue();
498    }
499
500    /**
501     * @param value Date/Time that the slot is to conclude.
502     */
503    public Slot setEnd(Date value) { 
504        if (this.end == null)
505          this.end = new InstantType();
506        this.end.setValue(value);
507      return this;
508    }
509
510    /**
511     * @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
512     */
513    public BooleanType getOverbookedElement() { 
514      if (this.overbooked == null)
515        if (Configuration.errorOnAutoCreate())
516          throw new Error("Attempt to auto-create Slot.overbooked");
517        else if (Configuration.doAutoCreate())
518          this.overbooked = new BooleanType(); // bb
519      return this.overbooked;
520    }
521
522    public boolean hasOverbookedElement() { 
523      return this.overbooked != null && !this.overbooked.isEmpty();
524    }
525
526    public boolean hasOverbooked() { 
527      return this.overbooked != null && !this.overbooked.isEmpty();
528    }
529
530    /**
531     * @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
532     */
533    public Slot setOverbookedElement(BooleanType value) { 
534      this.overbooked = value;
535      return this;
536    }
537
538    /**
539     * @return This slot has already been overbooked, appointments are unlikely to be accepted for this time.
540     */
541    public boolean getOverbooked() { 
542      return this.overbooked == null || this.overbooked.isEmpty() ? false : this.overbooked.getValue();
543    }
544
545    /**
546     * @param value This slot has already been overbooked, appointments are unlikely to be accepted for this time.
547     */
548    public Slot setOverbooked(boolean value) { 
549        if (this.overbooked == null)
550          this.overbooked = new BooleanType();
551        this.overbooked.setValue(value);
552      return this;
553    }
554
555    /**
556     * @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
557     */
558    public StringType getCommentElement() { 
559      if (this.comment == null)
560        if (Configuration.errorOnAutoCreate())
561          throw new Error("Attempt to auto-create Slot.comment");
562        else if (Configuration.doAutoCreate())
563          this.comment = new StringType(); // bb
564      return this.comment;
565    }
566
567    public boolean hasCommentElement() { 
568      return this.comment != null && !this.comment.isEmpty();
569    }
570
571    public boolean hasComment() { 
572      return this.comment != null && !this.comment.isEmpty();
573    }
574
575    /**
576     * @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
577     */
578    public Slot setCommentElement(StringType value) { 
579      this.comment = value;
580      return this;
581    }
582
583    /**
584     * @return Comments on the slot to describe any extended information. Such as custom constraints on the slot.
585     */
586    public String getComment() { 
587      return this.comment == null ? null : this.comment.getValue();
588    }
589
590    /**
591     * @param value Comments on the slot to describe any extended information. Such as custom constraints on the slot.
592     */
593    public Slot setComment(String value) { 
594      if (Utilities.noString(value))
595        this.comment = null;
596      else {
597        if (this.comment == null)
598          this.comment = new StringType();
599        this.comment.setValue(value);
600      }
601      return this;
602    }
603
604      protected void listChildren(List<Property> childrenList) {
605        super.listChildren(childrenList);
606        childrenList.add(new Property("identifier", "Identifier", "External Ids for this item.", 0, java.lang.Integer.MAX_VALUE, identifier));
607        childrenList.add(new Property("type", "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, type));
608        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));
609        childrenList.add(new Property("freeBusyType", "code", "busy | free | busy-unavailable | busy-tentative.", 0, java.lang.Integer.MAX_VALUE, freeBusyType));
610        childrenList.add(new Property("start", "instant", "Date/Time that the slot is to begin.", 0, java.lang.Integer.MAX_VALUE, start));
611        childrenList.add(new Property("end", "instant", "Date/Time that the slot is to conclude.", 0, java.lang.Integer.MAX_VALUE, end));
612        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));
613        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));
614      }
615
616      @Override
617      public void setProperty(String name, Base value) throws FHIRException {
618        if (name.equals("identifier"))
619          this.getIdentifier().add(castToIdentifier(value));
620        else if (name.equals("type"))
621          this.type = castToCodeableConcept(value); // CodeableConcept
622        else if (name.equals("schedule"))
623          this.schedule = castToReference(value); // Reference
624        else if (name.equals("freeBusyType"))
625          this.freeBusyType = new SlotStatusEnumFactory().fromType(value); // Enumeration<SlotStatus>
626        else if (name.equals("start"))
627          this.start = castToInstant(value); // InstantType
628        else if (name.equals("end"))
629          this.end = castToInstant(value); // InstantType
630        else if (name.equals("overbooked"))
631          this.overbooked = castToBoolean(value); // BooleanType
632        else if (name.equals("comment"))
633          this.comment = castToString(value); // StringType
634        else
635          super.setProperty(name, value);
636      }
637
638      @Override
639      public Base addChild(String name) throws FHIRException {
640        if (name.equals("identifier")) {
641          return addIdentifier();
642        }
643        else if (name.equals("type")) {
644          this.type = new CodeableConcept();
645          return this.type;
646        }
647        else if (name.equals("schedule")) {
648          this.schedule = new Reference();
649          return this.schedule;
650        }
651        else if (name.equals("freeBusyType")) {
652          throw new FHIRException("Cannot call addChild on a primitive type Slot.freeBusyType");
653        }
654        else if (name.equals("start")) {
655          throw new FHIRException("Cannot call addChild on a primitive type Slot.start");
656        }
657        else if (name.equals("end")) {
658          throw new FHIRException("Cannot call addChild on a primitive type Slot.end");
659        }
660        else if (name.equals("overbooked")) {
661          throw new FHIRException("Cannot call addChild on a primitive type Slot.overbooked");
662        }
663        else if (name.equals("comment")) {
664          throw new FHIRException("Cannot call addChild on a primitive type Slot.comment");
665        }
666        else
667          return super.addChild(name);
668      }
669
670  public String fhirType() {
671    return "Slot";
672
673  }
674
675      public Slot copy() {
676        Slot dst = new Slot();
677        copyValues(dst);
678        if (identifier != null) {
679          dst.identifier = new ArrayList<Identifier>();
680          for (Identifier i : identifier)
681            dst.identifier.add(i.copy());
682        };
683        dst.type = type == null ? null : type.copy();
684        dst.schedule = schedule == null ? null : schedule.copy();
685        dst.freeBusyType = freeBusyType == null ? null : freeBusyType.copy();
686        dst.start = start == null ? null : start.copy();
687        dst.end = end == null ? null : end.copy();
688        dst.overbooked = overbooked == null ? null : overbooked.copy();
689        dst.comment = comment == null ? null : comment.copy();
690        return dst;
691      }
692
693      protected Slot typedCopy() {
694        return copy();
695      }
696
697      @Override
698      public boolean equalsDeep(Base other) {
699        if (!super.equalsDeep(other))
700          return false;
701        if (!(other instanceof Slot))
702          return false;
703        Slot o = (Slot) other;
704        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true)
705           && compareDeep(freeBusyType, o.freeBusyType, true) && compareDeep(start, o.start, true) && compareDeep(end, o.end, true)
706           && compareDeep(overbooked, o.overbooked, true) && compareDeep(comment, o.comment, true);
707      }
708
709      @Override
710      public boolean equalsShallow(Base other) {
711        if (!super.equalsShallow(other))
712          return false;
713        if (!(other instanceof Slot))
714          return false;
715        Slot o = (Slot) other;
716        return compareValues(freeBusyType, o.freeBusyType, true) && compareValues(start, o.start, true) && compareValues(end, o.end, true)
717           && compareValues(overbooked, o.overbooked, true) && compareValues(comment, o.comment, true);
718      }
719
720      public boolean isEmpty() {
721        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (type == null || type.isEmpty())
722           && (schedule == null || schedule.isEmpty()) && (freeBusyType == null || freeBusyType.isEmpty())
723           && (start == null || start.isEmpty()) && (end == null || end.isEmpty()) && (overbooked == null || overbooked.isEmpty())
724           && (comment == null || comment.isEmpty());
725      }
726
727  @Override
728  public ResourceType getResourceType() {
729    return ResourceType.Slot;
730   }
731
732  @SearchParamDefinition(name="schedule", path="Slot.schedule", description="The Schedule Resource that we are seeking a slot within", type="reference" )
733  public static final String SP_SCHEDULE = "schedule";
734  @SearchParamDefinition(name="identifier", path="Slot.identifier", description="A Slot Identifier", type="token" )
735  public static final String SP_IDENTIFIER = "identifier";
736  @SearchParamDefinition(name="start", path="Slot.start", description="Appointment date/time.", type="date" )
737  public static final String SP_START = "start";
738  @SearchParamDefinition(name="slot-type", path="Slot.type", description="The type of appointments that can be booked into the slot", type="token" )
739  public static final String SP_SLOTTYPE = "slot-type";
740  @SearchParamDefinition(name="fb-type", path="Slot.freeBusyType", description="The free/busy status of the appointment", type="token" )
741  public static final String SP_FBTYPE = "fb-type";
742
743}
744