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 reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.
048 */
049@ResourceDef(name="AppointmentResponse", profile="http://hl7.org/fhir/Profile/AppointmentResponse")
050public class AppointmentResponse extends DomainResource {
051
052    public enum ParticipantStatus {
053        /**
054         * The appointment participant has accepted that they can attend the appointment at the time specified in the AppointmentResponse.
055         */
056        ACCEPTED, 
057        /**
058         * The appointment participant has declined the appointment.
059         */
060        DECLINED, 
061        /**
062         * The appointment participant has tentatively accepted the appointment.
063         */
064        TENTATIVE, 
065        /**
066         * The participant has in-process the appointment.
067         */
068        INPROCESS, 
069        /**
070         * The participant has completed the appointment.
071         */
072        COMPLETED, 
073        /**
074         * This is the intitial status of an appointment participant until a participant has replied. It implies that there is no commitment for the appointment.
075         */
076        NEEDSACTION, 
077        /**
078         * added to help the parsers
079         */
080        NULL;
081        public static ParticipantStatus fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("accepted".equals(codeString))
085          return ACCEPTED;
086        if ("declined".equals(codeString))
087          return DECLINED;
088        if ("tentative".equals(codeString))
089          return TENTATIVE;
090        if ("in-process".equals(codeString))
091          return INPROCESS;
092        if ("completed".equals(codeString))
093          return COMPLETED;
094        if ("needs-action".equals(codeString))
095          return NEEDSACTION;
096        throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'");
097        }
098        public String toCode() {
099          switch (this) {
100            case ACCEPTED: return "accepted";
101            case DECLINED: return "declined";
102            case TENTATIVE: return "tentative";
103            case INPROCESS: return "in-process";
104            case COMPLETED: return "completed";
105            case NEEDSACTION: return "needs-action";
106            default: return "?";
107          }
108        }
109        public String getSystem() {
110          switch (this) {
111            case ACCEPTED: return "http://hl7.org/fhir/participantstatus";
112            case DECLINED: return "http://hl7.org/fhir/participantstatus";
113            case TENTATIVE: return "http://hl7.org/fhir/participantstatus";
114            case INPROCESS: return "http://hl7.org/fhir/participantstatus";
115            case COMPLETED: return "http://hl7.org/fhir/participantstatus";
116            case NEEDSACTION: return "http://hl7.org/fhir/participantstatus";
117            default: return "?";
118          }
119        }
120        public String getDefinition() {
121          switch (this) {
122            case ACCEPTED: return "The appointment participant has accepted that they can attend the appointment at the time specified in the AppointmentResponse.";
123            case DECLINED: return "The appointment participant has declined the appointment.";
124            case TENTATIVE: return "The appointment participant has tentatively accepted the appointment.";
125            case INPROCESS: return "The participant has in-process the appointment.";
126            case COMPLETED: return "The participant has completed the appointment.";
127            case NEEDSACTION: return "This is the intitial status of an appointment participant until a participant has replied. It implies that there is no commitment for the appointment.";
128            default: return "?";
129          }
130        }
131        public String getDisplay() {
132          switch (this) {
133            case ACCEPTED: return "Accepted";
134            case DECLINED: return "Declined";
135            case TENTATIVE: return "Tentative";
136            case INPROCESS: return "In Process";
137            case COMPLETED: return "Completed";
138            case NEEDSACTION: return "Needs Action";
139            default: return "?";
140          }
141        }
142    }
143
144  public static class ParticipantStatusEnumFactory implements EnumFactory<ParticipantStatus> {
145    public ParticipantStatus fromCode(String codeString) throws IllegalArgumentException {
146      if (codeString == null || "".equals(codeString))
147            if (codeString == null || "".equals(codeString))
148                return null;
149        if ("accepted".equals(codeString))
150          return ParticipantStatus.ACCEPTED;
151        if ("declined".equals(codeString))
152          return ParticipantStatus.DECLINED;
153        if ("tentative".equals(codeString))
154          return ParticipantStatus.TENTATIVE;
155        if ("in-process".equals(codeString))
156          return ParticipantStatus.INPROCESS;
157        if ("completed".equals(codeString))
158          return ParticipantStatus.COMPLETED;
159        if ("needs-action".equals(codeString))
160          return ParticipantStatus.NEEDSACTION;
161        throw new IllegalArgumentException("Unknown ParticipantStatus code '"+codeString+"'");
162        }
163        public Enumeration<ParticipantStatus> fromType(Base code) throws FHIRException {
164          if (code == null || code.isEmpty())
165            return null;
166          String codeString = ((PrimitiveType) code).asStringValue();
167          if (codeString == null || "".equals(codeString))
168            return null;
169        if ("accepted".equals(codeString))
170          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.ACCEPTED);
171        if ("declined".equals(codeString))
172          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.DECLINED);
173        if ("tentative".equals(codeString))
174          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.TENTATIVE);
175        if ("in-process".equals(codeString))
176          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.INPROCESS);
177        if ("completed".equals(codeString))
178          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.COMPLETED);
179        if ("needs-action".equals(codeString))
180          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.NEEDSACTION);
181        throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'");
182        }
183    public String toCode(ParticipantStatus code) {
184      if (code == ParticipantStatus.ACCEPTED)
185        return "accepted";
186      if (code == ParticipantStatus.DECLINED)
187        return "declined";
188      if (code == ParticipantStatus.TENTATIVE)
189        return "tentative";
190      if (code == ParticipantStatus.INPROCESS)
191        return "in-process";
192      if (code == ParticipantStatus.COMPLETED)
193        return "completed";
194      if (code == ParticipantStatus.NEEDSACTION)
195        return "needs-action";
196      return "?";
197      }
198    }
199
200    /**
201     * This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.
202     */
203    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
204    @Description(shortDefinition="External Ids for this item", formalDefinition="This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate." )
205    protected List<Identifier> identifier;
206
207    /**
208     * Appointment that this response is replying to.
209     */
210    @Child(name = "appointment", type = {Appointment.class}, order=1, min=1, max=1, modifier=false, summary=true)
211    @Description(shortDefinition="Appointment this response relates to", formalDefinition="Appointment that this response is replying to." )
212    protected Reference appointment;
213
214    /**
215     * The actual object that is the target of the reference (Appointment that this response is replying to.)
216     */
217    protected Appointment appointmentTarget;
218
219    /**
220     * Date/Time that the appointment is to take place, or requested new start time.
221     */
222    @Child(name = "start", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=false)
223    @Description(shortDefinition="Time from appointment, or requested new start time", formalDefinition="Date/Time that the appointment is to take place, or requested new start time." )
224    protected InstantType start;
225
226    /**
227     * This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.
228     */
229    @Child(name = "end", type = {InstantType.class}, order=3, min=0, max=1, modifier=false, summary=false)
230    @Description(shortDefinition="Time from appointment, or requested new end time", formalDefinition="This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time." )
231    protected InstantType end;
232
233    /**
234     * Role of participant in the appointment.
235     */
236    @Child(name = "participantType", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
237    @Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." )
238    protected List<CodeableConcept> participantType;
239
240    /**
241     * A Person, Location/HealthcareService or Device that is participating in the appointment.
242     */
243    @Child(name = "actor", type = {Patient.class, Practitioner.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=5, min=0, max=1, modifier=false, summary=true)
244    @Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." )
245    protected Reference actor;
246
247    /**
248     * The actual object that is the target of the reference (A Person, Location/HealthcareService or Device that is participating in the appointment.)
249     */
250    protected Resource actorTarget;
251
252    /**
253     * Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.
254     */
255    @Child(name = "participantStatus", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
256    @Description(shortDefinition="accepted | declined | tentative | in-process | completed | needs-action", formalDefinition="Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty." )
257    protected Enumeration<ParticipantStatus> participantStatus;
258
259    /**
260     * Additional comments about the appointment.
261     */
262    @Child(name = "comment", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
263    @Description(shortDefinition="Additional comments", formalDefinition="Additional comments about the appointment." )
264    protected StringType comment;
265
266    private static final long serialVersionUID = 248548635L;
267
268  /*
269   * Constructor
270   */
271    public AppointmentResponse() {
272      super();
273    }
274
275  /*
276   * Constructor
277   */
278    public AppointmentResponse(Reference appointment, Enumeration<ParticipantStatus> participantStatus) {
279      super();
280      this.appointment = appointment;
281      this.participantStatus = participantStatus;
282    }
283
284    /**
285     * @return {@link #identifier} (This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.)
286     */
287    public List<Identifier> getIdentifier() { 
288      if (this.identifier == null)
289        this.identifier = new ArrayList<Identifier>();
290      return this.identifier;
291    }
292
293    public boolean hasIdentifier() { 
294      if (this.identifier == null)
295        return false;
296      for (Identifier item : this.identifier)
297        if (!item.isEmpty())
298          return true;
299      return false;
300    }
301
302    /**
303     * @return {@link #identifier} (This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.)
304     */
305    // syntactic sugar
306    public Identifier addIdentifier() { //3
307      Identifier t = new Identifier();
308      if (this.identifier == null)
309        this.identifier = new ArrayList<Identifier>();
310      this.identifier.add(t);
311      return t;
312    }
313
314    // syntactic sugar
315    public AppointmentResponse addIdentifier(Identifier t) { //3
316      if (t == null)
317        return this;
318      if (this.identifier == null)
319        this.identifier = new ArrayList<Identifier>();
320      this.identifier.add(t);
321      return this;
322    }
323
324    /**
325     * @return {@link #appointment} (Appointment that this response is replying to.)
326     */
327    public Reference getAppointment() { 
328      if (this.appointment == null)
329        if (Configuration.errorOnAutoCreate())
330          throw new Error("Attempt to auto-create AppointmentResponse.appointment");
331        else if (Configuration.doAutoCreate())
332          this.appointment = new Reference(); // cc
333      return this.appointment;
334    }
335
336    public boolean hasAppointment() { 
337      return this.appointment != null && !this.appointment.isEmpty();
338    }
339
340    /**
341     * @param value {@link #appointment} (Appointment that this response is replying to.)
342     */
343    public AppointmentResponse setAppointment(Reference value) { 
344      this.appointment = value;
345      return this;
346    }
347
348    /**
349     * @return {@link #appointment} 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. (Appointment that this response is replying to.)
350     */
351    public Appointment getAppointmentTarget() { 
352      if (this.appointmentTarget == null)
353        if (Configuration.errorOnAutoCreate())
354          throw new Error("Attempt to auto-create AppointmentResponse.appointment");
355        else if (Configuration.doAutoCreate())
356          this.appointmentTarget = new Appointment(); // aa
357      return this.appointmentTarget;
358    }
359
360    /**
361     * @param value {@link #appointment} 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. (Appointment that this response is replying to.)
362     */
363    public AppointmentResponse setAppointmentTarget(Appointment value) { 
364      this.appointmentTarget = value;
365      return this;
366    }
367
368    /**
369     * @return {@link #start} (Date/Time that the appointment is to take place, or requested new start time.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
370     */
371    public InstantType getStartElement() { 
372      if (this.start == null)
373        if (Configuration.errorOnAutoCreate())
374          throw new Error("Attempt to auto-create AppointmentResponse.start");
375        else if (Configuration.doAutoCreate())
376          this.start = new InstantType(); // bb
377      return this.start;
378    }
379
380    public boolean hasStartElement() { 
381      return this.start != null && !this.start.isEmpty();
382    }
383
384    public boolean hasStart() { 
385      return this.start != null && !this.start.isEmpty();
386    }
387
388    /**
389     * @param value {@link #start} (Date/Time that the appointment is to take place, or requested new start time.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
390     */
391    public AppointmentResponse setStartElement(InstantType value) { 
392      this.start = value;
393      return this;
394    }
395
396    /**
397     * @return Date/Time that the appointment is to take place, or requested new start time.
398     */
399    public Date getStart() { 
400      return this.start == null ? null : this.start.getValue();
401    }
402
403    /**
404     * @param value Date/Time that the appointment is to take place, or requested new start time.
405     */
406    public AppointmentResponse setStart(Date value) { 
407      if (value == null)
408        this.start = null;
409      else {
410        if (this.start == null)
411          this.start = new InstantType();
412        this.start.setValue(value);
413      }
414      return this;
415    }
416
417    /**
418     * @return {@link #end} (This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
419     */
420    public InstantType getEndElement() { 
421      if (this.end == null)
422        if (Configuration.errorOnAutoCreate())
423          throw new Error("Attempt to auto-create AppointmentResponse.end");
424        else if (Configuration.doAutoCreate())
425          this.end = new InstantType(); // bb
426      return this.end;
427    }
428
429    public boolean hasEndElement() { 
430      return this.end != null && !this.end.isEmpty();
431    }
432
433    public boolean hasEnd() { 
434      return this.end != null && !this.end.isEmpty();
435    }
436
437    /**
438     * @param value {@link #end} (This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
439     */
440    public AppointmentResponse setEndElement(InstantType value) { 
441      this.end = value;
442      return this;
443    }
444
445    /**
446     * @return This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.
447     */
448    public Date getEnd() { 
449      return this.end == null ? null : this.end.getValue();
450    }
451
452    /**
453     * @param value This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.
454     */
455    public AppointmentResponse setEnd(Date value) { 
456      if (value == null)
457        this.end = null;
458      else {
459        if (this.end == null)
460          this.end = new InstantType();
461        this.end.setValue(value);
462      }
463      return this;
464    }
465
466    /**
467     * @return {@link #participantType} (Role of participant in the appointment.)
468     */
469    public List<CodeableConcept> getParticipantType() { 
470      if (this.participantType == null)
471        this.participantType = new ArrayList<CodeableConcept>();
472      return this.participantType;
473    }
474
475    public boolean hasParticipantType() { 
476      if (this.participantType == null)
477        return false;
478      for (CodeableConcept item : this.participantType)
479        if (!item.isEmpty())
480          return true;
481      return false;
482    }
483
484    /**
485     * @return {@link #participantType} (Role of participant in the appointment.)
486     */
487    // syntactic sugar
488    public CodeableConcept addParticipantType() { //3
489      CodeableConcept t = new CodeableConcept();
490      if (this.participantType == null)
491        this.participantType = new ArrayList<CodeableConcept>();
492      this.participantType.add(t);
493      return t;
494    }
495
496    // syntactic sugar
497    public AppointmentResponse addParticipantType(CodeableConcept t) { //3
498      if (t == null)
499        return this;
500      if (this.participantType == null)
501        this.participantType = new ArrayList<CodeableConcept>();
502      this.participantType.add(t);
503      return this;
504    }
505
506    /**
507     * @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
508     */
509    public Reference getActor() { 
510      if (this.actor == null)
511        if (Configuration.errorOnAutoCreate())
512          throw new Error("Attempt to auto-create AppointmentResponse.actor");
513        else if (Configuration.doAutoCreate())
514          this.actor = new Reference(); // cc
515      return this.actor;
516    }
517
518    public boolean hasActor() { 
519      return this.actor != null && !this.actor.isEmpty();
520    }
521
522    /**
523     * @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
524     */
525    public AppointmentResponse setActor(Reference value) { 
526      this.actor = value;
527      return this;
528    }
529
530    /**
531     * @return {@link #actor} 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. (A Person, Location/HealthcareService or Device that is participating in the appointment.)
532     */
533    public Resource getActorTarget() { 
534      return this.actorTarget;
535    }
536
537    /**
538     * @param value {@link #actor} 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. (A Person, Location/HealthcareService or Device that is participating in the appointment.)
539     */
540    public AppointmentResponse setActorTarget(Resource value) { 
541      this.actorTarget = value;
542      return this;
543    }
544
545    /**
546     * @return {@link #participantStatus} (Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.). This is the underlying object with id, value and extensions. The accessor "getParticipantStatus" gives direct access to the value
547     */
548    public Enumeration<ParticipantStatus> getParticipantStatusElement() { 
549      if (this.participantStatus == null)
550        if (Configuration.errorOnAutoCreate())
551          throw new Error("Attempt to auto-create AppointmentResponse.participantStatus");
552        else if (Configuration.doAutoCreate())
553          this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory()); // bb
554      return this.participantStatus;
555    }
556
557    public boolean hasParticipantStatusElement() { 
558      return this.participantStatus != null && !this.participantStatus.isEmpty();
559    }
560
561    public boolean hasParticipantStatus() { 
562      return this.participantStatus != null && !this.participantStatus.isEmpty();
563    }
564
565    /**
566     * @param value {@link #participantStatus} (Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.). This is the underlying object with id, value and extensions. The accessor "getParticipantStatus" gives direct access to the value
567     */
568    public AppointmentResponse setParticipantStatusElement(Enumeration<ParticipantStatus> value) { 
569      this.participantStatus = value;
570      return this;
571    }
572
573    /**
574     * @return Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.
575     */
576    public ParticipantStatus getParticipantStatus() { 
577      return this.participantStatus == null ? null : this.participantStatus.getValue();
578    }
579
580    /**
581     * @param value Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.
582     */
583    public AppointmentResponse setParticipantStatus(ParticipantStatus value) { 
584        if (this.participantStatus == null)
585          this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory());
586        this.participantStatus.setValue(value);
587      return this;
588    }
589
590    /**
591     * @return {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
592     */
593    public StringType getCommentElement() { 
594      if (this.comment == null)
595        if (Configuration.errorOnAutoCreate())
596          throw new Error("Attempt to auto-create AppointmentResponse.comment");
597        else if (Configuration.doAutoCreate())
598          this.comment = new StringType(); // bb
599      return this.comment;
600    }
601
602    public boolean hasCommentElement() { 
603      return this.comment != null && !this.comment.isEmpty();
604    }
605
606    public boolean hasComment() { 
607      return this.comment != null && !this.comment.isEmpty();
608    }
609
610    /**
611     * @param value {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
612     */
613    public AppointmentResponse setCommentElement(StringType value) { 
614      this.comment = value;
615      return this;
616    }
617
618    /**
619     * @return Additional comments about the appointment.
620     */
621    public String getComment() { 
622      return this.comment == null ? null : this.comment.getValue();
623    }
624
625    /**
626     * @param value Additional comments about the appointment.
627     */
628    public AppointmentResponse setComment(String value) { 
629      if (Utilities.noString(value))
630        this.comment = null;
631      else {
632        if (this.comment == null)
633          this.comment = new StringType();
634        this.comment.setValue(value);
635      }
636      return this;
637    }
638
639      protected void listChildren(List<Property> childrenList) {
640        super.listChildren(childrenList);
641        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.", 0, java.lang.Integer.MAX_VALUE, identifier));
642        childrenList.add(new Property("appointment", "Reference(Appointment)", "Appointment that this response is replying to.", 0, java.lang.Integer.MAX_VALUE, appointment));
643        childrenList.add(new Property("start", "instant", "Date/Time that the appointment is to take place, or requested new start time.", 0, java.lang.Integer.MAX_VALUE, start));
644        childrenList.add(new Property("end", "instant", "This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.", 0, java.lang.Integer.MAX_VALUE, end));
645        childrenList.add(new Property("participantType", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, participantType));
646        childrenList.add(new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, java.lang.Integer.MAX_VALUE, actor));
647        childrenList.add(new Property("participantStatus", "code", "Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.", 0, java.lang.Integer.MAX_VALUE, participantStatus));
648        childrenList.add(new Property("comment", "string", "Additional comments about the appointment.", 0, java.lang.Integer.MAX_VALUE, comment));
649      }
650
651      @Override
652      public void setProperty(String name, Base value) throws FHIRException {
653        if (name.equals("identifier"))
654          this.getIdentifier().add(castToIdentifier(value));
655        else if (name.equals("appointment"))
656          this.appointment = castToReference(value); // Reference
657        else if (name.equals("start"))
658          this.start = castToInstant(value); // InstantType
659        else if (name.equals("end"))
660          this.end = castToInstant(value); // InstantType
661        else if (name.equals("participantType"))
662          this.getParticipantType().add(castToCodeableConcept(value));
663        else if (name.equals("actor"))
664          this.actor = castToReference(value); // Reference
665        else if (name.equals("participantStatus"))
666          this.participantStatus = new ParticipantStatusEnumFactory().fromType(value); // Enumeration<ParticipantStatus>
667        else if (name.equals("comment"))
668          this.comment = castToString(value); // StringType
669        else
670          super.setProperty(name, value);
671      }
672
673      @Override
674      public Base addChild(String name) throws FHIRException {
675        if (name.equals("identifier")) {
676          return addIdentifier();
677        }
678        else if (name.equals("appointment")) {
679          this.appointment = new Reference();
680          return this.appointment;
681        }
682        else if (name.equals("start")) {
683          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.start");
684        }
685        else if (name.equals("end")) {
686          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.end");
687        }
688        else if (name.equals("participantType")) {
689          return addParticipantType();
690        }
691        else if (name.equals("actor")) {
692          this.actor = new Reference();
693          return this.actor;
694        }
695        else if (name.equals("participantStatus")) {
696          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.participantStatus");
697        }
698        else if (name.equals("comment")) {
699          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.comment");
700        }
701        else
702          return super.addChild(name);
703      }
704
705  public String fhirType() {
706    return "AppointmentResponse";
707
708  }
709
710      public AppointmentResponse copy() {
711        AppointmentResponse dst = new AppointmentResponse();
712        copyValues(dst);
713        if (identifier != null) {
714          dst.identifier = new ArrayList<Identifier>();
715          for (Identifier i : identifier)
716            dst.identifier.add(i.copy());
717        };
718        dst.appointment = appointment == null ? null : appointment.copy();
719        dst.start = start == null ? null : start.copy();
720        dst.end = end == null ? null : end.copy();
721        if (participantType != null) {
722          dst.participantType = new ArrayList<CodeableConcept>();
723          for (CodeableConcept i : participantType)
724            dst.participantType.add(i.copy());
725        };
726        dst.actor = actor == null ? null : actor.copy();
727        dst.participantStatus = participantStatus == null ? null : participantStatus.copy();
728        dst.comment = comment == null ? null : comment.copy();
729        return dst;
730      }
731
732      protected AppointmentResponse typedCopy() {
733        return copy();
734      }
735
736      @Override
737      public boolean equalsDeep(Base other) {
738        if (!super.equalsDeep(other))
739          return false;
740        if (!(other instanceof AppointmentResponse))
741          return false;
742        AppointmentResponse o = (AppointmentResponse) other;
743        return compareDeep(identifier, o.identifier, true) && compareDeep(appointment, o.appointment, true)
744           && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(participantType, o.participantType, true)
745           && compareDeep(actor, o.actor, true) && compareDeep(participantStatus, o.participantStatus, true)
746           && compareDeep(comment, o.comment, true);
747      }
748
749      @Override
750      public boolean equalsShallow(Base other) {
751        if (!super.equalsShallow(other))
752          return false;
753        if (!(other instanceof AppointmentResponse))
754          return false;
755        AppointmentResponse o = (AppointmentResponse) other;
756        return compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(participantStatus, o.participantStatus, true)
757           && compareValues(comment, o.comment, true);
758      }
759
760      public boolean isEmpty() {
761        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (appointment == null || appointment.isEmpty())
762           && (start == null || start.isEmpty()) && (end == null || end.isEmpty()) && (participantType == null || participantType.isEmpty())
763           && (actor == null || actor.isEmpty()) && (participantStatus == null || participantStatus.isEmpty())
764           && (comment == null || comment.isEmpty());
765      }
766
767  @Override
768  public ResourceType getResourceType() {
769    return ResourceType.AppointmentResponse;
770   }
771
772  @SearchParamDefinition(name="actor", path="AppointmentResponse.actor", description="The Person, Location/HealthcareService or Device that this appointment response replies for", type="reference" )
773  public static final String SP_ACTOR = "actor";
774  @SearchParamDefinition(name="identifier", path="AppointmentResponse.identifier", description="An Identifier in this appointment response", type="token" )
775  public static final String SP_IDENTIFIER = "identifier";
776  @SearchParamDefinition(name="practitioner", path="AppointmentResponse.actor", description="This Response is for this Practitioner", type="reference" )
777  public static final String SP_PRACTITIONER = "practitioner";
778  @SearchParamDefinition(name="part-status", path="AppointmentResponse.participantStatus", description="The participants acceptance status for this appointment", type="token" )
779  public static final String SP_PARTSTATUS = "part-status";
780  @SearchParamDefinition(name="patient", path="AppointmentResponse.actor", description="This Response is for this Patient", type="reference" )
781  public static final String SP_PATIENT = "patient";
782  @SearchParamDefinition(name="appointment", path="AppointmentResponse.appointment", description="The appointment that the response is attached to", type="reference" )
783  public static final String SP_APPOINTMENT = "appointment";
784  @SearchParamDefinition(name="location", path="AppointmentResponse.actor", description="This Response is for this Location", type="reference" )
785  public static final String SP_LOCATION = "location";
786
787}