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