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