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