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