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