001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045import org.hl7.fhir.exceptions.FHIRFormatError;
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/StructureDefinition/AppointmentResponse")
050public class AppointmentResponse extends DomainResource {
051
052    public enum ParticipantStatus {
053        /**
054         * The participant has accepted the appointment.
055         */
056        ACCEPTED, 
057        /**
058         * The participant has declined the appointment and will not participate in the appointment.
059         */
060        DECLINED, 
061        /**
062         * The participant has  tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur.
063         */
064        TENTATIVE, 
065        /**
066         * The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.
067         */
068        NEEDSACTION, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static ParticipantStatus fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("accepted".equals(codeString))
077          return ACCEPTED;
078        if ("declined".equals(codeString))
079          return DECLINED;
080        if ("tentative".equals(codeString))
081          return TENTATIVE;
082        if ("needs-action".equals(codeString))
083          return NEEDSACTION;
084        if (Configuration.isAcceptInvalidEnums())
085          return null;
086        else
087          throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'");
088        }
089        public String toCode() {
090          switch (this) {
091            case ACCEPTED: return "accepted";
092            case DECLINED: return "declined";
093            case TENTATIVE: return "tentative";
094            case NEEDSACTION: return "needs-action";
095            default: return "?";
096          }
097        }
098        public String getSystem() {
099          switch (this) {
100            case ACCEPTED: return "http://hl7.org/fhir/participationstatus";
101            case DECLINED: return "http://hl7.org/fhir/participationstatus";
102            case TENTATIVE: return "http://hl7.org/fhir/participationstatus";
103            case NEEDSACTION: return "http://hl7.org/fhir/participationstatus";
104            default: return "?";
105          }
106        }
107        public String getDefinition() {
108          switch (this) {
109            case ACCEPTED: return "The participant has accepted the appointment.";
110            case DECLINED: return "The participant has declined the appointment and will not participate in the appointment.";
111            case TENTATIVE: return "The participant has  tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur.";
112            case NEEDSACTION: return "The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.";
113            default: return "?";
114          }
115        }
116        public String getDisplay() {
117          switch (this) {
118            case ACCEPTED: return "Accepted";
119            case DECLINED: return "Declined";
120            case TENTATIVE: return "Tentative";
121            case NEEDSACTION: return "Needs Action";
122            default: return "?";
123          }
124        }
125    }
126
127  public static class ParticipantStatusEnumFactory implements EnumFactory<ParticipantStatus> {
128    public ParticipantStatus fromCode(String codeString) throws IllegalArgumentException {
129      if (codeString == null || "".equals(codeString))
130            if (codeString == null || "".equals(codeString))
131                return null;
132        if ("accepted".equals(codeString))
133          return ParticipantStatus.ACCEPTED;
134        if ("declined".equals(codeString))
135          return ParticipantStatus.DECLINED;
136        if ("tentative".equals(codeString))
137          return ParticipantStatus.TENTATIVE;
138        if ("needs-action".equals(codeString))
139          return ParticipantStatus.NEEDSACTION;
140        throw new IllegalArgumentException("Unknown ParticipantStatus code '"+codeString+"'");
141        }
142        public Enumeration<ParticipantStatus> fromType(Base code) throws FHIRException {
143          if (code == null)
144            return null;
145          if (code.isEmpty())
146            return new Enumeration<ParticipantStatus>(this);
147          String codeString = ((PrimitiveType) code).asStringValue();
148          if (codeString == null || "".equals(codeString))
149            return null;
150        if ("accepted".equals(codeString))
151          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.ACCEPTED);
152        if ("declined".equals(codeString))
153          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.DECLINED);
154        if ("tentative".equals(codeString))
155          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.TENTATIVE);
156        if ("needs-action".equals(codeString))
157          return new Enumeration<ParticipantStatus>(this, ParticipantStatus.NEEDSACTION);
158        throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'");
159        }
160    public String toCode(ParticipantStatus code) {
161      if (code == ParticipantStatus.ACCEPTED)
162        return "accepted";
163      if (code == ParticipantStatus.DECLINED)
164        return "declined";
165      if (code == ParticipantStatus.TENTATIVE)
166        return "tentative";
167      if (code == ParticipantStatus.NEEDSACTION)
168        return "needs-action";
169      return "?";
170      }
171    public String toSystem(ParticipantStatus code) {
172      return code.getSystem();
173      }
174    }
175
176    /**
177     * 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.
178     */
179    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
180    @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." )
181    protected List<Identifier> identifier;
182
183    /**
184     * Appointment that this response is replying to.
185     */
186    @Child(name = "appointment", type = {Appointment.class}, order=1, min=1, max=1, modifier=false, summary=true)
187    @Description(shortDefinition="Appointment this response relates to", formalDefinition="Appointment that this response is replying to." )
188    protected Reference appointment;
189
190    /**
191     * The actual object that is the target of the reference (Appointment that this response is replying to.)
192     */
193    protected Appointment appointmentTarget;
194
195    /**
196     * Date/Time that the appointment is to take place, or requested new start time.
197     */
198    @Child(name = "start", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=false)
199    @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." )
200    protected InstantType start;
201
202    /**
203     * 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.
204     */
205    @Child(name = "end", type = {InstantType.class}, order=3, min=0, max=1, modifier=false, summary=false)
206    @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." )
207    protected InstantType end;
208
209    /**
210     * Role of participant in the appointment.
211     */
212    @Child(name = "participantType", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
213    @Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." )
214    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-participant-type")
215    protected List<CodeableConcept> participantType;
216
217    /**
218     * A Person, Location/HealthcareService or Device that is participating in the appointment.
219     */
220    @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)
221    @Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." )
222    protected Reference actor;
223
224    /**
225     * The actual object that is the target of the reference (A Person, Location/HealthcareService or Device that is participating in the appointment.)
226     */
227    protected Resource actorTarget;
228
229    /**
230     * 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.
231     */
232    @Child(name = "participantStatus", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
233    @Description(shortDefinition="accepted | declined | tentative | in-process | completed | needs-action | entered-in-error", 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." )
234    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participationstatus")
235    protected Enumeration<ParticipantStatus> participantStatus;
236
237    /**
238     * Additional comments about the appointment.
239     */
240    @Child(name = "comment", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
241    @Description(shortDefinition="Additional comments", formalDefinition="Additional comments about the appointment." )
242    protected StringType comment;
243
244    private static final long serialVersionUID = 248548635L;
245
246  /**
247   * Constructor
248   */
249    public AppointmentResponse() {
250      super();
251    }
252
253  /**
254   * Constructor
255   */
256    public AppointmentResponse(Reference appointment, Enumeration<ParticipantStatus> participantStatus) {
257      super();
258      this.appointment = appointment;
259      this.participantStatus = participantStatus;
260    }
261
262    /**
263     * @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.)
264     */
265    public List<Identifier> getIdentifier() { 
266      if (this.identifier == null)
267        this.identifier = new ArrayList<Identifier>();
268      return this.identifier;
269    }
270
271    /**
272     * @return Returns a reference to <code>this</code> for easy method chaining
273     */
274    public AppointmentResponse setIdentifier(List<Identifier> theIdentifier) { 
275      this.identifier = theIdentifier;
276      return this;
277    }
278
279    public boolean hasIdentifier() { 
280      if (this.identifier == null)
281        return false;
282      for (Identifier item : this.identifier)
283        if (!item.isEmpty())
284          return true;
285      return false;
286    }
287
288    public Identifier addIdentifier() { //3
289      Identifier t = new Identifier();
290      if (this.identifier == null)
291        this.identifier = new ArrayList<Identifier>();
292      this.identifier.add(t);
293      return t;
294    }
295
296    public AppointmentResponse addIdentifier(Identifier t) { //3
297      if (t == null)
298        return this;
299      if (this.identifier == null)
300        this.identifier = new ArrayList<Identifier>();
301      this.identifier.add(t);
302      return this;
303    }
304
305    /**
306     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
307     */
308    public Identifier getIdentifierFirstRep() { 
309      if (getIdentifier().isEmpty()) {
310        addIdentifier();
311      }
312      return getIdentifier().get(0);
313    }
314
315    /**
316     * @return {@link #appointment} (Appointment that this response is replying to.)
317     */
318    public Reference getAppointment() { 
319      if (this.appointment == null)
320        if (Configuration.errorOnAutoCreate())
321          throw new Error("Attempt to auto-create AppointmentResponse.appointment");
322        else if (Configuration.doAutoCreate())
323          this.appointment = new Reference(); // cc
324      return this.appointment;
325    }
326
327    public boolean hasAppointment() { 
328      return this.appointment != null && !this.appointment.isEmpty();
329    }
330
331    /**
332     * @param value {@link #appointment} (Appointment that this response is replying to.)
333     */
334    public AppointmentResponse setAppointment(Reference value)  { 
335      this.appointment = value;
336      return this;
337    }
338
339    /**
340     * @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.)
341     */
342    public Appointment getAppointmentTarget() { 
343      if (this.appointmentTarget == null)
344        if (Configuration.errorOnAutoCreate())
345          throw new Error("Attempt to auto-create AppointmentResponse.appointment");
346        else if (Configuration.doAutoCreate())
347          this.appointmentTarget = new Appointment(); // aa
348      return this.appointmentTarget;
349    }
350
351    /**
352     * @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.)
353     */
354    public AppointmentResponse setAppointmentTarget(Appointment value) { 
355      this.appointmentTarget = value;
356      return this;
357    }
358
359    /**
360     * @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
361     */
362    public InstantType getStartElement() { 
363      if (this.start == null)
364        if (Configuration.errorOnAutoCreate())
365          throw new Error("Attempt to auto-create AppointmentResponse.start");
366        else if (Configuration.doAutoCreate())
367          this.start = new InstantType(); // bb
368      return this.start;
369    }
370
371    public boolean hasStartElement() { 
372      return this.start != null && !this.start.isEmpty();
373    }
374
375    public boolean hasStart() { 
376      return this.start != null && !this.start.isEmpty();
377    }
378
379    /**
380     * @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
381     */
382    public AppointmentResponse setStartElement(InstantType value) { 
383      this.start = value;
384      return this;
385    }
386
387    /**
388     * @return Date/Time that the appointment is to take place, or requested new start time.
389     */
390    public Date getStart() { 
391      return this.start == null ? null : this.start.getValue();
392    }
393
394    /**
395     * @param value Date/Time that the appointment is to take place, or requested new start time.
396     */
397    public AppointmentResponse setStart(Date value) { 
398      if (value == null)
399        this.start = null;
400      else {
401        if (this.start == null)
402          this.start = new InstantType();
403        this.start.setValue(value);
404      }
405      return this;
406    }
407
408    /**
409     * @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
410     */
411    public InstantType getEndElement() { 
412      if (this.end == null)
413        if (Configuration.errorOnAutoCreate())
414          throw new Error("Attempt to auto-create AppointmentResponse.end");
415        else if (Configuration.doAutoCreate())
416          this.end = new InstantType(); // bb
417      return this.end;
418    }
419
420    public boolean hasEndElement() { 
421      return this.end != null && !this.end.isEmpty();
422    }
423
424    public boolean hasEnd() { 
425      return this.end != null && !this.end.isEmpty();
426    }
427
428    /**
429     * @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
430     */
431    public AppointmentResponse setEndElement(InstantType value) { 
432      this.end = value;
433      return this;
434    }
435
436    /**
437     * @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.
438     */
439    public Date getEnd() { 
440      return this.end == null ? null : this.end.getValue();
441    }
442
443    /**
444     * @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.
445     */
446    public AppointmentResponse setEnd(Date value) { 
447      if (value == null)
448        this.end = null;
449      else {
450        if (this.end == null)
451          this.end = new InstantType();
452        this.end.setValue(value);
453      }
454      return this;
455    }
456
457    /**
458     * @return {@link #participantType} (Role of participant in the appointment.)
459     */
460    public List<CodeableConcept> getParticipantType() { 
461      if (this.participantType == null)
462        this.participantType = new ArrayList<CodeableConcept>();
463      return this.participantType;
464    }
465
466    /**
467     * @return Returns a reference to <code>this</code> for easy method chaining
468     */
469    public AppointmentResponse setParticipantType(List<CodeableConcept> theParticipantType) { 
470      this.participantType = theParticipantType;
471      return this;
472    }
473
474    public boolean hasParticipantType() { 
475      if (this.participantType == null)
476        return false;
477      for (CodeableConcept item : this.participantType)
478        if (!item.isEmpty())
479          return true;
480      return false;
481    }
482
483    public CodeableConcept addParticipantType() { //3
484      CodeableConcept t = new CodeableConcept();
485      if (this.participantType == null)
486        this.participantType = new ArrayList<CodeableConcept>();
487      this.participantType.add(t);
488      return t;
489    }
490
491    public AppointmentResponse addParticipantType(CodeableConcept t) { //3
492      if (t == null)
493        return this;
494      if (this.participantType == null)
495        this.participantType = new ArrayList<CodeableConcept>();
496      this.participantType.add(t);
497      return this;
498    }
499
500    /**
501     * @return The first repetition of repeating field {@link #participantType}, creating it if it does not already exist
502     */
503    public CodeableConcept getParticipantTypeFirstRep() { 
504      if (getParticipantType().isEmpty()) {
505        addParticipantType();
506      }
507      return getParticipantType().get(0);
508    }
509
510    /**
511     * @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
512     */
513    public Reference getActor() { 
514      if (this.actor == null)
515        if (Configuration.errorOnAutoCreate())
516          throw new Error("Attempt to auto-create AppointmentResponse.actor");
517        else if (Configuration.doAutoCreate())
518          this.actor = new Reference(); // cc
519      return this.actor;
520    }
521
522    public boolean hasActor() { 
523      return this.actor != null && !this.actor.isEmpty();
524    }
525
526    /**
527     * @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
528     */
529    public AppointmentResponse setActor(Reference value)  { 
530      this.actor = value;
531      return this;
532    }
533
534    /**
535     * @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.)
536     */
537    public Resource getActorTarget() { 
538      return this.actorTarget;
539    }
540
541    /**
542     * @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.)
543     */
544    public AppointmentResponse setActorTarget(Resource value) { 
545      this.actorTarget = value;
546      return this;
547    }
548
549    /**
550     * @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
551     */
552    public Enumeration<ParticipantStatus> getParticipantStatusElement() { 
553      if (this.participantStatus == null)
554        if (Configuration.errorOnAutoCreate())
555          throw new Error("Attempt to auto-create AppointmentResponse.participantStatus");
556        else if (Configuration.doAutoCreate())
557          this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory()); // bb
558      return this.participantStatus;
559    }
560
561    public boolean hasParticipantStatusElement() { 
562      return this.participantStatus != null && !this.participantStatus.isEmpty();
563    }
564
565    public boolean hasParticipantStatus() { 
566      return this.participantStatus != null && !this.participantStatus.isEmpty();
567    }
568
569    /**
570     * @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
571     */
572    public AppointmentResponse setParticipantStatusElement(Enumeration<ParticipantStatus> value) { 
573      this.participantStatus = value;
574      return this;
575    }
576
577    /**
578     * @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.
579     */
580    public ParticipantStatus getParticipantStatus() { 
581      return this.participantStatus == null ? null : this.participantStatus.getValue();
582    }
583
584    /**
585     * @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.
586     */
587    public AppointmentResponse setParticipantStatus(ParticipantStatus value) { 
588        if (this.participantStatus == null)
589          this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory());
590        this.participantStatus.setValue(value);
591      return this;
592    }
593
594    /**
595     * @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
596     */
597    public StringType getCommentElement() { 
598      if (this.comment == null)
599        if (Configuration.errorOnAutoCreate())
600          throw new Error("Attempt to auto-create AppointmentResponse.comment");
601        else if (Configuration.doAutoCreate())
602          this.comment = new StringType(); // bb
603      return this.comment;
604    }
605
606    public boolean hasCommentElement() { 
607      return this.comment != null && !this.comment.isEmpty();
608    }
609
610    public boolean hasComment() { 
611      return this.comment != null && !this.comment.isEmpty();
612    }
613
614    /**
615     * @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
616     */
617    public AppointmentResponse setCommentElement(StringType value) { 
618      this.comment = value;
619      return this;
620    }
621
622    /**
623     * @return Additional comments about the appointment.
624     */
625    public String getComment() { 
626      return this.comment == null ? null : this.comment.getValue();
627    }
628
629    /**
630     * @param value Additional comments about the appointment.
631     */
632    public AppointmentResponse setComment(String value) { 
633      if (Utilities.noString(value))
634        this.comment = null;
635      else {
636        if (this.comment == null)
637          this.comment = new StringType();
638        this.comment.setValue(value);
639      }
640      return this;
641    }
642
643      protected void listChildren(List<Property> children) {
644        super.listChildren(children);
645        children.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));
646        children.add(new Property("appointment", "Reference(Appointment)", "Appointment that this response is replying to.", 0, 1, appointment));
647        children.add(new Property("start", "instant", "Date/Time that the appointment is to take place, or requested new start time.", 0, 1, start));
648        children.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, 1, end));
649        children.add(new Property("participantType", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, participantType));
650        children.add(new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor));
651        children.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, 1, participantStatus));
652        children.add(new Property("comment", "string", "Additional comments about the appointment.", 0, 1, comment));
653      }
654
655      @Override
656      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
657        switch (_hash) {
658        case -1618432855: /*identifier*/  return 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);
659        case -1474995297: /*appointment*/  return new Property("appointment", "Reference(Appointment)", "Appointment that this response is replying to.", 0, 1, appointment);
660        case 109757538: /*start*/  return new Property("start", "instant", "Date/Time that the appointment is to take place, or requested new start time.", 0, 1, start);
661        case 100571: /*end*/  return 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, 1, end);
662        case 841294093: /*participantType*/  return new Property("participantType", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, participantType);
663        case 92645877: /*actor*/  return new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor);
664        case 996096261: /*participantStatus*/  return 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, 1, participantStatus);
665        case 950398559: /*comment*/  return new Property("comment", "string", "Additional comments about the appointment.", 0, 1, comment);
666        default: return super.getNamedProperty(_hash, _name, _checkValid);
667        }
668
669      }
670
671      @Override
672      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
673        switch (hash) {
674        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
675        case -1474995297: /*appointment*/ return this.appointment == null ? new Base[0] : new Base[] {this.appointment}; // Reference
676        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // InstantType
677        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
678        case 841294093: /*participantType*/ return this.participantType == null ? new Base[0] : this.participantType.toArray(new Base[this.participantType.size()]); // CodeableConcept
679        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
680        case 996096261: /*participantStatus*/ return this.participantStatus == null ? new Base[0] : new Base[] {this.participantStatus}; // Enumeration<ParticipantStatus>
681        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
682        default: return super.getProperty(hash, name, checkValid);
683        }
684
685      }
686
687      @Override
688      public Base setProperty(int hash, String name, Base value) throws FHIRException {
689        switch (hash) {
690        case -1618432855: // identifier
691          this.getIdentifier().add(castToIdentifier(value)); // Identifier
692          return value;
693        case -1474995297: // appointment
694          this.appointment = castToReference(value); // Reference
695          return value;
696        case 109757538: // start
697          this.start = castToInstant(value); // InstantType
698          return value;
699        case 100571: // end
700          this.end = castToInstant(value); // InstantType
701          return value;
702        case 841294093: // participantType
703          this.getParticipantType().add(castToCodeableConcept(value)); // CodeableConcept
704          return value;
705        case 92645877: // actor
706          this.actor = castToReference(value); // Reference
707          return value;
708        case 996096261: // participantStatus
709          value = new ParticipantStatusEnumFactory().fromType(castToCode(value));
710          this.participantStatus = (Enumeration) value; // Enumeration<ParticipantStatus>
711          return value;
712        case 950398559: // comment
713          this.comment = castToString(value); // StringType
714          return value;
715        default: return super.setProperty(hash, name, value);
716        }
717
718      }
719
720      @Override
721      public Base setProperty(String name, Base value) throws FHIRException {
722        if (name.equals("identifier")) {
723          this.getIdentifier().add(castToIdentifier(value));
724        } else if (name.equals("appointment")) {
725          this.appointment = castToReference(value); // Reference
726        } else if (name.equals("start")) {
727          this.start = castToInstant(value); // InstantType
728        } else if (name.equals("end")) {
729          this.end = castToInstant(value); // InstantType
730        } else if (name.equals("participantType")) {
731          this.getParticipantType().add(castToCodeableConcept(value));
732        } else if (name.equals("actor")) {
733          this.actor = castToReference(value); // Reference
734        } else if (name.equals("participantStatus")) {
735          value = new ParticipantStatusEnumFactory().fromType(castToCode(value));
736          this.participantStatus = (Enumeration) value; // Enumeration<ParticipantStatus>
737        } else if (name.equals("comment")) {
738          this.comment = castToString(value); // StringType
739        } else
740          return super.setProperty(name, value);
741        return value;
742      }
743
744      @Override
745      public Base makeProperty(int hash, String name) throws FHIRException {
746        switch (hash) {
747        case -1618432855:  return addIdentifier(); 
748        case -1474995297:  return getAppointment(); 
749        case 109757538:  return getStartElement();
750        case 100571:  return getEndElement();
751        case 841294093:  return addParticipantType(); 
752        case 92645877:  return getActor(); 
753        case 996096261:  return getParticipantStatusElement();
754        case 950398559:  return getCommentElement();
755        default: return super.makeProperty(hash, name);
756        }
757
758      }
759
760      @Override
761      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
762        switch (hash) {
763        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
764        case -1474995297: /*appointment*/ return new String[] {"Reference"};
765        case 109757538: /*start*/ return new String[] {"instant"};
766        case 100571: /*end*/ return new String[] {"instant"};
767        case 841294093: /*participantType*/ return new String[] {"CodeableConcept"};
768        case 92645877: /*actor*/ return new String[] {"Reference"};
769        case 996096261: /*participantStatus*/ return new String[] {"code"};
770        case 950398559: /*comment*/ return new String[] {"string"};
771        default: return super.getTypesForProperty(hash, name);
772        }
773
774      }
775
776      @Override
777      public Base addChild(String name) throws FHIRException {
778        if (name.equals("identifier")) {
779          return addIdentifier();
780        }
781        else if (name.equals("appointment")) {
782          this.appointment = new Reference();
783          return this.appointment;
784        }
785        else if (name.equals("start")) {
786          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.start");
787        }
788        else if (name.equals("end")) {
789          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.end");
790        }
791        else if (name.equals("participantType")) {
792          return addParticipantType();
793        }
794        else if (name.equals("actor")) {
795          this.actor = new Reference();
796          return this.actor;
797        }
798        else if (name.equals("participantStatus")) {
799          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.participantStatus");
800        }
801        else if (name.equals("comment")) {
802          throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.comment");
803        }
804        else
805          return super.addChild(name);
806      }
807
808  public String fhirType() {
809    return "AppointmentResponse";
810
811  }
812
813      public AppointmentResponse copy() {
814        AppointmentResponse dst = new AppointmentResponse();
815        copyValues(dst);
816        if (identifier != null) {
817          dst.identifier = new ArrayList<Identifier>();
818          for (Identifier i : identifier)
819            dst.identifier.add(i.copy());
820        };
821        dst.appointment = appointment == null ? null : appointment.copy();
822        dst.start = start == null ? null : start.copy();
823        dst.end = end == null ? null : end.copy();
824        if (participantType != null) {
825          dst.participantType = new ArrayList<CodeableConcept>();
826          for (CodeableConcept i : participantType)
827            dst.participantType.add(i.copy());
828        };
829        dst.actor = actor == null ? null : actor.copy();
830        dst.participantStatus = participantStatus == null ? null : participantStatus.copy();
831        dst.comment = comment == null ? null : comment.copy();
832        return dst;
833      }
834
835      protected AppointmentResponse typedCopy() {
836        return copy();
837      }
838
839      @Override
840      public boolean equalsDeep(Base other_) {
841        if (!super.equalsDeep(other_))
842          return false;
843        if (!(other_ instanceof AppointmentResponse))
844          return false;
845        AppointmentResponse o = (AppointmentResponse) other_;
846        return compareDeep(identifier, o.identifier, true) && compareDeep(appointment, o.appointment, true)
847           && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(participantType, o.participantType, true)
848           && compareDeep(actor, o.actor, true) && compareDeep(participantStatus, o.participantStatus, true)
849           && compareDeep(comment, o.comment, true);
850      }
851
852      @Override
853      public boolean equalsShallow(Base other_) {
854        if (!super.equalsShallow(other_))
855          return false;
856        if (!(other_ instanceof AppointmentResponse))
857          return false;
858        AppointmentResponse o = (AppointmentResponse) other_;
859        return compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(participantStatus, o.participantStatus, true)
860           && compareValues(comment, o.comment, true);
861      }
862
863      public boolean isEmpty() {
864        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, appointment, start
865          , end, participantType, actor, participantStatus, comment);
866      }
867
868  @Override
869  public ResourceType getResourceType() {
870    return ResourceType.AppointmentResponse;
871   }
872
873 /**
874   * Search parameter: <b>actor</b>
875   * <p>
876   * Description: <b>The Person, Location/HealthcareService or Device that this appointment response replies for</b><br>
877   * Type: <b>reference</b><br>
878   * Path: <b>AppointmentResponse.actor</b><br>
879   * </p>
880   */
881  @SearchParamDefinition(name="actor", path="AppointmentResponse.actor", description="The Person, Location/HealthcareService or Device that this appointment response replies for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, RelatedPerson.class } )
882  public static final String SP_ACTOR = "actor";
883 /**
884   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
885   * <p>
886   * Description: <b>The Person, Location/HealthcareService or Device that this appointment response replies for</b><br>
887   * Type: <b>reference</b><br>
888   * Path: <b>AppointmentResponse.actor</b><br>
889   * </p>
890   */
891  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
892
893/**
894   * Constant for fluent queries to be used to add include statements. Specifies
895   * the path value of "<b>AppointmentResponse:actor</b>".
896   */
897  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("AppointmentResponse:actor").toLocked();
898
899 /**
900   * Search parameter: <b>identifier</b>
901   * <p>
902   * Description: <b>An Identifier in this appointment response</b><br>
903   * Type: <b>token</b><br>
904   * Path: <b>AppointmentResponse.identifier</b><br>
905   * </p>
906   */
907  @SearchParamDefinition(name="identifier", path="AppointmentResponse.identifier", description="An Identifier in this appointment response", type="token" )
908  public static final String SP_IDENTIFIER = "identifier";
909 /**
910   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
911   * <p>
912   * Description: <b>An Identifier in this appointment response</b><br>
913   * Type: <b>token</b><br>
914   * Path: <b>AppointmentResponse.identifier</b><br>
915   * </p>
916   */
917  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
918
919 /**
920   * Search parameter: <b>practitioner</b>
921   * <p>
922   * Description: <b>This Response is for this Practitioner</b><br>
923   * Type: <b>reference</b><br>
924   * Path: <b>AppointmentResponse.actor</b><br>
925   * </p>
926   */
927  @SearchParamDefinition(name="practitioner", path="AppointmentResponse.actor", description="This Response is for this Practitioner", type="reference", target={Practitioner.class } )
928  public static final String SP_PRACTITIONER = "practitioner";
929 /**
930   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
931   * <p>
932   * Description: <b>This Response is for this Practitioner</b><br>
933   * Type: <b>reference</b><br>
934   * Path: <b>AppointmentResponse.actor</b><br>
935   * </p>
936   */
937  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
938
939/**
940   * Constant for fluent queries to be used to add include statements. Specifies
941   * the path value of "<b>AppointmentResponse:practitioner</b>".
942   */
943  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("AppointmentResponse:practitioner").toLocked();
944
945 /**
946   * Search parameter: <b>part-status</b>
947   * <p>
948   * Description: <b>The participants acceptance status for this appointment</b><br>
949   * Type: <b>token</b><br>
950   * Path: <b>AppointmentResponse.participantStatus</b><br>
951   * </p>
952   */
953  @SearchParamDefinition(name="part-status", path="AppointmentResponse.participantStatus", description="The participants acceptance status for this appointment", type="token" )
954  public static final String SP_PART_STATUS = "part-status";
955 /**
956   * <b>Fluent Client</b> search parameter constant for <b>part-status</b>
957   * <p>
958   * Description: <b>The participants acceptance status for this appointment</b><br>
959   * Type: <b>token</b><br>
960   * Path: <b>AppointmentResponse.participantStatus</b><br>
961   * </p>
962   */
963  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PART_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PART_STATUS);
964
965 /**
966   * Search parameter: <b>patient</b>
967   * <p>
968   * Description: <b>This Response is for this Patient</b><br>
969   * Type: <b>reference</b><br>
970   * Path: <b>AppointmentResponse.actor</b><br>
971   * </p>
972   */
973  @SearchParamDefinition(name="patient", path="AppointmentResponse.actor", description="This Response is for this Patient", type="reference", target={Patient.class } )
974  public static final String SP_PATIENT = "patient";
975 /**
976   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
977   * <p>
978   * Description: <b>This Response is for this Patient</b><br>
979   * Type: <b>reference</b><br>
980   * Path: <b>AppointmentResponse.actor</b><br>
981   * </p>
982   */
983  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
984
985/**
986   * Constant for fluent queries to be used to add include statements. Specifies
987   * the path value of "<b>AppointmentResponse:patient</b>".
988   */
989  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AppointmentResponse:patient").toLocked();
990
991 /**
992   * Search parameter: <b>appointment</b>
993   * <p>
994   * Description: <b>The appointment that the response is attached to</b><br>
995   * Type: <b>reference</b><br>
996   * Path: <b>AppointmentResponse.appointment</b><br>
997   * </p>
998   */
999  @SearchParamDefinition(name="appointment", path="AppointmentResponse.appointment", description="The appointment that the response is attached to", type="reference", target={Appointment.class } )
1000  public static final String SP_APPOINTMENT = "appointment";
1001 /**
1002   * <b>Fluent Client</b> search parameter constant for <b>appointment</b>
1003   * <p>
1004   * Description: <b>The appointment that the response is attached to</b><br>
1005   * Type: <b>reference</b><br>
1006   * Path: <b>AppointmentResponse.appointment</b><br>
1007   * </p>
1008   */
1009  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam APPOINTMENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_APPOINTMENT);
1010
1011/**
1012   * Constant for fluent queries to be used to add include statements. Specifies
1013   * the path value of "<b>AppointmentResponse:appointment</b>".
1014   */
1015  public static final ca.uhn.fhir.model.api.Include INCLUDE_APPOINTMENT = new ca.uhn.fhir.model.api.Include("AppointmentResponse:appointment").toLocked();
1016
1017 /**
1018   * Search parameter: <b>location</b>
1019   * <p>
1020   * Description: <b>This Response is for this Location</b><br>
1021   * Type: <b>reference</b><br>
1022   * Path: <b>AppointmentResponse.actor</b><br>
1023   * </p>
1024   */
1025  @SearchParamDefinition(name="location", path="AppointmentResponse.actor", description="This Response is for this Location", type="reference", target={Location.class } )
1026  public static final String SP_LOCATION = "location";
1027 /**
1028   * <b>Fluent Client</b> search parameter constant for <b>location</b>
1029   * <p>
1030   * Description: <b>This Response is for this Location</b><br>
1031   * Type: <b>reference</b><br>
1032   * Path: <b>AppointmentResponse.actor</b><br>
1033   * </p>
1034   */
1035  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
1036
1037/**
1038   * Constant for fluent queries to be used to add include statements. Specifies
1039   * the path value of "<b>AppointmentResponse:location</b>".
1040   */
1041  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("AppointmentResponse:location").toLocked();
1042
1043
1044}
1045