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