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