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