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