001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * A booking of a healthcare event among patient(s), practitioner(s), related
049 * person(s) and/or device(s) for a specific date/time. This may result in one
050 * or more Encounter(s).
051 */
052@ResourceDef(name = "Appointment", profile = "http://hl7.org/fhir/StructureDefinition/Appointment")
053public class Appointment extends DomainResource {
054
055  public enum AppointmentStatus {
056    /**
057     * None of the participant(s) have finalized their acceptance of the appointment
058     * request, and the start/end time might not be set yet.
059     */
060    PROPOSED,
061    /**
062     * Some or all of the participant(s) have not finalized their acceptance of the
063     * appointment request.
064     */
065    PENDING,
066    /**
067     * All participant(s) have been considered and the appointment is confirmed to
068     * go ahead at the date/times specified.
069     */
070    BOOKED,
071    /**
072     * The patient/patients has/have arrived and is/are waiting to be seen.
073     */
074    ARRIVED,
075    /**
076     * The planning stages of the appointment are now complete, the encounter
077     * resource will exist and will track further status changes. Note that an
078     * encounter may exist before the appointment status is fulfilled for many
079     * reasons.
080     */
081    FULFILLED,
082    /**
083     * The appointment has been cancelled.
084     */
085    CANCELLED,
086    /**
087     * Some or all of the participant(s) have not/did not appear for the appointment
088     * (usually the patient).
089     */
090    NOSHOW,
091    /**
092     * This instance should not have been part of this patient's medical record.
093     */
094    ENTEREDINERROR,
095    /**
096     * When checked in, all pre-encounter administrative work is complete, and the
097     * encounter may begin. (where multiple patients are involved, they are all
098     * present).
099     */
100    CHECKEDIN,
101    /**
102     * The appointment has been placed on a waitlist, to be scheduled/confirmed in
103     * the future when a slot/service is available. A specific time might or might
104     * not be pre-allocated.
105     */
106    WAITLIST,
107    /**
108     * added to help the parsers with the generic types
109     */
110    NULL;
111
112    public static AppointmentStatus fromCode(String codeString) throws FHIRException {
113      if (codeString == null || "".equals(codeString))
114        return null;
115      if ("proposed".equals(codeString))
116        return PROPOSED;
117      if ("pending".equals(codeString))
118        return PENDING;
119      if ("booked".equals(codeString))
120        return BOOKED;
121      if ("arrived".equals(codeString))
122        return ARRIVED;
123      if ("fulfilled".equals(codeString))
124        return FULFILLED;
125      if ("cancelled".equals(codeString))
126        return CANCELLED;
127      if ("noshow".equals(codeString))
128        return NOSHOW;
129      if ("entered-in-error".equals(codeString))
130        return ENTEREDINERROR;
131      if ("checked-in".equals(codeString))
132        return CHECKEDIN;
133      if ("waitlist".equals(codeString))
134        return WAITLIST;
135      if (Configuration.isAcceptInvalidEnums())
136        return null;
137      else
138        throw new FHIRException("Unknown AppointmentStatus code '" + codeString + "'");
139    }
140
141    public String toCode() {
142      switch (this) {
143      case PROPOSED:
144        return "proposed";
145      case PENDING:
146        return "pending";
147      case BOOKED:
148        return "booked";
149      case ARRIVED:
150        return "arrived";
151      case FULFILLED:
152        return "fulfilled";
153      case CANCELLED:
154        return "cancelled";
155      case NOSHOW:
156        return "noshow";
157      case ENTEREDINERROR:
158        return "entered-in-error";
159      case CHECKEDIN:
160        return "checked-in";
161      case WAITLIST:
162        return "waitlist";
163      case NULL:
164        return null;
165      default:
166        return "?";
167      }
168    }
169
170    public String getSystem() {
171      switch (this) {
172      case PROPOSED:
173        return "http://hl7.org/fhir/appointmentstatus";
174      case PENDING:
175        return "http://hl7.org/fhir/appointmentstatus";
176      case BOOKED:
177        return "http://hl7.org/fhir/appointmentstatus";
178      case ARRIVED:
179        return "http://hl7.org/fhir/appointmentstatus";
180      case FULFILLED:
181        return "http://hl7.org/fhir/appointmentstatus";
182      case CANCELLED:
183        return "http://hl7.org/fhir/appointmentstatus";
184      case NOSHOW:
185        return "http://hl7.org/fhir/appointmentstatus";
186      case ENTEREDINERROR:
187        return "http://hl7.org/fhir/appointmentstatus";
188      case CHECKEDIN:
189        return "http://hl7.org/fhir/appointmentstatus";
190      case WAITLIST:
191        return "http://hl7.org/fhir/appointmentstatus";
192      case NULL:
193        return null;
194      default:
195        return "?";
196      }
197    }
198
199    public String getDefinition() {
200      switch (this) {
201      case PROPOSED:
202        return "None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time might not be set yet.";
203      case PENDING:
204        return "Some or all of the participant(s) have not finalized their acceptance of the appointment request.";
205      case BOOKED:
206        return "All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.";
207      case ARRIVED:
208        return "The patient/patients has/have arrived and is/are waiting to be seen.";
209      case FULFILLED:
210        return "The planning stages of the appointment are now complete, the encounter resource will exist and will track further status changes. Note that an encounter may exist before the appointment status is fulfilled for many reasons.";
211      case CANCELLED:
212        return "The appointment has been cancelled.";
213      case NOSHOW:
214        return "Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).";
215      case ENTEREDINERROR:
216        return "This instance should not have been part of this patient's medical record.";
217      case CHECKEDIN:
218        return "When checked in, all pre-encounter administrative work is complete, and the encounter may begin. (where multiple patients are involved, they are all present).";
219      case WAITLIST:
220        return "The appointment has been placed on a waitlist, to be scheduled/confirmed in the future when a slot/service is available.\nA specific time might or might not be pre-allocated.";
221      case NULL:
222        return null;
223      default:
224        return "?";
225      }
226    }
227
228    public String getDisplay() {
229      switch (this) {
230      case PROPOSED:
231        return "Proposed";
232      case PENDING:
233        return "Pending";
234      case BOOKED:
235        return "Booked";
236      case ARRIVED:
237        return "Arrived";
238      case FULFILLED:
239        return "Fulfilled";
240      case CANCELLED:
241        return "Cancelled";
242      case NOSHOW:
243        return "No Show";
244      case ENTEREDINERROR:
245        return "Entered in error";
246      case CHECKEDIN:
247        return "Checked In";
248      case WAITLIST:
249        return "Waitlisted";
250      case NULL:
251        return null;
252      default:
253        return "?";
254      }
255    }
256  }
257
258  public static class AppointmentStatusEnumFactory implements EnumFactory<AppointmentStatus> {
259    public AppointmentStatus fromCode(String codeString) throws IllegalArgumentException {
260      if (codeString == null || "".equals(codeString))
261        if (codeString == null || "".equals(codeString))
262          return null;
263      if ("proposed".equals(codeString))
264        return AppointmentStatus.PROPOSED;
265      if ("pending".equals(codeString))
266        return AppointmentStatus.PENDING;
267      if ("booked".equals(codeString))
268        return AppointmentStatus.BOOKED;
269      if ("arrived".equals(codeString))
270        return AppointmentStatus.ARRIVED;
271      if ("fulfilled".equals(codeString))
272        return AppointmentStatus.FULFILLED;
273      if ("cancelled".equals(codeString))
274        return AppointmentStatus.CANCELLED;
275      if ("noshow".equals(codeString))
276        return AppointmentStatus.NOSHOW;
277      if ("entered-in-error".equals(codeString))
278        return AppointmentStatus.ENTEREDINERROR;
279      if ("checked-in".equals(codeString))
280        return AppointmentStatus.CHECKEDIN;
281      if ("waitlist".equals(codeString))
282        return AppointmentStatus.WAITLIST;
283      throw new IllegalArgumentException("Unknown AppointmentStatus code '" + codeString + "'");
284    }
285
286    public Enumeration<AppointmentStatus> fromType(PrimitiveType<?> code) throws FHIRException {
287      if (code == null)
288        return null;
289      if (code.isEmpty())
290        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NULL, code);
291      String codeString = code.asStringValue();
292      if (codeString == null || "".equals(codeString))
293        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NULL, code);
294      if ("proposed".equals(codeString))
295        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PROPOSED, code);
296      if ("pending".equals(codeString))
297        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PENDING, code);
298      if ("booked".equals(codeString))
299        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.BOOKED, code);
300      if ("arrived".equals(codeString))
301        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ARRIVED, code);
302      if ("fulfilled".equals(codeString))
303        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.FULFILLED, code);
304      if ("cancelled".equals(codeString))
305        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CANCELLED, code);
306      if ("noshow".equals(codeString))
307        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NOSHOW, code);
308      if ("entered-in-error".equals(codeString))
309        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ENTEREDINERROR, code);
310      if ("checked-in".equals(codeString))
311        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CHECKEDIN, code);
312      if ("waitlist".equals(codeString))
313        return new Enumeration<AppointmentStatus>(this, AppointmentStatus.WAITLIST, code);
314      throw new FHIRException("Unknown AppointmentStatus code '" + codeString + "'");
315    }
316
317    public String toCode(AppointmentStatus code) {
318      if (code == AppointmentStatus.PROPOSED)
319        return "proposed";
320      if (code == AppointmentStatus.PENDING)
321        return "pending";
322      if (code == AppointmentStatus.BOOKED)
323        return "booked";
324      if (code == AppointmentStatus.ARRIVED)
325        return "arrived";
326      if (code == AppointmentStatus.FULFILLED)
327        return "fulfilled";
328      if (code == AppointmentStatus.CANCELLED)
329        return "cancelled";
330      if (code == AppointmentStatus.NOSHOW)
331        return "noshow";
332      if (code == AppointmentStatus.ENTEREDINERROR)
333        return "entered-in-error";
334      if (code == AppointmentStatus.CHECKEDIN)
335        return "checked-in";
336      if (code == AppointmentStatus.WAITLIST)
337        return "waitlist";
338      return "?";
339    }
340
341    public String toSystem(AppointmentStatus code) {
342      return code.getSystem();
343    }
344  }
345
346  public enum ParticipantRequired {
347    /**
348     * The participant is required to attend the appointment.
349     */
350    REQUIRED,
351    /**
352     * The participant may optionally attend the appointment.
353     */
354    OPTIONAL,
355    /**
356     * The participant is excluded from the appointment, and might not be informed
357     * of the appointment taking place. (Appointment is about them, not for them -
358     * such as 2 doctors discussing results about a patient's test).
359     */
360    INFORMATIONONLY,
361    /**
362     * added to help the parsers with the generic types
363     */
364    NULL;
365
366    public static ParticipantRequired fromCode(String codeString) throws FHIRException {
367      if (codeString == null || "".equals(codeString))
368        return null;
369      if ("required".equals(codeString))
370        return REQUIRED;
371      if ("optional".equals(codeString))
372        return OPTIONAL;
373      if ("information-only".equals(codeString))
374        return INFORMATIONONLY;
375      if (Configuration.isAcceptInvalidEnums())
376        return null;
377      else
378        throw new FHIRException("Unknown ParticipantRequired code '" + codeString + "'");
379    }
380
381    public String toCode() {
382      switch (this) {
383      case REQUIRED:
384        return "required";
385      case OPTIONAL:
386        return "optional";
387      case INFORMATIONONLY:
388        return "information-only";
389      case NULL:
390        return null;
391      default:
392        return "?";
393      }
394    }
395
396    public String getSystem() {
397      switch (this) {
398      case REQUIRED:
399        return "http://hl7.org/fhir/participantrequired";
400      case OPTIONAL:
401        return "http://hl7.org/fhir/participantrequired";
402      case INFORMATIONONLY:
403        return "http://hl7.org/fhir/participantrequired";
404      case NULL:
405        return null;
406      default:
407        return "?";
408      }
409    }
410
411    public String getDefinition() {
412      switch (this) {
413      case REQUIRED:
414        return "The participant is required to attend the appointment.";
415      case OPTIONAL:
416        return "The participant may optionally attend the appointment.";
417      case INFORMATIONONLY:
418        return "The participant is excluded from the appointment, and might not be informed of the appointment taking place. (Appointment is about them, not for them - such as 2 doctors discussing results about a patient's test).";
419      case NULL:
420        return null;
421      default:
422        return "?";
423      }
424    }
425
426    public String getDisplay() {
427      switch (this) {
428      case REQUIRED:
429        return "Required";
430      case OPTIONAL:
431        return "Optional";
432      case INFORMATIONONLY:
433        return "Information Only";
434      case NULL:
435        return null;
436      default:
437        return "?";
438      }
439    }
440  }
441
442  public static class ParticipantRequiredEnumFactory implements EnumFactory<ParticipantRequired> {
443    public ParticipantRequired fromCode(String codeString) throws IllegalArgumentException {
444      if (codeString == null || "".equals(codeString))
445        if (codeString == null || "".equals(codeString))
446          return null;
447      if ("required".equals(codeString))
448        return ParticipantRequired.REQUIRED;
449      if ("optional".equals(codeString))
450        return ParticipantRequired.OPTIONAL;
451      if ("information-only".equals(codeString))
452        return ParticipantRequired.INFORMATIONONLY;
453      throw new IllegalArgumentException("Unknown ParticipantRequired code '" + codeString + "'");
454    }
455
456    public Enumeration<ParticipantRequired> fromType(PrimitiveType<?> code) throws FHIRException {
457      if (code == null)
458        return null;
459      if (code.isEmpty())
460        return new Enumeration<ParticipantRequired>(this, ParticipantRequired.NULL, code);
461      String codeString = code.asStringValue();
462      if (codeString == null || "".equals(codeString))
463        return new Enumeration<ParticipantRequired>(this, ParticipantRequired.NULL, code);
464      if ("required".equals(codeString))
465        return new Enumeration<ParticipantRequired>(this, ParticipantRequired.REQUIRED, code);
466      if ("optional".equals(codeString))
467        return new Enumeration<ParticipantRequired>(this, ParticipantRequired.OPTIONAL, code);
468      if ("information-only".equals(codeString))
469        return new Enumeration<ParticipantRequired>(this, ParticipantRequired.INFORMATIONONLY, code);
470      throw new FHIRException("Unknown ParticipantRequired code '" + codeString + "'");
471    }
472
473    public String toCode(ParticipantRequired code) {
474      if (code == ParticipantRequired.REQUIRED)
475        return "required";
476      if (code == ParticipantRequired.OPTIONAL)
477        return "optional";
478      if (code == ParticipantRequired.INFORMATIONONLY)
479        return "information-only";
480      return "?";
481    }
482
483    public String toSystem(ParticipantRequired code) {
484      return code.getSystem();
485    }
486  }
487
488  public enum ParticipationStatus {
489    /**
490     * The participant has accepted the appointment.
491     */
492    ACCEPTED,
493    /**
494     * The participant has declined the appointment and will not participate in the
495     * appointment.
496     */
497    DECLINED,
498    /**
499     * The participant has tentatively accepted the appointment. This could be
500     * automatically created by a system and requires further processing before it
501     * can be accepted. There is no commitment that attendance will occur.
502     */
503    TENTATIVE,
504    /**
505     * The participant needs to indicate if they accept the appointment by changing
506     * this status to one of the other statuses.
507     */
508    NEEDSACTION,
509    /**
510     * added to help the parsers with the generic types
511     */
512    NULL;
513
514    public static ParticipationStatus fromCode(String codeString) throws FHIRException {
515      if (codeString == null || "".equals(codeString))
516        return null;
517      if ("accepted".equals(codeString))
518        return ACCEPTED;
519      if ("declined".equals(codeString))
520        return DECLINED;
521      if ("tentative".equals(codeString))
522        return TENTATIVE;
523      if ("needs-action".equals(codeString))
524        return NEEDSACTION;
525      if (Configuration.isAcceptInvalidEnums())
526        return null;
527      else
528        throw new FHIRException("Unknown ParticipationStatus code '" + codeString + "'");
529    }
530
531    public String toCode() {
532      switch (this) {
533      case ACCEPTED:
534        return "accepted";
535      case DECLINED:
536        return "declined";
537      case TENTATIVE:
538        return "tentative";
539      case NEEDSACTION:
540        return "needs-action";
541      case NULL:
542        return null;
543      default:
544        return "?";
545      }
546    }
547
548    public String getSystem() {
549      switch (this) {
550      case ACCEPTED:
551        return "http://hl7.org/fhir/participationstatus";
552      case DECLINED:
553        return "http://hl7.org/fhir/participationstatus";
554      case TENTATIVE:
555        return "http://hl7.org/fhir/participationstatus";
556      case NEEDSACTION:
557        return "http://hl7.org/fhir/participationstatus";
558      case NULL:
559        return null;
560      default:
561        return "?";
562      }
563    }
564
565    public String getDefinition() {
566      switch (this) {
567      case ACCEPTED:
568        return "The participant has accepted the appointment.";
569      case DECLINED:
570        return "The participant has declined the appointment and will not participate in the appointment.";
571      case TENTATIVE:
572        return "The participant has  tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur.";
573      case NEEDSACTION:
574        return "The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.";
575      case NULL:
576        return null;
577      default:
578        return "?";
579      }
580    }
581
582    public String getDisplay() {
583      switch (this) {
584      case ACCEPTED:
585        return "Accepted";
586      case DECLINED:
587        return "Declined";
588      case TENTATIVE:
589        return "Tentative";
590      case NEEDSACTION:
591        return "Needs Action";
592      case NULL:
593        return null;
594      default:
595        return "?";
596      }
597    }
598  }
599
600  public static class ParticipationStatusEnumFactory implements EnumFactory<ParticipationStatus> {
601    public ParticipationStatus fromCode(String codeString) throws IllegalArgumentException {
602      if (codeString == null || "".equals(codeString))
603        if (codeString == null || "".equals(codeString))
604          return null;
605      if ("accepted".equals(codeString))
606        return ParticipationStatus.ACCEPTED;
607      if ("declined".equals(codeString))
608        return ParticipationStatus.DECLINED;
609      if ("tentative".equals(codeString))
610        return ParticipationStatus.TENTATIVE;
611      if ("needs-action".equals(codeString))
612        return ParticipationStatus.NEEDSACTION;
613      throw new IllegalArgumentException("Unknown ParticipationStatus code '" + codeString + "'");
614    }
615
616    public Enumeration<ParticipationStatus> fromType(PrimitiveType<?> code) throws FHIRException {
617      if (code == null)
618        return null;
619      if (code.isEmpty())
620        return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NULL, code);
621      String codeString = code.asStringValue();
622      if (codeString == null || "".equals(codeString))
623        return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NULL, code);
624      if ("accepted".equals(codeString))
625        return new Enumeration<ParticipationStatus>(this, ParticipationStatus.ACCEPTED, code);
626      if ("declined".equals(codeString))
627        return new Enumeration<ParticipationStatus>(this, ParticipationStatus.DECLINED, code);
628      if ("tentative".equals(codeString))
629        return new Enumeration<ParticipationStatus>(this, ParticipationStatus.TENTATIVE, code);
630      if ("needs-action".equals(codeString))
631        return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NEEDSACTION, code);
632      throw new FHIRException("Unknown ParticipationStatus code '" + codeString + "'");
633    }
634
635    public String toCode(ParticipationStatus code) {
636      if (code == ParticipationStatus.ACCEPTED)
637        return "accepted";
638      if (code == ParticipationStatus.DECLINED)
639        return "declined";
640      if (code == ParticipationStatus.TENTATIVE)
641        return "tentative";
642      if (code == ParticipationStatus.NEEDSACTION)
643        return "needs-action";
644      return "?";
645    }
646
647    public String toSystem(ParticipationStatus code) {
648      return code.getSystem();
649    }
650  }
651
652  @Block()
653  public static class AppointmentParticipantComponent extends BackboneElement implements IBaseBackboneElement {
654    /**
655     * Role of participant in the appointment.
656     */
657    @Child(name = "type", type = {
658        CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
659    @Description(shortDefinition = "Role of participant in the appointment", formalDefinition = "Role of participant in the appointment.")
660    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/encounter-participant-type")
661    protected List<CodeableConcept> type;
662
663    /**
664     * A Person, Location/HealthcareService or Device that is participating in the
665     * appointment.
666     */
667    @Child(name = "actor", type = { Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class,
668        Device.class, HealthcareService.class,
669        Location.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
670    @Description(shortDefinition = "Person, Location/HealthcareService or Device", formalDefinition = "A Person, Location/HealthcareService or Device that is participating in the appointment.")
671    protected Reference actor;
672
673    /**
674     * The actual object that is the target of the reference (A Person,
675     * Location/HealthcareService or Device that is participating in the
676     * appointment.)
677     */
678    protected Resource actorTarget;
679
680    /**
681     * Whether this participant is required to be present at the meeting. This
682     * covers a use-case where two doctors need to meet to discuss the results for a
683     * specific patient, and the patient is not required to be present.
684     */
685    @Child(name = "required", type = { CodeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
686    @Description(shortDefinition = "required | optional | information-only", formalDefinition = "Whether this participant is required to be present at the meeting. This covers a use-case where two doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.")
687    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/participantrequired")
688    protected Enumeration<ParticipantRequired> required;
689
690    /**
691     * Participation status of the actor.
692     */
693    @Child(name = "status", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
694    @Description(shortDefinition = "accepted | declined | tentative | needs-action", formalDefinition = "Participation status of the actor.")
695    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/participationstatus")
696    protected Enumeration<ParticipationStatus> status;
697
698    /**
699     * Participation period of the actor.
700     */
701    @Child(name = "period", type = { Period.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
702    @Description(shortDefinition = "Participation period of the actor", formalDefinition = "Participation period of the actor.")
703    protected Period period;
704
705    private static final long serialVersionUID = -1939292177L;
706
707    /**
708     * Constructor
709     */
710    public AppointmentParticipantComponent() {
711      super();
712    }
713
714    /**
715     * Constructor
716     */
717    public AppointmentParticipantComponent(Enumeration<ParticipationStatus> status) {
718      super();
719      this.status = status;
720    }
721
722    /**
723     * @return {@link #type} (Role of participant in the appointment.)
724     */
725    public List<CodeableConcept> getType() {
726      if (this.type == null)
727        this.type = new ArrayList<CodeableConcept>();
728      return this.type;
729    }
730
731    /**
732     * @return Returns a reference to <code>this</code> for easy method chaining
733     */
734    public AppointmentParticipantComponent setType(List<CodeableConcept> theType) {
735      this.type = theType;
736      return this;
737    }
738
739    public boolean hasType() {
740      if (this.type == null)
741        return false;
742      for (CodeableConcept item : this.type)
743        if (!item.isEmpty())
744          return true;
745      return false;
746    }
747
748    public CodeableConcept addType() { // 3
749      CodeableConcept t = new CodeableConcept();
750      if (this.type == null)
751        this.type = new ArrayList<CodeableConcept>();
752      this.type.add(t);
753      return t;
754    }
755
756    public AppointmentParticipantComponent addType(CodeableConcept t) { // 3
757      if (t == null)
758        return this;
759      if (this.type == null)
760        this.type = new ArrayList<CodeableConcept>();
761      this.type.add(t);
762      return this;
763    }
764
765    /**
766     * @return The first repetition of repeating field {@link #type}, creating it if
767     *         it does not already exist
768     */
769    public CodeableConcept getTypeFirstRep() {
770      if (getType().isEmpty()) {
771        addType();
772      }
773      return getType().get(0);
774    }
775
776    /**
777     * @return {@link #actor} (A Person, Location/HealthcareService or Device that
778     *         is participating in the appointment.)
779     */
780    public Reference getActor() {
781      if (this.actor == null)
782        if (Configuration.errorOnAutoCreate())
783          throw new Error("Attempt to auto-create AppointmentParticipantComponent.actor");
784        else if (Configuration.doAutoCreate())
785          this.actor = new Reference(); // cc
786      return this.actor;
787    }
788
789    public boolean hasActor() {
790      return this.actor != null && !this.actor.isEmpty();
791    }
792
793    /**
794     * @param value {@link #actor} (A Person, Location/HealthcareService or Device
795     *              that is participating in the appointment.)
796     */
797    public AppointmentParticipantComponent setActor(Reference value) {
798      this.actor = value;
799      return this;
800    }
801
802    /**
803     * @return {@link #actor} The actual object that is the target of the reference.
804     *         The reference library doesn't populate this, but you can use it to
805     *         hold the resource if you resolve it. (A Person,
806     *         Location/HealthcareService or Device that is participating in the
807     *         appointment.)
808     */
809    public Resource getActorTarget() {
810      return this.actorTarget;
811    }
812
813    /**
814     * @param value {@link #actor} The actual object that is the target of the
815     *              reference. The reference library doesn't use these, but you can
816     *              use it to hold the resource if you resolve it. (A Person,
817     *              Location/HealthcareService or Device that is participating in
818     *              the appointment.)
819     */
820    public AppointmentParticipantComponent setActorTarget(Resource value) {
821      this.actorTarget = value;
822      return this;
823    }
824
825    /**
826     * @return {@link #required} (Whether this participant is required to be present
827     *         at the meeting. This covers a use-case where two doctors need to meet
828     *         to discuss the results for a specific patient, and the patient is not
829     *         required to be present.). This is the underlying object with id,
830     *         value and extensions. The accessor "getRequired" gives direct access
831     *         to the value
832     */
833    public Enumeration<ParticipantRequired> getRequiredElement() {
834      if (this.required == null)
835        if (Configuration.errorOnAutoCreate())
836          throw new Error("Attempt to auto-create AppointmentParticipantComponent.required");
837        else if (Configuration.doAutoCreate())
838          this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory()); // bb
839      return this.required;
840    }
841
842    public boolean hasRequiredElement() {
843      return this.required != null && !this.required.isEmpty();
844    }
845
846    public boolean hasRequired() {
847      return this.required != null && !this.required.isEmpty();
848    }
849
850    /**
851     * @param value {@link #required} (Whether this participant is required to be
852     *              present at the meeting. This covers a use-case where two doctors
853     *              need to meet to discuss the results for a specific patient, and
854     *              the patient is not required to be present.). This is the
855     *              underlying object with id, value and extensions. The accessor
856     *              "getRequired" gives direct access to the value
857     */
858    public AppointmentParticipantComponent setRequiredElement(Enumeration<ParticipantRequired> value) {
859      this.required = value;
860      return this;
861    }
862
863    /**
864     * @return Whether this participant is required to be present at the meeting.
865     *         This covers a use-case where two doctors need to meet to discuss the
866     *         results for a specific patient, and the patient is not required to be
867     *         present.
868     */
869    public ParticipantRequired getRequired() {
870      return this.required == null ? null : this.required.getValue();
871    }
872
873    /**
874     * @param value Whether this participant is required to be present at the
875     *              meeting. This covers a use-case where two doctors need to meet
876     *              to discuss the results for a specific patient, and the patient
877     *              is not required to be present.
878     */
879    public AppointmentParticipantComponent setRequired(ParticipantRequired value) {
880      if (value == null)
881        this.required = null;
882      else {
883        if (this.required == null)
884          this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory());
885        this.required.setValue(value);
886      }
887      return this;
888    }
889
890    /**
891     * @return {@link #status} (Participation status of the actor.). This is the
892     *         underlying object with id, value and extensions. The accessor
893     *         "getStatus" gives direct access to the value
894     */
895    public Enumeration<ParticipationStatus> getStatusElement() {
896      if (this.status == null)
897        if (Configuration.errorOnAutoCreate())
898          throw new Error("Attempt to auto-create AppointmentParticipantComponent.status");
899        else if (Configuration.doAutoCreate())
900          this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory()); // bb
901      return this.status;
902    }
903
904    public boolean hasStatusElement() {
905      return this.status != null && !this.status.isEmpty();
906    }
907
908    public boolean hasStatus() {
909      return this.status != null && !this.status.isEmpty();
910    }
911
912    /**
913     * @param value {@link #status} (Participation status of the actor.). This is
914     *              the underlying object with id, value and extensions. The
915     *              accessor "getStatus" gives direct access to the value
916     */
917    public AppointmentParticipantComponent setStatusElement(Enumeration<ParticipationStatus> value) {
918      this.status = value;
919      return this;
920    }
921
922    /**
923     * @return Participation status of the actor.
924     */
925    public ParticipationStatus getStatus() {
926      return this.status == null ? null : this.status.getValue();
927    }
928
929    /**
930     * @param value Participation status of the actor.
931     */
932    public AppointmentParticipantComponent setStatus(ParticipationStatus value) {
933      if (this.status == null)
934        this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory());
935      this.status.setValue(value);
936      return this;
937    }
938
939    /**
940     * @return {@link #period} (Participation period of the actor.)
941     */
942    public Period getPeriod() {
943      if (this.period == null)
944        if (Configuration.errorOnAutoCreate())
945          throw new Error("Attempt to auto-create AppointmentParticipantComponent.period");
946        else if (Configuration.doAutoCreate())
947          this.period = new Period(); // cc
948      return this.period;
949    }
950
951    public boolean hasPeriod() {
952      return this.period != null && !this.period.isEmpty();
953    }
954
955    /**
956     * @param value {@link #period} (Participation period of the actor.)
957     */
958    public AppointmentParticipantComponent setPeriod(Period value) {
959      this.period = value;
960      return this;
961    }
962
963    protected void listChildren(List<Property> children) {
964      super.listChildren(children);
965      children.add(new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0,
966          java.lang.Integer.MAX_VALUE, type));
967      children.add(new Property("actor",
968          "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)",
969          "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor));
970      children.add(new Property("required", "code",
971          "Whether this participant is required to be present at the meeting. This covers a use-case where two doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.",
972          0, 1, required));
973      children.add(new Property("status", "code", "Participation status of the actor.", 0, 1, status));
974      children.add(new Property("period", "Period", "Participation period of the actor.", 0, 1, period));
975    }
976
977    @Override
978    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
979      switch (_hash) {
980      case 3575610:
981        /* type */ return new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0,
982            java.lang.Integer.MAX_VALUE, type);
983      case 92645877:
984        /* actor */ return new Property("actor",
985            "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)",
986            "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor);
987      case -393139297:
988        /* required */ return new Property("required", "code",
989            "Whether this participant is required to be present at the meeting. This covers a use-case where two doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.",
990            0, 1, required);
991      case -892481550:
992        /* status */ return new Property("status", "code", "Participation status of the actor.", 0, 1, status);
993      case -991726143:
994        /* period */ return new Property("period", "Period", "Participation period of the actor.", 0, 1, period);
995      default:
996        return super.getNamedProperty(_hash, _name, _checkValid);
997      }
998
999    }
1000
1001    @Override
1002    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1003      switch (hash) {
1004      case 3575610:
1005        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1006      case 92645877:
1007        /* actor */ return this.actor == null ? new Base[0] : new Base[] { this.actor }; // Reference
1008      case -393139297:
1009        /* required */ return this.required == null ? new Base[0] : new Base[] { this.required }; // Enumeration<ParticipantRequired>
1010      case -892481550:
1011        /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ParticipationStatus>
1012      case -991726143:
1013        /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
1014      default:
1015        return super.getProperty(hash, name, checkValid);
1016      }
1017
1018    }
1019
1020    @Override
1021    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1022      switch (hash) {
1023      case 3575610: // type
1024        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1025        return value;
1026      case 92645877: // actor
1027        this.actor = castToReference(value); // Reference
1028        return value;
1029      case -393139297: // required
1030        value = new ParticipantRequiredEnumFactory().fromType(castToCode(value));
1031        this.required = (Enumeration) value; // Enumeration<ParticipantRequired>
1032        return value;
1033      case -892481550: // status
1034        value = new ParticipationStatusEnumFactory().fromType(castToCode(value));
1035        this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
1036        return value;
1037      case -991726143: // period
1038        this.period = castToPeriod(value); // Period
1039        return value;
1040      default:
1041        return super.setProperty(hash, name, value);
1042      }
1043
1044    }
1045
1046    @Override
1047    public Base setProperty(String name, Base value) throws FHIRException {
1048      if (name.equals("type")) {
1049        this.getType().add(castToCodeableConcept(value));
1050      } else if (name.equals("actor")) {
1051        this.actor = castToReference(value); // Reference
1052      } else if (name.equals("required")) {
1053        value = new ParticipantRequiredEnumFactory().fromType(castToCode(value));
1054        this.required = (Enumeration) value; // Enumeration<ParticipantRequired>
1055      } else if (name.equals("status")) {
1056        value = new ParticipationStatusEnumFactory().fromType(castToCode(value));
1057        this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
1058      } else if (name.equals("period")) {
1059        this.period = castToPeriod(value); // Period
1060      } else
1061        return super.setProperty(name, value);
1062      return value;
1063    }
1064
1065  @Override
1066  public void removeChild(String name, Base value) throws FHIRException {
1067      if (name.equals("type")) {
1068        this.getType().remove(castToCodeableConcept(value));
1069      } else if (name.equals("actor")) {
1070        this.actor = null;
1071      } else if (name.equals("required")) {
1072        this.required = null;
1073      } else if (name.equals("status")) {
1074        this.status = null;
1075      } else if (name.equals("period")) {
1076        this.period = null;
1077      } else
1078        super.removeChild(name, value);
1079      
1080    }
1081
1082    @Override
1083    public Base makeProperty(int hash, String name) throws FHIRException {
1084      switch (hash) {
1085      case 3575610:
1086        return addType();
1087      case 92645877:
1088        return getActor();
1089      case -393139297:
1090        return getRequiredElement();
1091      case -892481550:
1092        return getStatusElement();
1093      case -991726143:
1094        return getPeriod();
1095      default:
1096        return super.makeProperty(hash, name);
1097      }
1098
1099    }
1100
1101    @Override
1102    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1103      switch (hash) {
1104      case 3575610:
1105        /* type */ return new String[] { "CodeableConcept" };
1106      case 92645877:
1107        /* actor */ return new String[] { "Reference" };
1108      case -393139297:
1109        /* required */ return new String[] { "code" };
1110      case -892481550:
1111        /* status */ return new String[] { "code" };
1112      case -991726143:
1113        /* period */ return new String[] { "Period" };
1114      default:
1115        return super.getTypesForProperty(hash, name);
1116      }
1117
1118    }
1119
1120    @Override
1121    public Base addChild(String name) throws FHIRException {
1122      if (name.equals("type")) {
1123        return addType();
1124      } else if (name.equals("actor")) {
1125        this.actor = new Reference();
1126        return this.actor;
1127      } else if (name.equals("required")) {
1128        throw new FHIRException("Cannot call addChild on a singleton property Appointment.required");
1129      } else if (name.equals("status")) {
1130        throw new FHIRException("Cannot call addChild on a singleton property Appointment.status");
1131      } else if (name.equals("period")) {
1132        this.period = new Period();
1133        return this.period;
1134      } else
1135        return super.addChild(name);
1136    }
1137
1138    public AppointmentParticipantComponent copy() {
1139      AppointmentParticipantComponent dst = new AppointmentParticipantComponent();
1140      copyValues(dst);
1141      return dst;
1142    }
1143
1144    public void copyValues(AppointmentParticipantComponent dst) {
1145      super.copyValues(dst);
1146      if (type != null) {
1147        dst.type = new ArrayList<CodeableConcept>();
1148        for (CodeableConcept i : type)
1149          dst.type.add(i.copy());
1150      }
1151      ;
1152      dst.actor = actor == null ? null : actor.copy();
1153      dst.required = required == null ? null : required.copy();
1154      dst.status = status == null ? null : status.copy();
1155      dst.period = period == null ? null : period.copy();
1156    }
1157
1158    @Override
1159    public boolean equalsDeep(Base other_) {
1160      if (!super.equalsDeep(other_))
1161        return false;
1162      if (!(other_ instanceof AppointmentParticipantComponent))
1163        return false;
1164      AppointmentParticipantComponent o = (AppointmentParticipantComponent) other_;
1165      return compareDeep(type, o.type, true) && compareDeep(actor, o.actor, true)
1166          && compareDeep(required, o.required, true) && compareDeep(status, o.status, true)
1167          && compareDeep(period, o.period, true);
1168    }
1169
1170    @Override
1171    public boolean equalsShallow(Base other_) {
1172      if (!super.equalsShallow(other_))
1173        return false;
1174      if (!(other_ instanceof AppointmentParticipantComponent))
1175        return false;
1176      AppointmentParticipantComponent o = (AppointmentParticipantComponent) other_;
1177      return compareValues(required, o.required, true) && compareValues(status, o.status, true);
1178    }
1179
1180    public boolean isEmpty() {
1181      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, actor, required, status, period);
1182    }
1183
1184    public String fhirType() {
1185      return "Appointment.participant";
1186
1187    }
1188
1189  }
1190
1191  /**
1192   * This records identifiers associated with this appointment concern that are
1193   * defined by business processes and/or used to refer to it when a direct URL
1194   * reference to the resource itself is not appropriate (e.g. in CDA documents,
1195   * or in written / printed documentation).
1196   */
1197  @Child(name = "identifier", type = {
1198      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1199  @Description(shortDefinition = "External Ids for this item", formalDefinition = "This records identifiers associated with this appointment 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 (e.g. in CDA documents, or in written / printed documentation).")
1200  protected List<Identifier> identifier;
1201
1202  /**
1203   * The overall status of the Appointment. Each of the participants has their own
1204   * participation status which indicates their involvement in the process,
1205   * however this status indicates the shared status.
1206   */
1207  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
1208  @Description(shortDefinition = "proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist", formalDefinition = "The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.")
1209  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/appointmentstatus")
1210  protected Enumeration<AppointmentStatus> status;
1211
1212  /**
1213   * The coded reason for the appointment being cancelled. This is often used in
1214   * reporting/billing/futher processing to determine if further actions are
1215   * required, or specific fees apply.
1216   */
1217  @Child(name = "cancelationReason", type = {
1218      CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1219  @Description(shortDefinition = "The coded reason for the appointment being cancelled", formalDefinition = "The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.")
1220  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/appointment-cancellation-reason")
1221  protected CodeableConcept cancelationReason;
1222
1223  /**
1224   * A broad categorization of the service that is to be performed during this
1225   * appointment.
1226   */
1227  @Child(name = "serviceCategory", type = {
1228      CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1229  @Description(shortDefinition = "A broad categorization of the service that is to be performed during this appointment", formalDefinition = "A broad categorization of the service that is to be performed during this appointment.")
1230  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-category")
1231  protected List<CodeableConcept> serviceCategory;
1232
1233  /**
1234   * The specific service that is to be performed during this appointment.
1235   */
1236  @Child(name = "serviceType", type = {
1237      CodeableConcept.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1238  @Description(shortDefinition = "The specific service that is to be performed during this appointment", formalDefinition = "The specific service that is to be performed during this appointment.")
1239  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-type")
1240  protected List<CodeableConcept> serviceType;
1241
1242  /**
1243   * The specialty of a practitioner that would be required to perform the service
1244   * requested in this appointment.
1245   */
1246  @Child(name = "specialty", type = {
1247      CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1248  @Description(shortDefinition = "The specialty of a practitioner that would be required to perform the service requested in this appointment", formalDefinition = "The specialty of a practitioner that would be required to perform the service requested in this appointment.")
1249  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/c80-practice-codes")
1250  protected List<CodeableConcept> specialty;
1251
1252  /**
1253   * The style of appointment or patient that has been booked in the slot (not
1254   * service type).
1255   */
1256  @Child(name = "appointmentType", type = {
1257      CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1258  @Description(shortDefinition = "The style of appointment or patient that has been booked in the slot (not service type)", formalDefinition = "The style of appointment or patient that has been booked in the slot (not service type).")
1259  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v2-0276")
1260  protected CodeableConcept appointmentType;
1261
1262  /**
1263   * The coded reason that this appointment is being scheduled. This is more
1264   * clinical than administrative.
1265   */
1266  @Child(name = "reasonCode", type = {
1267      CodeableConcept.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1268  @Description(shortDefinition = "Coded reason this appointment is scheduled", formalDefinition = "The coded reason that this appointment is being scheduled. This is more clinical than administrative.")
1269  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/encounter-reason")
1270  protected List<CodeableConcept> reasonCode;
1271
1272  /**
1273   * Reason the appointment has been scheduled to take place, as specified using
1274   * information from another resource. When the patient arrives and the encounter
1275   * begins it may be used as the admission diagnosis. The indication will
1276   * typically be a Condition (with other resources referenced in the
1277   * evidence.detail), or a Procedure.
1278   */
1279  @Child(name = "reasonReference", type = { Condition.class, Procedure.class, Observation.class,
1280      ImmunizationRecommendation.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1281  @Description(shortDefinition = "Reason the appointment is to take place (resource)", formalDefinition = "Reason the appointment has been scheduled to take place, as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.")
1282  protected List<Reference> reasonReference;
1283  /**
1284   * The actual objects that are the target of the reference (Reason the
1285   * appointment has been scheduled to take place, as specified using information
1286   * from another resource. When the patient arrives and the encounter begins it
1287   * may be used as the admission diagnosis. The indication will typically be a
1288   * Condition (with other resources referenced in the evidence.detail), or a
1289   * Procedure.)
1290   */
1291  protected List<Resource> reasonReferenceTarget;
1292
1293  /**
1294   * The priority of the appointment. Can be used to make informed decisions if
1295   * needing to re-prioritize appointments. (The iCal Standard specifies 0 as
1296   * undefined, 1 as highest, 9 as lowest priority).
1297   */
1298  @Child(name = "priority", type = {
1299      UnsignedIntType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
1300  @Description(shortDefinition = "Used to make informed decisions if needing to re-prioritize", formalDefinition = "The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).")
1301  protected UnsignedIntType priority;
1302
1303  /**
1304   * The brief description of the appointment as would be shown on a subject line
1305   * in a meeting request, or appointment list. Detailed or expanded information
1306   * should be put in the comment field.
1307   */
1308  @Child(name = "description", type = {
1309      StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
1310  @Description(shortDefinition = "Shown on a subject line in a meeting request, or appointment list", formalDefinition = "The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.")
1311  protected StringType description;
1312
1313  /**
1314   * Additional information to support the appointment provided when making the
1315   * appointment.
1316   */
1317  @Child(name = "supportingInformation", type = {
1318      Reference.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1319  @Description(shortDefinition = "Additional information to support the appointment", formalDefinition = "Additional information to support the appointment provided when making the appointment.")
1320  protected List<Reference> supportingInformation;
1321  /**
1322   * The actual objects that are the target of the reference (Additional
1323   * information to support the appointment provided when making the appointment.)
1324   */
1325  protected List<Resource> supportingInformationTarget;
1326
1327  /**
1328   * Date/Time that the appointment is to take place.
1329   */
1330  @Child(name = "start", type = { InstantType.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
1331  @Description(shortDefinition = "When appointment is to take place", formalDefinition = "Date/Time that the appointment is to take place.")
1332  protected InstantType start;
1333
1334  /**
1335   * Date/Time that the appointment is to conclude.
1336   */
1337  @Child(name = "end", type = { InstantType.class }, order = 13, min = 0, max = 1, modifier = false, summary = true)
1338  @Description(shortDefinition = "When appointment is to conclude", formalDefinition = "Date/Time that the appointment is to conclude.")
1339  protected InstantType end;
1340
1341  /**
1342   * Number of minutes that the appointment is to take. This can be less than the
1343   * duration between the start and end times. For example, where the actual time
1344   * of appointment is only an estimate or if a 30 minute appointment is being
1345   * requested, but any time would work. Also, if there is, for example, a planned
1346   * 15 minute break in the middle of a long appointment, the duration may be 15
1347   * minutes less than the difference between the start and end.
1348   */
1349  @Child(name = "minutesDuration", type = {
1350      PositiveIntType.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
1351  @Description(shortDefinition = "Can be less than start/end (e.g. estimate)", formalDefinition = "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.")
1352  protected PositiveIntType minutesDuration;
1353
1354  /**
1355   * The slots from the participants' schedules that will be filled by the
1356   * appointment.
1357   */
1358  @Child(name = "slot", type = {
1359      Slot.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1360  @Description(shortDefinition = "The slots that this appointment is filling", formalDefinition = "The slots from the participants' schedules that will be filled by the appointment.")
1361  protected List<Reference> slot;
1362  /**
1363   * The actual objects that are the target of the reference (The slots from the
1364   * participants' schedules that will be filled by the appointment.)
1365   */
1366  protected List<Slot> slotTarget;
1367
1368  /**
1369   * The date that this appointment was initially created. This could be different
1370   * to the meta.lastModified value on the initial entry, as this could have been
1371   * before the resource was created on the FHIR server, and should remain
1372   * unchanged over the lifespan of the appointment.
1373   */
1374  @Child(name = "created", type = {
1375      DateTimeType.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
1376  @Description(shortDefinition = "The date that this appointment was initially created", formalDefinition = "The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.")
1377  protected DateTimeType created;
1378
1379  /**
1380   * Additional comments about the appointment.
1381   */
1382  @Child(name = "comment", type = { StringType.class }, order = 17, min = 0, max = 1, modifier = false, summary = false)
1383  @Description(shortDefinition = "Additional comments", formalDefinition = "Additional comments about the appointment.")
1384  protected StringType comment;
1385
1386  /**
1387   * While Appointment.comment contains information for internal use,
1388   * Appointment.patientInstructions is used to capture patient facing information
1389   * about the Appointment (e.g. please bring your referral or fast from 8pm night
1390   * before).
1391   */
1392  @Child(name = "patientInstruction", type = {
1393      StringType.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
1394  @Description(shortDefinition = "Detailed information and instructions for the patient", formalDefinition = "While Appointment.comment contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).")
1395  protected StringType patientInstruction;
1396
1397  /**
1398   * The service request this appointment is allocated to assess (e.g. incoming
1399   * referral or procedure request).
1400   */
1401  @Child(name = "basedOn", type = {
1402      ServiceRequest.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1403  @Description(shortDefinition = "The service request this appointment is allocated to assess", formalDefinition = "The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).")
1404  protected List<Reference> basedOn;
1405  /**
1406   * The actual objects that are the target of the reference (The service request
1407   * this appointment is allocated to assess (e.g. incoming referral or procedure
1408   * request).)
1409   */
1410  protected List<ServiceRequest> basedOnTarget;
1411
1412  /**
1413   * List of participants involved in the appointment.
1414   */
1415  @Child(name = "participant", type = {}, order = 20, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1416  @Description(shortDefinition = "Participants involved in appointment", formalDefinition = "List of participants involved in the appointment.")
1417  protected List<AppointmentParticipantComponent> participant;
1418
1419  /**
1420   * A set of date ranges (potentially including times) that the appointment is
1421   * preferred to be scheduled within.
1422   * 
1423   * The duration (usually in minutes) could also be provided to indicate the
1424   * length of the appointment to fill and populate the start/end times for the
1425   * actual allocated time. However, in other situations the duration may be
1426   * calculated by the scheduling system.
1427   */
1428  @Child(name = "requestedPeriod", type = {
1429      Period.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1430  @Description(shortDefinition = "Potential date/time interval(s) requested to allocate the appointment within", formalDefinition = "A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.\n\nThe duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.")
1431  protected List<Period> requestedPeriod;
1432
1433  private static final long serialVersionUID = -1096822339L;
1434
1435  /**
1436   * Constructor
1437   */
1438  public Appointment() {
1439    super();
1440  }
1441
1442  /**
1443   * Constructor
1444   */
1445  public Appointment(Enumeration<AppointmentStatus> status) {
1446    super();
1447    this.status = status;
1448  }
1449
1450  /**
1451   * @return {@link #identifier} (This records identifiers associated with this
1452   *         appointment concern that are defined by business processes and/or
1453   *         used to refer to it when a direct URL reference to the resource
1454   *         itself is not appropriate (e.g. in CDA documents, or in written /
1455   *         printed documentation).)
1456   */
1457  public List<Identifier> getIdentifier() {
1458    if (this.identifier == null)
1459      this.identifier = new ArrayList<Identifier>();
1460    return this.identifier;
1461  }
1462
1463  /**
1464   * @return Returns a reference to <code>this</code> for easy method chaining
1465   */
1466  public Appointment setIdentifier(List<Identifier> theIdentifier) {
1467    this.identifier = theIdentifier;
1468    return this;
1469  }
1470
1471  public boolean hasIdentifier() {
1472    if (this.identifier == null)
1473      return false;
1474    for (Identifier item : this.identifier)
1475      if (!item.isEmpty())
1476        return true;
1477    return false;
1478  }
1479
1480  public Identifier addIdentifier() { // 3
1481    Identifier t = new Identifier();
1482    if (this.identifier == null)
1483      this.identifier = new ArrayList<Identifier>();
1484    this.identifier.add(t);
1485    return t;
1486  }
1487
1488  public Appointment addIdentifier(Identifier t) { // 3
1489    if (t == null)
1490      return this;
1491    if (this.identifier == null)
1492      this.identifier = new ArrayList<Identifier>();
1493    this.identifier.add(t);
1494    return this;
1495  }
1496
1497  /**
1498   * @return The first repetition of repeating field {@link #identifier}, creating
1499   *         it if it does not already exist
1500   */
1501  public Identifier getIdentifierFirstRep() {
1502    if (getIdentifier().isEmpty()) {
1503      addIdentifier();
1504    }
1505    return getIdentifier().get(0);
1506  }
1507
1508  /**
1509   * @return {@link #status} (The overall status of the Appointment. Each of the
1510   *         participants has their own participation status which indicates their
1511   *         involvement in the process, however this status indicates the shared
1512   *         status.). This is the underlying object with id, value and
1513   *         extensions. The accessor "getStatus" gives direct access to the value
1514   */
1515  public Enumeration<AppointmentStatus> getStatusElement() {
1516    if (this.status == null)
1517      if (Configuration.errorOnAutoCreate())
1518        throw new Error("Attempt to auto-create Appointment.status");
1519      else if (Configuration.doAutoCreate())
1520        this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory()); // bb
1521    return this.status;
1522  }
1523
1524  public boolean hasStatusElement() {
1525    return this.status != null && !this.status.isEmpty();
1526  }
1527
1528  public boolean hasStatus() {
1529    return this.status != null && !this.status.isEmpty();
1530  }
1531
1532  /**
1533   * @param value {@link #status} (The overall status of the Appointment. Each of
1534   *              the participants has their own participation status which
1535   *              indicates their involvement in the process, however this status
1536   *              indicates the shared status.). This is the underlying object
1537   *              with id, value and extensions. The accessor "getStatus" gives
1538   *              direct access to the value
1539   */
1540  public Appointment setStatusElement(Enumeration<AppointmentStatus> value) {
1541    this.status = value;
1542    return this;
1543  }
1544
1545  /**
1546   * @return The overall status of the Appointment. Each of the participants has
1547   *         their own participation status which indicates their involvement in
1548   *         the process, however this status indicates the shared status.
1549   */
1550  public AppointmentStatus getStatus() {
1551    return this.status == null ? null : this.status.getValue();
1552  }
1553
1554  /**
1555   * @param value The overall status of the Appointment. Each of the participants
1556   *              has their own participation status which indicates their
1557   *              involvement in the process, however this status indicates the
1558   *              shared status.
1559   */
1560  public Appointment setStatus(AppointmentStatus value) {
1561    if (this.status == null)
1562      this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory());
1563    this.status.setValue(value);
1564    return this;
1565  }
1566
1567  /**
1568   * @return {@link #cancelationReason} (The coded reason for the appointment
1569   *         being cancelled. This is often used in reporting/billing/futher
1570   *         processing to determine if further actions are required, or specific
1571   *         fees apply.)
1572   */
1573  public CodeableConcept getCancelationReason() {
1574    if (this.cancelationReason == null)
1575      if (Configuration.errorOnAutoCreate())
1576        throw new Error("Attempt to auto-create Appointment.cancelationReason");
1577      else if (Configuration.doAutoCreate())
1578        this.cancelationReason = new CodeableConcept(); // cc
1579    return this.cancelationReason;
1580  }
1581
1582  public boolean hasCancelationReason() {
1583    return this.cancelationReason != null && !this.cancelationReason.isEmpty();
1584  }
1585
1586  /**
1587   * @param value {@link #cancelationReason} (The coded reason for the appointment
1588   *              being cancelled. This is often used in reporting/billing/futher
1589   *              processing to determine if further actions are required, or
1590   *              specific fees apply.)
1591   */
1592  public Appointment setCancelationReason(CodeableConcept value) {
1593    this.cancelationReason = value;
1594    return this;
1595  }
1596
1597  /**
1598   * @return {@link #serviceCategory} (A broad categorization of the service that
1599   *         is to be performed during this appointment.)
1600   */
1601  public List<CodeableConcept> getServiceCategory() {
1602    if (this.serviceCategory == null)
1603      this.serviceCategory = new ArrayList<CodeableConcept>();
1604    return this.serviceCategory;
1605  }
1606
1607  /**
1608   * @return Returns a reference to <code>this</code> for easy method chaining
1609   */
1610  public Appointment setServiceCategory(List<CodeableConcept> theServiceCategory) {
1611    this.serviceCategory = theServiceCategory;
1612    return this;
1613  }
1614
1615  public boolean hasServiceCategory() {
1616    if (this.serviceCategory == null)
1617      return false;
1618    for (CodeableConcept item : this.serviceCategory)
1619      if (!item.isEmpty())
1620        return true;
1621    return false;
1622  }
1623
1624  public CodeableConcept addServiceCategory() { // 3
1625    CodeableConcept t = new CodeableConcept();
1626    if (this.serviceCategory == null)
1627      this.serviceCategory = new ArrayList<CodeableConcept>();
1628    this.serviceCategory.add(t);
1629    return t;
1630  }
1631
1632  public Appointment addServiceCategory(CodeableConcept t) { // 3
1633    if (t == null)
1634      return this;
1635    if (this.serviceCategory == null)
1636      this.serviceCategory = new ArrayList<CodeableConcept>();
1637    this.serviceCategory.add(t);
1638    return this;
1639  }
1640
1641  /**
1642   * @return The first repetition of repeating field {@link #serviceCategory},
1643   *         creating it if it does not already exist
1644   */
1645  public CodeableConcept getServiceCategoryFirstRep() {
1646    if (getServiceCategory().isEmpty()) {
1647      addServiceCategory();
1648    }
1649    return getServiceCategory().get(0);
1650  }
1651
1652  /**
1653   * @return {@link #serviceType} (The specific service that is to be performed
1654   *         during this appointment.)
1655   */
1656  public List<CodeableConcept> getServiceType() {
1657    if (this.serviceType == null)
1658      this.serviceType = new ArrayList<CodeableConcept>();
1659    return this.serviceType;
1660  }
1661
1662  /**
1663   * @return Returns a reference to <code>this</code> for easy method chaining
1664   */
1665  public Appointment setServiceType(List<CodeableConcept> theServiceType) {
1666    this.serviceType = theServiceType;
1667    return this;
1668  }
1669
1670  public boolean hasServiceType() {
1671    if (this.serviceType == null)
1672      return false;
1673    for (CodeableConcept item : this.serviceType)
1674      if (!item.isEmpty())
1675        return true;
1676    return false;
1677  }
1678
1679  public CodeableConcept addServiceType() { // 3
1680    CodeableConcept t = new CodeableConcept();
1681    if (this.serviceType == null)
1682      this.serviceType = new ArrayList<CodeableConcept>();
1683    this.serviceType.add(t);
1684    return t;
1685  }
1686
1687  public Appointment addServiceType(CodeableConcept t) { // 3
1688    if (t == null)
1689      return this;
1690    if (this.serviceType == null)
1691      this.serviceType = new ArrayList<CodeableConcept>();
1692    this.serviceType.add(t);
1693    return this;
1694  }
1695
1696  /**
1697   * @return The first repetition of repeating field {@link #serviceType},
1698   *         creating it if it does not already exist
1699   */
1700  public CodeableConcept getServiceTypeFirstRep() {
1701    if (getServiceType().isEmpty()) {
1702      addServiceType();
1703    }
1704    return getServiceType().get(0);
1705  }
1706
1707  /**
1708   * @return {@link #specialty} (The specialty of a practitioner that would be
1709   *         required to perform the service requested in this appointment.)
1710   */
1711  public List<CodeableConcept> getSpecialty() {
1712    if (this.specialty == null)
1713      this.specialty = new ArrayList<CodeableConcept>();
1714    return this.specialty;
1715  }
1716
1717  /**
1718   * @return Returns a reference to <code>this</code> for easy method chaining
1719   */
1720  public Appointment setSpecialty(List<CodeableConcept> theSpecialty) {
1721    this.specialty = theSpecialty;
1722    return this;
1723  }
1724
1725  public boolean hasSpecialty() {
1726    if (this.specialty == null)
1727      return false;
1728    for (CodeableConcept item : this.specialty)
1729      if (!item.isEmpty())
1730        return true;
1731    return false;
1732  }
1733
1734  public CodeableConcept addSpecialty() { // 3
1735    CodeableConcept t = new CodeableConcept();
1736    if (this.specialty == null)
1737      this.specialty = new ArrayList<CodeableConcept>();
1738    this.specialty.add(t);
1739    return t;
1740  }
1741
1742  public Appointment addSpecialty(CodeableConcept t) { // 3
1743    if (t == null)
1744      return this;
1745    if (this.specialty == null)
1746      this.specialty = new ArrayList<CodeableConcept>();
1747    this.specialty.add(t);
1748    return this;
1749  }
1750
1751  /**
1752   * @return The first repetition of repeating field {@link #specialty}, creating
1753   *         it if it does not already exist
1754   */
1755  public CodeableConcept getSpecialtyFirstRep() {
1756    if (getSpecialty().isEmpty()) {
1757      addSpecialty();
1758    }
1759    return getSpecialty().get(0);
1760  }
1761
1762  /**
1763   * @return {@link #appointmentType} (The style of appointment or patient that
1764   *         has been booked in the slot (not service type).)
1765   */
1766  public CodeableConcept getAppointmentType() {
1767    if (this.appointmentType == null)
1768      if (Configuration.errorOnAutoCreate())
1769        throw new Error("Attempt to auto-create Appointment.appointmentType");
1770      else if (Configuration.doAutoCreate())
1771        this.appointmentType = new CodeableConcept(); // cc
1772    return this.appointmentType;
1773  }
1774
1775  public boolean hasAppointmentType() {
1776    return this.appointmentType != null && !this.appointmentType.isEmpty();
1777  }
1778
1779  /**
1780   * @param value {@link #appointmentType} (The style of appointment or patient
1781   *              that has been booked in the slot (not service type).)
1782   */
1783  public Appointment setAppointmentType(CodeableConcept value) {
1784    this.appointmentType = value;
1785    return this;
1786  }
1787
1788  /**
1789   * @return {@link #reasonCode} (The coded reason that this appointment is being
1790   *         scheduled. This is more clinical than administrative.)
1791   */
1792  public List<CodeableConcept> getReasonCode() {
1793    if (this.reasonCode == null)
1794      this.reasonCode = new ArrayList<CodeableConcept>();
1795    return this.reasonCode;
1796  }
1797
1798  /**
1799   * @return Returns a reference to <code>this</code> for easy method chaining
1800   */
1801  public Appointment setReasonCode(List<CodeableConcept> theReasonCode) {
1802    this.reasonCode = theReasonCode;
1803    return this;
1804  }
1805
1806  public boolean hasReasonCode() {
1807    if (this.reasonCode == null)
1808      return false;
1809    for (CodeableConcept item : this.reasonCode)
1810      if (!item.isEmpty())
1811        return true;
1812    return false;
1813  }
1814
1815  public CodeableConcept addReasonCode() { // 3
1816    CodeableConcept t = new CodeableConcept();
1817    if (this.reasonCode == null)
1818      this.reasonCode = new ArrayList<CodeableConcept>();
1819    this.reasonCode.add(t);
1820    return t;
1821  }
1822
1823  public Appointment addReasonCode(CodeableConcept t) { // 3
1824    if (t == null)
1825      return this;
1826    if (this.reasonCode == null)
1827      this.reasonCode = new ArrayList<CodeableConcept>();
1828    this.reasonCode.add(t);
1829    return this;
1830  }
1831
1832  /**
1833   * @return The first repetition of repeating field {@link #reasonCode}, creating
1834   *         it if it does not already exist
1835   */
1836  public CodeableConcept getReasonCodeFirstRep() {
1837    if (getReasonCode().isEmpty()) {
1838      addReasonCode();
1839    }
1840    return getReasonCode().get(0);
1841  }
1842
1843  /**
1844   * @return {@link #reasonReference} (Reason the appointment has been scheduled
1845   *         to take place, as specified using information from another resource.
1846   *         When the patient arrives and the encounter begins it may be used as
1847   *         the admission diagnosis. The indication will typically be a Condition
1848   *         (with other resources referenced in the evidence.detail), or a
1849   *         Procedure.)
1850   */
1851  public List<Reference> getReasonReference() {
1852    if (this.reasonReference == null)
1853      this.reasonReference = new ArrayList<Reference>();
1854    return this.reasonReference;
1855  }
1856
1857  /**
1858   * @return Returns a reference to <code>this</code> for easy method chaining
1859   */
1860  public Appointment setReasonReference(List<Reference> theReasonReference) {
1861    this.reasonReference = theReasonReference;
1862    return this;
1863  }
1864
1865  public boolean hasReasonReference() {
1866    if (this.reasonReference == null)
1867      return false;
1868    for (Reference item : this.reasonReference)
1869      if (!item.isEmpty())
1870        return true;
1871    return false;
1872  }
1873
1874  public Reference addReasonReference() { // 3
1875    Reference t = new Reference();
1876    if (this.reasonReference == null)
1877      this.reasonReference = new ArrayList<Reference>();
1878    this.reasonReference.add(t);
1879    return t;
1880  }
1881
1882  public Appointment addReasonReference(Reference t) { // 3
1883    if (t == null)
1884      return this;
1885    if (this.reasonReference == null)
1886      this.reasonReference = new ArrayList<Reference>();
1887    this.reasonReference.add(t);
1888    return this;
1889  }
1890
1891  /**
1892   * @return The first repetition of repeating field {@link #reasonReference},
1893   *         creating it if it does not already exist
1894   */
1895  public Reference getReasonReferenceFirstRep() {
1896    if (getReasonReference().isEmpty()) {
1897      addReasonReference();
1898    }
1899    return getReasonReference().get(0);
1900  }
1901
1902  /**
1903   * @deprecated Use Reference#setResource(IBaseResource) instead
1904   */
1905  @Deprecated
1906  public List<Resource> getReasonReferenceTarget() {
1907    if (this.reasonReferenceTarget == null)
1908      this.reasonReferenceTarget = new ArrayList<Resource>();
1909    return this.reasonReferenceTarget;
1910  }
1911
1912  /**
1913   * @return {@link #priority} (The priority of the appointment. Can be used to
1914   *         make informed decisions if needing to re-prioritize appointments.
1915   *         (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as
1916   *         lowest priority).). This is the underlying object with id, value and
1917   *         extensions. The accessor "getPriority" gives direct access to the
1918   *         value
1919   */
1920  public UnsignedIntType getPriorityElement() {
1921    if (this.priority == null)
1922      if (Configuration.errorOnAutoCreate())
1923        throw new Error("Attempt to auto-create Appointment.priority");
1924      else if (Configuration.doAutoCreate())
1925        this.priority = new UnsignedIntType(); // bb
1926    return this.priority;
1927  }
1928
1929  public boolean hasPriorityElement() {
1930    return this.priority != null && !this.priority.isEmpty();
1931  }
1932
1933  public boolean hasPriority() {
1934    return this.priority != null && !this.priority.isEmpty();
1935  }
1936
1937  /**
1938   * @param value {@link #priority} (The priority of the appointment. Can be used
1939   *              to make informed decisions if needing to re-prioritize
1940   *              appointments. (The iCal Standard specifies 0 as undefined, 1 as
1941   *              highest, 9 as lowest priority).). This is the underlying object
1942   *              with id, value and extensions. The accessor "getPriority" gives
1943   *              direct access to the value
1944   */
1945  public Appointment setPriorityElement(UnsignedIntType value) {
1946    this.priority = value;
1947    return this;
1948  }
1949
1950  /**
1951   * @return The priority of the appointment. Can be used to make informed
1952   *         decisions if needing to re-prioritize appointments. (The iCal
1953   *         Standard specifies 0 as undefined, 1 as highest, 9 as lowest
1954   *         priority).
1955   */
1956  public int getPriority() {
1957    return this.priority == null || this.priority.isEmpty() ? 0 : this.priority.getValue();
1958  }
1959
1960  /**
1961   * @param value The priority of the appointment. Can be used to make informed
1962   *              decisions if needing to re-prioritize appointments. (The iCal
1963   *              Standard specifies 0 as undefined, 1 as highest, 9 as lowest
1964   *              priority).
1965   */
1966  public Appointment setPriority(int value) {
1967    if (this.priority == null)
1968      this.priority = new UnsignedIntType();
1969    this.priority.setValue(value);
1970    return this;
1971  }
1972
1973  /**
1974   * @return {@link #description} (The brief description of the appointment as
1975   *         would be shown on a subject line in a meeting request, or appointment
1976   *         list. Detailed or expanded information should be put in the comment
1977   *         field.). This is the underlying object with id, value and extensions.
1978   *         The accessor "getDescription" gives direct access to the value
1979   */
1980  public StringType getDescriptionElement() {
1981    if (this.description == null)
1982      if (Configuration.errorOnAutoCreate())
1983        throw new Error("Attempt to auto-create Appointment.description");
1984      else if (Configuration.doAutoCreate())
1985        this.description = new StringType(); // bb
1986    return this.description;
1987  }
1988
1989  public boolean hasDescriptionElement() {
1990    return this.description != null && !this.description.isEmpty();
1991  }
1992
1993  public boolean hasDescription() {
1994    return this.description != null && !this.description.isEmpty();
1995  }
1996
1997  /**
1998   * @param value {@link #description} (The brief description of the appointment
1999   *              as would be shown on a subject line in a meeting request, or
2000   *              appointment list. Detailed or expanded information should be put
2001   *              in the comment field.). This is the underlying object with id,
2002   *              value and extensions. The accessor "getDescription" gives direct
2003   *              access to the value
2004   */
2005  public Appointment setDescriptionElement(StringType value) {
2006    this.description = value;
2007    return this;
2008  }
2009
2010  /**
2011   * @return The brief description of the appointment as would be shown on a
2012   *         subject line in a meeting request, or appointment list. Detailed or
2013   *         expanded information should be put in the comment field.
2014   */
2015  public String getDescription() {
2016    return this.description == null ? null : this.description.getValue();
2017  }
2018
2019  /**
2020   * @param value The brief description of the appointment as would be shown on a
2021   *              subject line in a meeting request, or appointment list. Detailed
2022   *              or expanded information should be put in the comment field.
2023   */
2024  public Appointment setDescription(String value) {
2025    if (Utilities.noString(value))
2026      this.description = null;
2027    else {
2028      if (this.description == null)
2029        this.description = new StringType();
2030      this.description.setValue(value);
2031    }
2032    return this;
2033  }
2034
2035  /**
2036   * @return {@link #supportingInformation} (Additional information to support the
2037   *         appointment provided when making the appointment.)
2038   */
2039  public List<Reference> getSupportingInformation() {
2040    if (this.supportingInformation == null)
2041      this.supportingInformation = new ArrayList<Reference>();
2042    return this.supportingInformation;
2043  }
2044
2045  /**
2046   * @return Returns a reference to <code>this</code> for easy method chaining
2047   */
2048  public Appointment setSupportingInformation(List<Reference> theSupportingInformation) {
2049    this.supportingInformation = theSupportingInformation;
2050    return this;
2051  }
2052
2053  public boolean hasSupportingInformation() {
2054    if (this.supportingInformation == null)
2055      return false;
2056    for (Reference item : this.supportingInformation)
2057      if (!item.isEmpty())
2058        return true;
2059    return false;
2060  }
2061
2062  public Reference addSupportingInformation() { // 3
2063    Reference t = new Reference();
2064    if (this.supportingInformation == null)
2065      this.supportingInformation = new ArrayList<Reference>();
2066    this.supportingInformation.add(t);
2067    return t;
2068  }
2069
2070  public Appointment addSupportingInformation(Reference t) { // 3
2071    if (t == null)
2072      return this;
2073    if (this.supportingInformation == null)
2074      this.supportingInformation = new ArrayList<Reference>();
2075    this.supportingInformation.add(t);
2076    return this;
2077  }
2078
2079  /**
2080   * @return The first repetition of repeating field
2081   *         {@link #supportingInformation}, creating it if it does not already
2082   *         exist
2083   */
2084  public Reference getSupportingInformationFirstRep() {
2085    if (getSupportingInformation().isEmpty()) {
2086      addSupportingInformation();
2087    }
2088    return getSupportingInformation().get(0);
2089  }
2090
2091  /**
2092   * @deprecated Use Reference#setResource(IBaseResource) instead
2093   */
2094  @Deprecated
2095  public List<Resource> getSupportingInformationTarget() {
2096    if (this.supportingInformationTarget == null)
2097      this.supportingInformationTarget = new ArrayList<Resource>();
2098    return this.supportingInformationTarget;
2099  }
2100
2101  /**
2102   * @return {@link #start} (Date/Time that the appointment is to take place.).
2103   *         This is the underlying object with id, value and extensions. The
2104   *         accessor "getStart" gives direct access to the value
2105   */
2106  public InstantType getStartElement() {
2107    if (this.start == null)
2108      if (Configuration.errorOnAutoCreate())
2109        throw new Error("Attempt to auto-create Appointment.start");
2110      else if (Configuration.doAutoCreate())
2111        this.start = new InstantType(); // bb
2112    return this.start;
2113  }
2114
2115  public boolean hasStartElement() {
2116    return this.start != null && !this.start.isEmpty();
2117  }
2118
2119  public boolean hasStart() {
2120    return this.start != null && !this.start.isEmpty();
2121  }
2122
2123  /**
2124   * @param value {@link #start} (Date/Time that the appointment is to take
2125   *              place.). This is the underlying object with id, value and
2126   *              extensions. The accessor "getStart" gives direct access to the
2127   *              value
2128   */
2129  public Appointment setStartElement(InstantType value) {
2130    this.start = value;
2131    return this;
2132  }
2133
2134  /**
2135   * @return Date/Time that the appointment is to take place.
2136   */
2137  public Date getStart() {
2138    return this.start == null ? null : this.start.getValue();
2139  }
2140
2141  /**
2142   * @param value Date/Time that the appointment is to take place.
2143   */
2144  public Appointment setStart(Date value) {
2145    if (value == null)
2146      this.start = null;
2147    else {
2148      if (this.start == null)
2149        this.start = new InstantType();
2150      this.start.setValue(value);
2151    }
2152    return this;
2153  }
2154
2155  /**
2156   * @return {@link #end} (Date/Time that the appointment is to conclude.). This
2157   *         is the underlying object with id, value and extensions. The accessor
2158   *         "getEnd" gives direct access to the value
2159   */
2160  public InstantType getEndElement() {
2161    if (this.end == null)
2162      if (Configuration.errorOnAutoCreate())
2163        throw new Error("Attempt to auto-create Appointment.end");
2164      else if (Configuration.doAutoCreate())
2165        this.end = new InstantType(); // bb
2166    return this.end;
2167  }
2168
2169  public boolean hasEndElement() {
2170    return this.end != null && !this.end.isEmpty();
2171  }
2172
2173  public boolean hasEnd() {
2174    return this.end != null && !this.end.isEmpty();
2175  }
2176
2177  /**
2178   * @param value {@link #end} (Date/Time that the appointment is to conclude.).
2179   *              This is the underlying object with id, value and extensions. The
2180   *              accessor "getEnd" gives direct access to the value
2181   */
2182  public Appointment setEndElement(InstantType value) {
2183    this.end = value;
2184    return this;
2185  }
2186
2187  /**
2188   * @return Date/Time that the appointment is to conclude.
2189   */
2190  public Date getEnd() {
2191    return this.end == null ? null : this.end.getValue();
2192  }
2193
2194  /**
2195   * @param value Date/Time that the appointment is to conclude.
2196   */
2197  public Appointment setEnd(Date value) {
2198    if (value == null)
2199      this.end = null;
2200    else {
2201      if (this.end == null)
2202        this.end = new InstantType();
2203      this.end.setValue(value);
2204    }
2205    return this;
2206  }
2207
2208  /**
2209   * @return {@link #minutesDuration} (Number of minutes that the appointment is
2210   *         to take. This can be less than the duration between the start and end
2211   *         times. For example, where the actual time of appointment is only an
2212   *         estimate or if a 30 minute appointment is being requested, but any
2213   *         time would work. Also, if there is, for example, a planned 15 minute
2214   *         break in the middle of a long appointment, the duration may be 15
2215   *         minutes less than the difference between the start and end.). This is
2216   *         the underlying object with id, value and extensions. The accessor
2217   *         "getMinutesDuration" gives direct access to the value
2218   */
2219  public PositiveIntType getMinutesDurationElement() {
2220    if (this.minutesDuration == null)
2221      if (Configuration.errorOnAutoCreate())
2222        throw new Error("Attempt to auto-create Appointment.minutesDuration");
2223      else if (Configuration.doAutoCreate())
2224        this.minutesDuration = new PositiveIntType(); // bb
2225    return this.minutesDuration;
2226  }
2227
2228  public boolean hasMinutesDurationElement() {
2229    return this.minutesDuration != null && !this.minutesDuration.isEmpty();
2230  }
2231
2232  public boolean hasMinutesDuration() {
2233    return this.minutesDuration != null && !this.minutesDuration.isEmpty();
2234  }
2235
2236  /**
2237   * @param value {@link #minutesDuration} (Number of minutes that the appointment
2238   *              is to take. This can be less than the duration between the start
2239   *              and end times. For example, where the actual time of appointment
2240   *              is only an estimate or if a 30 minute appointment is being
2241   *              requested, but any time would work. Also, if there is, for
2242   *              example, a planned 15 minute break in the middle of a long
2243   *              appointment, the duration may be 15 minutes less than the
2244   *              difference between the start and end.). This is the underlying
2245   *              object with id, value and extensions. The accessor
2246   *              "getMinutesDuration" gives direct access to the value
2247   */
2248  public Appointment setMinutesDurationElement(PositiveIntType value) {
2249    this.minutesDuration = value;
2250    return this;
2251  }
2252
2253  /**
2254   * @return Number of minutes that the appointment is to take. This can be less
2255   *         than the duration between the start and end times. For example, where
2256   *         the actual time of appointment is only an estimate or if a 30 minute
2257   *         appointment is being requested, but any time would work. Also, if
2258   *         there is, for example, a planned 15 minute break in the middle of a
2259   *         long appointment, the duration may be 15 minutes less than the
2260   *         difference between the start and end.
2261   */
2262  public int getMinutesDuration() {
2263    return this.minutesDuration == null || this.minutesDuration.isEmpty() ? 0 : this.minutesDuration.getValue();
2264  }
2265
2266  /**
2267   * @param value Number of minutes that the appointment is to take. This can be
2268   *              less than the duration between the start and end times. For
2269   *              example, where the actual time of appointment is only an
2270   *              estimate or if a 30 minute appointment is being requested, but
2271   *              any time would work. Also, if there is, for example, a planned
2272   *              15 minute break in the middle of a long appointment, the
2273   *              duration may be 15 minutes less than the difference between the
2274   *              start and end.
2275   */
2276  public Appointment setMinutesDuration(int value) {
2277    if (this.minutesDuration == null)
2278      this.minutesDuration = new PositiveIntType();
2279    this.minutesDuration.setValue(value);
2280    return this;
2281  }
2282
2283  /**
2284   * @return {@link #slot} (The slots from the participants' schedules that will
2285   *         be filled by the appointment.)
2286   */
2287  public List<Reference> getSlot() {
2288    if (this.slot == null)
2289      this.slot = new ArrayList<Reference>();
2290    return this.slot;
2291  }
2292
2293  /**
2294   * @return Returns a reference to <code>this</code> for easy method chaining
2295   */
2296  public Appointment setSlot(List<Reference> theSlot) {
2297    this.slot = theSlot;
2298    return this;
2299  }
2300
2301  public boolean hasSlot() {
2302    if (this.slot == null)
2303      return false;
2304    for (Reference item : this.slot)
2305      if (!item.isEmpty())
2306        return true;
2307    return false;
2308  }
2309
2310  public Reference addSlot() { // 3
2311    Reference t = new Reference();
2312    if (this.slot == null)
2313      this.slot = new ArrayList<Reference>();
2314    this.slot.add(t);
2315    return t;
2316  }
2317
2318  public Appointment addSlot(Reference t) { // 3
2319    if (t == null)
2320      return this;
2321    if (this.slot == null)
2322      this.slot = new ArrayList<Reference>();
2323    this.slot.add(t);
2324    return this;
2325  }
2326
2327  /**
2328   * @return The first repetition of repeating field {@link #slot}, creating it if
2329   *         it does not already exist
2330   */
2331  public Reference getSlotFirstRep() {
2332    if (getSlot().isEmpty()) {
2333      addSlot();
2334    }
2335    return getSlot().get(0);
2336  }
2337
2338  /**
2339   * @deprecated Use Reference#setResource(IBaseResource) instead
2340   */
2341  @Deprecated
2342  public List<Slot> getSlotTarget() {
2343    if (this.slotTarget == null)
2344      this.slotTarget = new ArrayList<Slot>();
2345    return this.slotTarget;
2346  }
2347
2348  /**
2349   * @deprecated Use Reference#setResource(IBaseResource) instead
2350   */
2351  @Deprecated
2352  public Slot addSlotTarget() {
2353    Slot r = new Slot();
2354    if (this.slotTarget == null)
2355      this.slotTarget = new ArrayList<Slot>();
2356    this.slotTarget.add(r);
2357    return r;
2358  }
2359
2360  /**
2361   * @return {@link #created} (The date that this appointment was initially
2362   *         created. This could be different to the meta.lastModified value on
2363   *         the initial entry, as this could have been before the resource was
2364   *         created on the FHIR server, and should remain unchanged over the
2365   *         lifespan of the appointment.). This is the underlying object with id,
2366   *         value and extensions. The accessor "getCreated" gives direct access
2367   *         to the value
2368   */
2369  public DateTimeType getCreatedElement() {
2370    if (this.created == null)
2371      if (Configuration.errorOnAutoCreate())
2372        throw new Error("Attempt to auto-create Appointment.created");
2373      else if (Configuration.doAutoCreate())
2374        this.created = new DateTimeType(); // bb
2375    return this.created;
2376  }
2377
2378  public boolean hasCreatedElement() {
2379    return this.created != null && !this.created.isEmpty();
2380  }
2381
2382  public boolean hasCreated() {
2383    return this.created != null && !this.created.isEmpty();
2384  }
2385
2386  /**
2387   * @param value {@link #created} (The date that this appointment was initially
2388   *              created. This could be different to the meta.lastModified value
2389   *              on the initial entry, as this could have been before the
2390   *              resource was created on the FHIR server, and should remain
2391   *              unchanged over the lifespan of the appointment.). This is the
2392   *              underlying object with id, value and extensions. The accessor
2393   *              "getCreated" gives direct access to the value
2394   */
2395  public Appointment setCreatedElement(DateTimeType value) {
2396    this.created = value;
2397    return this;
2398  }
2399
2400  /**
2401   * @return The date that this appointment was initially created. This could be
2402   *         different to the meta.lastModified value on the initial entry, as
2403   *         this could have been before the resource was created on the FHIR
2404   *         server, and should remain unchanged over the lifespan of the
2405   *         appointment.
2406   */
2407  public Date getCreated() {
2408    return this.created == null ? null : this.created.getValue();
2409  }
2410
2411  /**
2412   * @param value The date that this appointment was initially created. This could
2413   *              be different to the meta.lastModified value on the initial
2414   *              entry, as this could have been before the resource was created
2415   *              on the FHIR server, and should remain unchanged over the
2416   *              lifespan of the appointment.
2417   */
2418  public Appointment setCreated(Date value) {
2419    if (value == null)
2420      this.created = null;
2421    else {
2422      if (this.created == null)
2423        this.created = new DateTimeType();
2424      this.created.setValue(value);
2425    }
2426    return this;
2427  }
2428
2429  /**
2430   * @return {@link #comment} (Additional comments about the appointment.). This
2431   *         is the underlying object with id, value and extensions. The accessor
2432   *         "getComment" gives direct access to the value
2433   */
2434  public StringType getCommentElement() {
2435    if (this.comment == null)
2436      if (Configuration.errorOnAutoCreate())
2437        throw new Error("Attempt to auto-create Appointment.comment");
2438      else if (Configuration.doAutoCreate())
2439        this.comment = new StringType(); // bb
2440    return this.comment;
2441  }
2442
2443  public boolean hasCommentElement() {
2444    return this.comment != null && !this.comment.isEmpty();
2445  }
2446
2447  public boolean hasComment() {
2448    return this.comment != null && !this.comment.isEmpty();
2449  }
2450
2451  /**
2452   * @param value {@link #comment} (Additional comments about the appointment.).
2453   *              This is the underlying object with id, value and extensions. The
2454   *              accessor "getComment" gives direct access to the value
2455   */
2456  public Appointment setCommentElement(StringType value) {
2457    this.comment = value;
2458    return this;
2459  }
2460
2461  /**
2462   * @return Additional comments about the appointment.
2463   */
2464  public String getComment() {
2465    return this.comment == null ? null : this.comment.getValue();
2466  }
2467
2468  /**
2469   * @param value Additional comments about the appointment.
2470   */
2471  public Appointment setComment(String value) {
2472    if (Utilities.noString(value))
2473      this.comment = null;
2474    else {
2475      if (this.comment == null)
2476        this.comment = new StringType();
2477      this.comment.setValue(value);
2478    }
2479    return this;
2480  }
2481
2482  /**
2483   * @return {@link #patientInstruction} (While Appointment.comment contains
2484   *         information for internal use, Appointment.patientInstructions is used
2485   *         to capture patient facing information about the Appointment (e.g.
2486   *         please bring your referral or fast from 8pm night before).). This is
2487   *         the underlying object with id, value and extensions. The accessor
2488   *         "getPatientInstruction" gives direct access to the value
2489   */
2490  public StringType getPatientInstructionElement() {
2491    if (this.patientInstruction == null)
2492      if (Configuration.errorOnAutoCreate())
2493        throw new Error("Attempt to auto-create Appointment.patientInstruction");
2494      else if (Configuration.doAutoCreate())
2495        this.patientInstruction = new StringType(); // bb
2496    return this.patientInstruction;
2497  }
2498
2499  public boolean hasPatientInstructionElement() {
2500    return this.patientInstruction != null && !this.patientInstruction.isEmpty();
2501  }
2502
2503  public boolean hasPatientInstruction() {
2504    return this.patientInstruction != null && !this.patientInstruction.isEmpty();
2505  }
2506
2507  /**
2508   * @param value {@link #patientInstruction} (While Appointment.comment contains
2509   *              information for internal use, Appointment.patientInstructions is
2510   *              used to capture patient facing information about the Appointment
2511   *              (e.g. please bring your referral or fast from 8pm night
2512   *              before).). This is the underlying object with id, value and
2513   *              extensions. The accessor "getPatientInstruction" gives direct
2514   *              access to the value
2515   */
2516  public Appointment setPatientInstructionElement(StringType value) {
2517    this.patientInstruction = value;
2518    return this;
2519  }
2520
2521  /**
2522   * @return While Appointment.comment contains information for internal use,
2523   *         Appointment.patientInstructions is used to capture patient facing
2524   *         information about the Appointment (e.g. please bring your referral or
2525   *         fast from 8pm night before).
2526   */
2527  public String getPatientInstruction() {
2528    return this.patientInstruction == null ? null : this.patientInstruction.getValue();
2529  }
2530
2531  /**
2532   * @param value While Appointment.comment contains information for internal use,
2533   *              Appointment.patientInstructions is used to capture patient
2534   *              facing information about the Appointment (e.g. please bring your
2535   *              referral or fast from 8pm night before).
2536   */
2537  public Appointment setPatientInstruction(String value) {
2538    if (Utilities.noString(value))
2539      this.patientInstruction = null;
2540    else {
2541      if (this.patientInstruction == null)
2542        this.patientInstruction = new StringType();
2543      this.patientInstruction.setValue(value);
2544    }
2545    return this;
2546  }
2547
2548  /**
2549   * @return {@link #basedOn} (The service request this appointment is allocated
2550   *         to assess (e.g. incoming referral or procedure request).)
2551   */
2552  public List<Reference> getBasedOn() {
2553    if (this.basedOn == null)
2554      this.basedOn = new ArrayList<Reference>();
2555    return this.basedOn;
2556  }
2557
2558  /**
2559   * @return Returns a reference to <code>this</code> for easy method chaining
2560   */
2561  public Appointment setBasedOn(List<Reference> theBasedOn) {
2562    this.basedOn = theBasedOn;
2563    return this;
2564  }
2565
2566  public boolean hasBasedOn() {
2567    if (this.basedOn == null)
2568      return false;
2569    for (Reference item : this.basedOn)
2570      if (!item.isEmpty())
2571        return true;
2572    return false;
2573  }
2574
2575  public Reference addBasedOn() { // 3
2576    Reference t = new Reference();
2577    if (this.basedOn == null)
2578      this.basedOn = new ArrayList<Reference>();
2579    this.basedOn.add(t);
2580    return t;
2581  }
2582
2583  public Appointment addBasedOn(Reference t) { // 3
2584    if (t == null)
2585      return this;
2586    if (this.basedOn == null)
2587      this.basedOn = new ArrayList<Reference>();
2588    this.basedOn.add(t);
2589    return this;
2590  }
2591
2592  /**
2593   * @return The first repetition of repeating field {@link #basedOn}, creating it
2594   *         if it does not already exist
2595   */
2596  public Reference getBasedOnFirstRep() {
2597    if (getBasedOn().isEmpty()) {
2598      addBasedOn();
2599    }
2600    return getBasedOn().get(0);
2601  }
2602
2603  /**
2604   * @deprecated Use Reference#setResource(IBaseResource) instead
2605   */
2606  @Deprecated
2607  public List<ServiceRequest> getBasedOnTarget() {
2608    if (this.basedOnTarget == null)
2609      this.basedOnTarget = new ArrayList<ServiceRequest>();
2610    return this.basedOnTarget;
2611  }
2612
2613  /**
2614   * @deprecated Use Reference#setResource(IBaseResource) instead
2615   */
2616  @Deprecated
2617  public ServiceRequest addBasedOnTarget() {
2618    ServiceRequest r = new ServiceRequest();
2619    if (this.basedOnTarget == null)
2620      this.basedOnTarget = new ArrayList<ServiceRequest>();
2621    this.basedOnTarget.add(r);
2622    return r;
2623  }
2624
2625  /**
2626   * @return {@link #participant} (List of participants involved in the
2627   *         appointment.)
2628   */
2629  public List<AppointmentParticipantComponent> getParticipant() {
2630    if (this.participant == null)
2631      this.participant = new ArrayList<AppointmentParticipantComponent>();
2632    return this.participant;
2633  }
2634
2635  /**
2636   * @return Returns a reference to <code>this</code> for easy method chaining
2637   */
2638  public Appointment setParticipant(List<AppointmentParticipantComponent> theParticipant) {
2639    this.participant = theParticipant;
2640    return this;
2641  }
2642
2643  public boolean hasParticipant() {
2644    if (this.participant == null)
2645      return false;
2646    for (AppointmentParticipantComponent item : this.participant)
2647      if (!item.isEmpty())
2648        return true;
2649    return false;
2650  }
2651
2652  public AppointmentParticipantComponent addParticipant() { // 3
2653    AppointmentParticipantComponent t = new AppointmentParticipantComponent();
2654    if (this.participant == null)
2655      this.participant = new ArrayList<AppointmentParticipantComponent>();
2656    this.participant.add(t);
2657    return t;
2658  }
2659
2660  public Appointment addParticipant(AppointmentParticipantComponent t) { // 3
2661    if (t == null)
2662      return this;
2663    if (this.participant == null)
2664      this.participant = new ArrayList<AppointmentParticipantComponent>();
2665    this.participant.add(t);
2666    return this;
2667  }
2668
2669  /**
2670   * @return The first repetition of repeating field {@link #participant},
2671   *         creating it if it does not already exist
2672   */
2673  public AppointmentParticipantComponent getParticipantFirstRep() {
2674    if (getParticipant().isEmpty()) {
2675      addParticipant();
2676    }
2677    return getParticipant().get(0);
2678  }
2679
2680  /**
2681   * @return {@link #requestedPeriod} (A set of date ranges (potentially including
2682   *         times) that the appointment is preferred to be scheduled within.
2683   * 
2684   *         The duration (usually in minutes) could also be provided to indicate
2685   *         the length of the appointment to fill and populate the start/end
2686   *         times for the actual allocated time. However, in other situations the
2687   *         duration may be calculated by the scheduling system.)
2688   */
2689  public List<Period> getRequestedPeriod() {
2690    if (this.requestedPeriod == null)
2691      this.requestedPeriod = new ArrayList<Period>();
2692    return this.requestedPeriod;
2693  }
2694
2695  /**
2696   * @return Returns a reference to <code>this</code> for easy method chaining
2697   */
2698  public Appointment setRequestedPeriod(List<Period> theRequestedPeriod) {
2699    this.requestedPeriod = theRequestedPeriod;
2700    return this;
2701  }
2702
2703  public boolean hasRequestedPeriod() {
2704    if (this.requestedPeriod == null)
2705      return false;
2706    for (Period item : this.requestedPeriod)
2707      if (!item.isEmpty())
2708        return true;
2709    return false;
2710  }
2711
2712  public Period addRequestedPeriod() { // 3
2713    Period t = new Period();
2714    if (this.requestedPeriod == null)
2715      this.requestedPeriod = new ArrayList<Period>();
2716    this.requestedPeriod.add(t);
2717    return t;
2718  }
2719
2720  public Appointment addRequestedPeriod(Period t) { // 3
2721    if (t == null)
2722      return this;
2723    if (this.requestedPeriod == null)
2724      this.requestedPeriod = new ArrayList<Period>();
2725    this.requestedPeriod.add(t);
2726    return this;
2727  }
2728
2729  /**
2730   * @return The first repetition of repeating field {@link #requestedPeriod},
2731   *         creating it if it does not already exist
2732   */
2733  public Period getRequestedPeriodFirstRep() {
2734    if (getRequestedPeriod().isEmpty()) {
2735      addRequestedPeriod();
2736    }
2737    return getRequestedPeriod().get(0);
2738  }
2739
2740  protected void listChildren(List<Property> children) {
2741    super.listChildren(children);
2742    children.add(new Property("identifier", "Identifier",
2743        "This records identifiers associated with this appointment 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 (e.g. in CDA documents, or in written / printed documentation).",
2744        0, java.lang.Integer.MAX_VALUE, identifier));
2745    children.add(new Property("status", "code",
2746        "The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.",
2747        0, 1, status));
2748    children.add(new Property("cancelationReason", "CodeableConcept",
2749        "The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.",
2750        0, 1, cancelationReason));
2751    children.add(new Property("serviceCategory", "CodeableConcept",
2752        "A broad categorization of the service that is to be performed during this appointment.", 0,
2753        java.lang.Integer.MAX_VALUE, serviceCategory));
2754    children.add(new Property("serviceType", "CodeableConcept",
2755        "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE,
2756        serviceType));
2757    children.add(new Property("specialty", "CodeableConcept",
2758        "The specialty of a practitioner that would be required to perform the service requested in this appointment.",
2759        0, java.lang.Integer.MAX_VALUE, specialty));
2760    children.add(new Property("appointmentType", "CodeableConcept",
2761        "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1,
2762        appointmentType));
2763    children.add(new Property("reasonCode", "CodeableConcept",
2764        "The coded reason that this appointment is being scheduled. This is more clinical than administrative.", 0,
2765        java.lang.Integer.MAX_VALUE, reasonCode));
2766    children.add(new Property("reasonReference",
2767        "Reference(Condition|Procedure|Observation|ImmunizationRecommendation)",
2768        "Reason the appointment has been scheduled to take place, as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.",
2769        0, java.lang.Integer.MAX_VALUE, reasonReference));
2770    children.add(new Property("priority", "unsignedInt",
2771        "The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).",
2772        0, 1, priority));
2773    children.add(new Property("description", "string",
2774        "The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.",
2775        0, 1, description));
2776    children.add(new Property("supportingInformation", "Reference(Any)",
2777        "Additional information to support the appointment provided when making the appointment.", 0,
2778        java.lang.Integer.MAX_VALUE, supportingInformation));
2779    children.add(new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1, start));
2780    children.add(new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end));
2781    children.add(new Property("minutesDuration", "positiveInt",
2782        "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.",
2783        0, 1, minutesDuration));
2784    children.add(new Property("slot", "Reference(Slot)",
2785        "The slots from the participants' schedules that will be filled by the appointment.", 0,
2786        java.lang.Integer.MAX_VALUE, slot));
2787    children.add(new Property("created", "dateTime",
2788        "The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.",
2789        0, 1, created));
2790    children.add(new Property("comment", "string", "Additional comments about the appointment.", 0, 1, comment));
2791    children.add(new Property("patientInstruction", "string",
2792        "While Appointment.comment contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).",
2793        0, 1, patientInstruction));
2794    children.add(new Property("basedOn", "Reference(ServiceRequest)",
2795        "The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).", 0,
2796        java.lang.Integer.MAX_VALUE, basedOn));
2797    children.add(new Property("participant", "", "List of participants involved in the appointment.", 0,
2798        java.lang.Integer.MAX_VALUE, participant));
2799    children.add(new Property("requestedPeriod", "Period",
2800        "A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.\n\nThe duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.",
2801        0, java.lang.Integer.MAX_VALUE, requestedPeriod));
2802  }
2803
2804  @Override
2805  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2806    switch (_hash) {
2807    case -1618432855:
2808      /* identifier */ return new Property("identifier", "Identifier",
2809          "This records identifiers associated with this appointment 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 (e.g. in CDA documents, or in written / printed documentation).",
2810          0, java.lang.Integer.MAX_VALUE, identifier);
2811    case -892481550:
2812      /* status */ return new Property("status", "code",
2813          "The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.",
2814          0, 1, status);
2815    case 987811551:
2816      /* cancelationReason */ return new Property("cancelationReason", "CodeableConcept",
2817          "The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.",
2818          0, 1, cancelationReason);
2819    case 1281188563:
2820      /* serviceCategory */ return new Property("serviceCategory", "CodeableConcept",
2821          "A broad categorization of the service that is to be performed during this appointment.", 0,
2822          java.lang.Integer.MAX_VALUE, serviceCategory);
2823    case -1928370289:
2824      /* serviceType */ return new Property("serviceType", "CodeableConcept",
2825          "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE,
2826          serviceType);
2827    case -1694759682:
2828      /* specialty */ return new Property("specialty", "CodeableConcept",
2829          "The specialty of a practitioner that would be required to perform the service requested in this appointment.",
2830          0, java.lang.Integer.MAX_VALUE, specialty);
2831    case -1596426375:
2832      /* appointmentType */ return new Property("appointmentType", "CodeableConcept",
2833          "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1,
2834          appointmentType);
2835    case 722137681:
2836      /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
2837          "The coded reason that this appointment is being scheduled. This is more clinical than administrative.", 0,
2838          java.lang.Integer.MAX_VALUE, reasonCode);
2839    case -1146218137:
2840      /* reasonReference */ return new Property("reasonReference",
2841          "Reference(Condition|Procedure|Observation|ImmunizationRecommendation)",
2842          "Reason the appointment has been scheduled to take place, as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.",
2843          0, java.lang.Integer.MAX_VALUE, reasonReference);
2844    case -1165461084:
2845      /* priority */ return new Property("priority", "unsignedInt",
2846          "The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).",
2847          0, 1, priority);
2848    case -1724546052:
2849      /* description */ return new Property("description", "string",
2850          "The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.",
2851          0, 1, description);
2852    case -1248768647:
2853      /* supportingInformation */ return new Property("supportingInformation", "Reference(Any)",
2854          "Additional information to support the appointment provided when making the appointment.", 0,
2855          java.lang.Integer.MAX_VALUE, supportingInformation);
2856    case 109757538:
2857      /* start */ return new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1,
2858          start);
2859    case 100571:
2860      /* end */ return new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end);
2861    case -413630573:
2862      /* minutesDuration */ return new Property("minutesDuration", "positiveInt",
2863          "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.",
2864          0, 1, minutesDuration);
2865    case 3533310:
2866      /* slot */ return new Property("slot", "Reference(Slot)",
2867          "The slots from the participants' schedules that will be filled by the appointment.", 0,
2868          java.lang.Integer.MAX_VALUE, slot);
2869    case 1028554472:
2870      /* created */ return new Property("created", "dateTime",
2871          "The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.",
2872          0, 1, created);
2873    case 950398559:
2874      /* comment */ return new Property("comment", "string", "Additional comments about the appointment.", 0, 1,
2875          comment);
2876    case 737543241:
2877      /* patientInstruction */ return new Property("patientInstruction", "string",
2878          "While Appointment.comment contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).",
2879          0, 1, patientInstruction);
2880    case -332612366:
2881      /* basedOn */ return new Property("basedOn", "Reference(ServiceRequest)",
2882          "The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).",
2883          0, java.lang.Integer.MAX_VALUE, basedOn);
2884    case 767422259:
2885      /* participant */ return new Property("participant", "", "List of participants involved in the appointment.", 0,
2886          java.lang.Integer.MAX_VALUE, participant);
2887    case -897241393:
2888      /* requestedPeriod */ return new Property("requestedPeriod", "Period",
2889          "A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.\n\nThe duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.",
2890          0, java.lang.Integer.MAX_VALUE, requestedPeriod);
2891    default:
2892      return super.getNamedProperty(_hash, _name, _checkValid);
2893    }
2894
2895  }
2896
2897  @Override
2898  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2899    switch (hash) {
2900    case -1618432855:
2901      /* identifier */ return this.identifier == null ? new Base[0]
2902          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2903    case -892481550:
2904      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<AppointmentStatus>
2905    case 987811551:
2906      /* cancelationReason */ return this.cancelationReason == null ? new Base[0]
2907          : new Base[] { this.cancelationReason }; // CodeableConcept
2908    case 1281188563:
2909      /* serviceCategory */ return this.serviceCategory == null ? new Base[0]
2910          : this.serviceCategory.toArray(new Base[this.serviceCategory.size()]); // CodeableConcept
2911    case -1928370289:
2912      /* serviceType */ return this.serviceType == null ? new Base[0]
2913          : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
2914    case -1694759682:
2915      /* specialty */ return this.specialty == null ? new Base[0]
2916          : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
2917    case -1596426375:
2918      /* appointmentType */ return this.appointmentType == null ? new Base[0] : new Base[] { this.appointmentType }; // CodeableConcept
2919    case 722137681:
2920      /* reasonCode */ return this.reasonCode == null ? new Base[0]
2921          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2922    case -1146218137:
2923      /* reasonReference */ return this.reasonReference == null ? new Base[0]
2924          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2925    case -1165461084:
2926      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // UnsignedIntType
2927    case -1724546052:
2928      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
2929    case -1248768647:
2930      /* supportingInformation */ return this.supportingInformation == null ? new Base[0]
2931          : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
2932    case 109757538:
2933      /* start */ return this.start == null ? new Base[0] : new Base[] { this.start }; // InstantType
2934    case 100571:
2935      /* end */ return this.end == null ? new Base[0] : new Base[] { this.end }; // InstantType
2936    case -413630573:
2937      /* minutesDuration */ return this.minutesDuration == null ? new Base[0] : new Base[] { this.minutesDuration }; // PositiveIntType
2938    case 3533310:
2939      /* slot */ return this.slot == null ? new Base[0] : this.slot.toArray(new Base[this.slot.size()]); // Reference
2940    case 1028554472:
2941      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
2942    case 950398559:
2943      /* comment */ return this.comment == null ? new Base[0] : new Base[] { this.comment }; // StringType
2944    case 737543241:
2945      /* patientInstruction */ return this.patientInstruction == null ? new Base[0]
2946          : new Base[] { this.patientInstruction }; // StringType
2947    case -332612366:
2948      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2949    case 767422259:
2950      /* participant */ return this.participant == null ? new Base[0]
2951          : this.participant.toArray(new Base[this.participant.size()]); // AppointmentParticipantComponent
2952    case -897241393:
2953      /* requestedPeriod */ return this.requestedPeriod == null ? new Base[0]
2954          : this.requestedPeriod.toArray(new Base[this.requestedPeriod.size()]); // Period
2955    default:
2956      return super.getProperty(hash, name, checkValid);
2957    }
2958
2959  }
2960
2961  @Override
2962  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2963    switch (hash) {
2964    case -1618432855: // identifier
2965      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2966      return value;
2967    case -892481550: // status
2968      value = new AppointmentStatusEnumFactory().fromType(castToCode(value));
2969      this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
2970      return value;
2971    case 987811551: // cancelationReason
2972      this.cancelationReason = castToCodeableConcept(value); // CodeableConcept
2973      return value;
2974    case 1281188563: // serviceCategory
2975      this.getServiceCategory().add(castToCodeableConcept(value)); // CodeableConcept
2976      return value;
2977    case -1928370289: // serviceType
2978      this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
2979      return value;
2980    case -1694759682: // specialty
2981      this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
2982      return value;
2983    case -1596426375: // appointmentType
2984      this.appointmentType = castToCodeableConcept(value); // CodeableConcept
2985      return value;
2986    case 722137681: // reasonCode
2987      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2988      return value;
2989    case -1146218137: // reasonReference
2990      this.getReasonReference().add(castToReference(value)); // Reference
2991      return value;
2992    case -1165461084: // priority
2993      this.priority = castToUnsignedInt(value); // UnsignedIntType
2994      return value;
2995    case -1724546052: // description
2996      this.description = castToString(value); // StringType
2997      return value;
2998    case -1248768647: // supportingInformation
2999      this.getSupportingInformation().add(castToReference(value)); // Reference
3000      return value;
3001    case 109757538: // start
3002      this.start = castToInstant(value); // InstantType
3003      return value;
3004    case 100571: // end
3005      this.end = castToInstant(value); // InstantType
3006      return value;
3007    case -413630573: // minutesDuration
3008      this.minutesDuration = castToPositiveInt(value); // PositiveIntType
3009      return value;
3010    case 3533310: // slot
3011      this.getSlot().add(castToReference(value)); // Reference
3012      return value;
3013    case 1028554472: // created
3014      this.created = castToDateTime(value); // DateTimeType
3015      return value;
3016    case 950398559: // comment
3017      this.comment = castToString(value); // StringType
3018      return value;
3019    case 737543241: // patientInstruction
3020      this.patientInstruction = castToString(value); // StringType
3021      return value;
3022    case -332612366: // basedOn
3023      this.getBasedOn().add(castToReference(value)); // Reference
3024      return value;
3025    case 767422259: // participant
3026      this.getParticipant().add((AppointmentParticipantComponent) value); // AppointmentParticipantComponent
3027      return value;
3028    case -897241393: // requestedPeriod
3029      this.getRequestedPeriod().add(castToPeriod(value)); // Period
3030      return value;
3031    default:
3032      return super.setProperty(hash, name, value);
3033    }
3034
3035  }
3036
3037  @Override
3038  public Base setProperty(String name, Base value) throws FHIRException {
3039    if (name.equals("identifier")) {
3040      this.getIdentifier().add(castToIdentifier(value));
3041    } else if (name.equals("status")) {
3042      value = new AppointmentStatusEnumFactory().fromType(castToCode(value));
3043      this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
3044    } else if (name.equals("cancelationReason")) {
3045      this.cancelationReason = castToCodeableConcept(value); // CodeableConcept
3046    } else if (name.equals("serviceCategory")) {
3047      this.getServiceCategory().add(castToCodeableConcept(value));
3048    } else if (name.equals("serviceType")) {
3049      this.getServiceType().add(castToCodeableConcept(value));
3050    } else if (name.equals("specialty")) {
3051      this.getSpecialty().add(castToCodeableConcept(value));
3052    } else if (name.equals("appointmentType")) {
3053      this.appointmentType = castToCodeableConcept(value); // CodeableConcept
3054    } else if (name.equals("reasonCode")) {
3055      this.getReasonCode().add(castToCodeableConcept(value));
3056    } else if (name.equals("reasonReference")) {
3057      this.getReasonReference().add(castToReference(value));
3058    } else if (name.equals("priority")) {
3059      this.priority = castToUnsignedInt(value); // UnsignedIntType
3060    } else if (name.equals("description")) {
3061      this.description = castToString(value); // StringType
3062    } else if (name.equals("supportingInformation")) {
3063      this.getSupportingInformation().add(castToReference(value));
3064    } else if (name.equals("start")) {
3065      this.start = castToInstant(value); // InstantType
3066    } else if (name.equals("end")) {
3067      this.end = castToInstant(value); // InstantType
3068    } else if (name.equals("minutesDuration")) {
3069      this.minutesDuration = castToPositiveInt(value); // PositiveIntType
3070    } else if (name.equals("slot")) {
3071      this.getSlot().add(castToReference(value));
3072    } else if (name.equals("created")) {
3073      this.created = castToDateTime(value); // DateTimeType
3074    } else if (name.equals("comment")) {
3075      this.comment = castToString(value); // StringType
3076    } else if (name.equals("patientInstruction")) {
3077      this.patientInstruction = castToString(value); // StringType
3078    } else if (name.equals("basedOn")) {
3079      this.getBasedOn().add(castToReference(value));
3080    } else if (name.equals("participant")) {
3081      this.getParticipant().add((AppointmentParticipantComponent) value);
3082    } else if (name.equals("requestedPeriod")) {
3083      this.getRequestedPeriod().add(castToPeriod(value));
3084    } else
3085      return super.setProperty(name, value);
3086    return value;
3087  }
3088
3089  @Override
3090  public void removeChild(String name, Base value) throws FHIRException {
3091    if (name.equals("identifier")) {
3092      this.getIdentifier().remove(castToIdentifier(value));
3093    } else if (name.equals("status")) {
3094      this.status = null;
3095    } else if (name.equals("cancelationReason")) {
3096      this.cancelationReason = null;
3097    } else if (name.equals("serviceCategory")) {
3098      this.getServiceCategory().remove(castToCodeableConcept(value));
3099    } else if (name.equals("serviceType")) {
3100      this.getServiceType().remove(castToCodeableConcept(value));
3101    } else if (name.equals("specialty")) {
3102      this.getSpecialty().remove(castToCodeableConcept(value));
3103    } else if (name.equals("appointmentType")) {
3104      this.appointmentType = null;
3105    } else if (name.equals("reasonCode")) {
3106      this.getReasonCode().remove(castToCodeableConcept(value));
3107    } else if (name.equals("reasonReference")) {
3108      this.getReasonReference().remove(castToReference(value));
3109    } else if (name.equals("priority")) {
3110      this.priority = null;
3111    } else if (name.equals("description")) {
3112      this.description = null;
3113    } else if (name.equals("supportingInformation")) {
3114      this.getSupportingInformation().remove(castToReference(value));
3115    } else if (name.equals("start")) {
3116      this.start = null;
3117    } else if (name.equals("end")) {
3118      this.end = null;
3119    } else if (name.equals("minutesDuration")) {
3120      this.minutesDuration = null;
3121    } else if (name.equals("slot")) {
3122      this.getSlot().remove(castToReference(value));
3123    } else if (name.equals("created")) {
3124      this.created = null;
3125    } else if (name.equals("comment")) {
3126      this.comment = null;
3127    } else if (name.equals("patientInstruction")) {
3128      this.patientInstruction = null;
3129    } else if (name.equals("basedOn")) {
3130      this.getBasedOn().remove(castToReference(value));
3131    } else if (name.equals("participant")) {
3132      this.getParticipant().remove((AppointmentParticipantComponent) value);
3133    } else if (name.equals("requestedPeriod")) {
3134      this.getRequestedPeriod().remove(castToPeriod(value));
3135    } else
3136      super.removeChild(name, value);
3137    
3138  }
3139
3140  @Override
3141  public Base makeProperty(int hash, String name) throws FHIRException {
3142    switch (hash) {
3143    case -1618432855:
3144      return addIdentifier();
3145    case -892481550:
3146      return getStatusElement();
3147    case 987811551:
3148      return getCancelationReason();
3149    case 1281188563:
3150      return addServiceCategory();
3151    case -1928370289:
3152      return addServiceType();
3153    case -1694759682:
3154      return addSpecialty();
3155    case -1596426375:
3156      return getAppointmentType();
3157    case 722137681:
3158      return addReasonCode();
3159    case -1146218137:
3160      return addReasonReference();
3161    case -1165461084:
3162      return getPriorityElement();
3163    case -1724546052:
3164      return getDescriptionElement();
3165    case -1248768647:
3166      return addSupportingInformation();
3167    case 109757538:
3168      return getStartElement();
3169    case 100571:
3170      return getEndElement();
3171    case -413630573:
3172      return getMinutesDurationElement();
3173    case 3533310:
3174      return addSlot();
3175    case 1028554472:
3176      return getCreatedElement();
3177    case 950398559:
3178      return getCommentElement();
3179    case 737543241:
3180      return getPatientInstructionElement();
3181    case -332612366:
3182      return addBasedOn();
3183    case 767422259:
3184      return addParticipant();
3185    case -897241393:
3186      return addRequestedPeriod();
3187    default:
3188      return super.makeProperty(hash, name);
3189    }
3190
3191  }
3192
3193  @Override
3194  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3195    switch (hash) {
3196    case -1618432855:
3197      /* identifier */ return new String[] { "Identifier" };
3198    case -892481550:
3199      /* status */ return new String[] { "code" };
3200    case 987811551:
3201      /* cancelationReason */ return new String[] { "CodeableConcept" };
3202    case 1281188563:
3203      /* serviceCategory */ return new String[] { "CodeableConcept" };
3204    case -1928370289:
3205      /* serviceType */ return new String[] { "CodeableConcept" };
3206    case -1694759682:
3207      /* specialty */ return new String[] { "CodeableConcept" };
3208    case -1596426375:
3209      /* appointmentType */ return new String[] { "CodeableConcept" };
3210    case 722137681:
3211      /* reasonCode */ return new String[] { "CodeableConcept" };
3212    case -1146218137:
3213      /* reasonReference */ return new String[] { "Reference" };
3214    case -1165461084:
3215      /* priority */ return new String[] { "unsignedInt" };
3216    case -1724546052:
3217      /* description */ return new String[] { "string" };
3218    case -1248768647:
3219      /* supportingInformation */ return new String[] { "Reference" };
3220    case 109757538:
3221      /* start */ return new String[] { "instant" };
3222    case 100571:
3223      /* end */ return new String[] { "instant" };
3224    case -413630573:
3225      /* minutesDuration */ return new String[] { "positiveInt" };
3226    case 3533310:
3227      /* slot */ return new String[] { "Reference" };
3228    case 1028554472:
3229      /* created */ return new String[] { "dateTime" };
3230    case 950398559:
3231      /* comment */ return new String[] { "string" };
3232    case 737543241:
3233      /* patientInstruction */ return new String[] { "string" };
3234    case -332612366:
3235      /* basedOn */ return new String[] { "Reference" };
3236    case 767422259:
3237      /* participant */ return new String[] {};
3238    case -897241393:
3239      /* requestedPeriod */ return new String[] { "Period" };
3240    default:
3241      return super.getTypesForProperty(hash, name);
3242    }
3243
3244  }
3245
3246  @Override
3247  public Base addChild(String name) throws FHIRException {
3248    if (name.equals("identifier")) {
3249      return addIdentifier();
3250    } else if (name.equals("status")) {
3251      throw new FHIRException("Cannot call addChild on a singleton property Appointment.status");
3252    } else if (name.equals("cancelationReason")) {
3253      this.cancelationReason = new CodeableConcept();
3254      return this.cancelationReason;
3255    } else if (name.equals("serviceCategory")) {
3256      return addServiceCategory();
3257    } else if (name.equals("serviceType")) {
3258      return addServiceType();
3259    } else if (name.equals("specialty")) {
3260      return addSpecialty();
3261    } else if (name.equals("appointmentType")) {
3262      this.appointmentType = new CodeableConcept();
3263      return this.appointmentType;
3264    } else if (name.equals("reasonCode")) {
3265      return addReasonCode();
3266    } else if (name.equals("reasonReference")) {
3267      return addReasonReference();
3268    } else if (name.equals("priority")) {
3269      throw new FHIRException("Cannot call addChild on a singleton property Appointment.priority");
3270    } else if (name.equals("description")) {
3271      throw new FHIRException("Cannot call addChild on a singleton property Appointment.description");
3272    } else if (name.equals("supportingInformation")) {
3273      return addSupportingInformation();
3274    } else if (name.equals("start")) {
3275      throw new FHIRException("Cannot call addChild on a singleton property Appointment.start");
3276    } else if (name.equals("end")) {
3277      throw new FHIRException("Cannot call addChild on a singleton property Appointment.end");
3278    } else if (name.equals("minutesDuration")) {
3279      throw new FHIRException("Cannot call addChild on a singleton property Appointment.minutesDuration");
3280    } else if (name.equals("slot")) {
3281      return addSlot();
3282    } else if (name.equals("created")) {
3283      throw new FHIRException("Cannot call addChild on a singleton property Appointment.created");
3284    } else if (name.equals("comment")) {
3285      throw new FHIRException("Cannot call addChild on a singleton property Appointment.comment");
3286    } else if (name.equals("patientInstruction")) {
3287      throw new FHIRException("Cannot call addChild on a singleton property Appointment.patientInstruction");
3288    } else if (name.equals("basedOn")) {
3289      return addBasedOn();
3290    } else if (name.equals("participant")) {
3291      return addParticipant();
3292    } else if (name.equals("requestedPeriod")) {
3293      return addRequestedPeriod();
3294    } else
3295      return super.addChild(name);
3296  }
3297
3298  public String fhirType() {
3299    return "Appointment";
3300
3301  }
3302
3303  public Appointment copy() {
3304    Appointment dst = new Appointment();
3305    copyValues(dst);
3306    return dst;
3307  }
3308
3309  public void copyValues(Appointment dst) {
3310    super.copyValues(dst);
3311    if (identifier != null) {
3312      dst.identifier = new ArrayList<Identifier>();
3313      for (Identifier i : identifier)
3314        dst.identifier.add(i.copy());
3315    }
3316    ;
3317    dst.status = status == null ? null : status.copy();
3318    dst.cancelationReason = cancelationReason == null ? null : cancelationReason.copy();
3319    if (serviceCategory != null) {
3320      dst.serviceCategory = new ArrayList<CodeableConcept>();
3321      for (CodeableConcept i : serviceCategory)
3322        dst.serviceCategory.add(i.copy());
3323    }
3324    ;
3325    if (serviceType != null) {
3326      dst.serviceType = new ArrayList<CodeableConcept>();
3327      for (CodeableConcept i : serviceType)
3328        dst.serviceType.add(i.copy());
3329    }
3330    ;
3331    if (specialty != null) {
3332      dst.specialty = new ArrayList<CodeableConcept>();
3333      for (CodeableConcept i : specialty)
3334        dst.specialty.add(i.copy());
3335    }
3336    ;
3337    dst.appointmentType = appointmentType == null ? null : appointmentType.copy();
3338    if (reasonCode != null) {
3339      dst.reasonCode = new ArrayList<CodeableConcept>();
3340      for (CodeableConcept i : reasonCode)
3341        dst.reasonCode.add(i.copy());
3342    }
3343    ;
3344    if (reasonReference != null) {
3345      dst.reasonReference = new ArrayList<Reference>();
3346      for (Reference i : reasonReference)
3347        dst.reasonReference.add(i.copy());
3348    }
3349    ;
3350    dst.priority = priority == null ? null : priority.copy();
3351    dst.description = description == null ? null : description.copy();
3352    if (supportingInformation != null) {
3353      dst.supportingInformation = new ArrayList<Reference>();
3354      for (Reference i : supportingInformation)
3355        dst.supportingInformation.add(i.copy());
3356    }
3357    ;
3358    dst.start = start == null ? null : start.copy();
3359    dst.end = end == null ? null : end.copy();
3360    dst.minutesDuration = minutesDuration == null ? null : minutesDuration.copy();
3361    if (slot != null) {
3362      dst.slot = new ArrayList<Reference>();
3363      for (Reference i : slot)
3364        dst.slot.add(i.copy());
3365    }
3366    ;
3367    dst.created = created == null ? null : created.copy();
3368    dst.comment = comment == null ? null : comment.copy();
3369    dst.patientInstruction = patientInstruction == null ? null : patientInstruction.copy();
3370    if (basedOn != null) {
3371      dst.basedOn = new ArrayList<Reference>();
3372      for (Reference i : basedOn)
3373        dst.basedOn.add(i.copy());
3374    }
3375    ;
3376    if (participant != null) {
3377      dst.participant = new ArrayList<AppointmentParticipantComponent>();
3378      for (AppointmentParticipantComponent i : participant)
3379        dst.participant.add(i.copy());
3380    }
3381    ;
3382    if (requestedPeriod != null) {
3383      dst.requestedPeriod = new ArrayList<Period>();
3384      for (Period i : requestedPeriod)
3385        dst.requestedPeriod.add(i.copy());
3386    }
3387    ;
3388  }
3389
3390  protected Appointment typedCopy() {
3391    return copy();
3392  }
3393
3394  @Override
3395  public boolean equalsDeep(Base other_) {
3396    if (!super.equalsDeep(other_))
3397      return false;
3398    if (!(other_ instanceof Appointment))
3399      return false;
3400    Appointment o = (Appointment) other_;
3401    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
3402        && compareDeep(cancelationReason, o.cancelationReason, true)
3403        && compareDeep(serviceCategory, o.serviceCategory, true) && compareDeep(serviceType, o.serviceType, true)
3404        && compareDeep(specialty, o.specialty, true) && compareDeep(appointmentType, o.appointmentType, true)
3405        && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
3406        && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true)
3407        && compareDeep(supportingInformation, o.supportingInformation, true) && compareDeep(start, o.start, true)
3408        && compareDeep(end, o.end, true) && compareDeep(minutesDuration, o.minutesDuration, true)
3409        && compareDeep(slot, o.slot, true) && compareDeep(created, o.created, true)
3410        && compareDeep(comment, o.comment, true) && compareDeep(patientInstruction, o.patientInstruction, true)
3411        && compareDeep(basedOn, o.basedOn, true) && compareDeep(participant, o.participant, true)
3412        && compareDeep(requestedPeriod, o.requestedPeriod, true);
3413  }
3414
3415  @Override
3416  public boolean equalsShallow(Base other_) {
3417    if (!super.equalsShallow(other_))
3418      return false;
3419    if (!(other_ instanceof Appointment))
3420      return false;
3421    Appointment o = (Appointment) other_;
3422    return compareValues(status, o.status, true) && compareValues(priority, o.priority, true)
3423        && compareValues(description, o.description, true) && compareValues(start, o.start, true)
3424        && compareValues(end, o.end, true) && compareValues(minutesDuration, o.minutesDuration, true)
3425        && compareValues(created, o.created, true) && compareValues(comment, o.comment, true)
3426        && compareValues(patientInstruction, o.patientInstruction, true);
3427  }
3428
3429  public boolean isEmpty() {
3430    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, cancelationReason,
3431        serviceCategory, serviceType, specialty, appointmentType, reasonCode, reasonReference, priority, description,
3432        supportingInformation, start, end, minutesDuration, slot, created, comment, patientInstruction, basedOn,
3433        participant, requestedPeriod);
3434  }
3435
3436  @Override
3437  public ResourceType getResourceType() {
3438    return ResourceType.Appointment;
3439  }
3440
3441  /**
3442   * Search parameter: <b>date</b>
3443   * <p>
3444   * Description: <b>Appointment date/time.</b><br>
3445   * Type: <b>date</b><br>
3446   * Path: <b>Appointment.start</b><br>
3447   * </p>
3448   */
3449  @SearchParamDefinition(name = "date", path = "Appointment.start", description = "Appointment date/time.", type = "date")
3450  public static final String SP_DATE = "date";
3451  /**
3452   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3453   * <p>
3454   * Description: <b>Appointment date/time.</b><br>
3455   * Type: <b>date</b><br>
3456   * Path: <b>Appointment.start</b><br>
3457   * </p>
3458   */
3459  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3460      SP_DATE);
3461
3462  /**
3463   * Search parameter: <b>identifier</b>
3464   * <p>
3465   * Description: <b>An Identifier of the Appointment</b><br>
3466   * Type: <b>token</b><br>
3467   * Path: <b>Appointment.identifier</b><br>
3468   * </p>
3469   */
3470  @SearchParamDefinition(name = "identifier", path = "Appointment.identifier", description = "An Identifier of the Appointment", type = "token")
3471  public static final String SP_IDENTIFIER = "identifier";
3472  /**
3473   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3474   * <p>
3475   * Description: <b>An Identifier of the Appointment</b><br>
3476   * Type: <b>token</b><br>
3477   * Path: <b>Appointment.identifier</b><br>
3478   * </p>
3479   */
3480  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3481      SP_IDENTIFIER);
3482
3483  /**
3484   * Search parameter: <b>specialty</b>
3485   * <p>
3486   * Description: <b>The specialty of a practitioner that would be required to
3487   * perform the service requested in this appointment</b><br>
3488   * Type: <b>token</b><br>
3489   * Path: <b>Appointment.specialty</b><br>
3490   * </p>
3491   */
3492  @SearchParamDefinition(name = "specialty", path = "Appointment.specialty", description = "The specialty of a practitioner that would be required to perform the service requested in this appointment", type = "token")
3493  public static final String SP_SPECIALTY = "specialty";
3494  /**
3495   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
3496   * <p>
3497   * Description: <b>The specialty of a practitioner that would be required to
3498   * perform the service requested in this appointment</b><br>
3499   * Type: <b>token</b><br>
3500   * Path: <b>Appointment.specialty</b><br>
3501   * </p>
3502   */
3503  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3504      SP_SPECIALTY);
3505
3506  /**
3507   * Search parameter: <b>service-category</b>
3508   * <p>
3509   * Description: <b>A broad categorization of the service that is to be performed
3510   * during this appointment</b><br>
3511   * Type: <b>token</b><br>
3512   * Path: <b>Appointment.serviceCategory</b><br>
3513   * </p>
3514   */
3515  @SearchParamDefinition(name = "service-category", path = "Appointment.serviceCategory", description = "A broad categorization of the service that is to be performed during this appointment", type = "token")
3516  public static final String SP_SERVICE_CATEGORY = "service-category";
3517  /**
3518   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
3519   * <p>
3520   * Description: <b>A broad categorization of the service that is to be performed
3521   * during this appointment</b><br>
3522   * Type: <b>token</b><br>
3523   * Path: <b>Appointment.serviceCategory</b><br>
3524   * </p>
3525   */
3526  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3527      SP_SERVICE_CATEGORY);
3528
3529  /**
3530   * Search parameter: <b>practitioner</b>
3531   * <p>
3532   * Description: <b>One of the individuals of the appointment is this
3533   * practitioner</b><br>
3534   * Type: <b>reference</b><br>
3535   * Path: <b>Appointment.participant.actor</b><br>
3536   * </p>
3537   */
3538  @SearchParamDefinition(name = "practitioner", path = "Appointment.participant.actor.where(resolve() is Practitioner)", description = "One of the individuals of the appointment is this practitioner", type = "reference", target = {
3539      Practitioner.class })
3540  public static final String SP_PRACTITIONER = "practitioner";
3541  /**
3542   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
3543   * <p>
3544   * Description: <b>One of the individuals of the appointment is this
3545   * practitioner</b><br>
3546   * Type: <b>reference</b><br>
3547   * Path: <b>Appointment.participant.actor</b><br>
3548   * </p>
3549   */
3550  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3551      SP_PRACTITIONER);
3552
3553  /**
3554   * Constant for fluent queries to be used to add include statements. Specifies
3555   * the path value of "<b>Appointment:practitioner</b>".
3556   */
3557  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include(
3558      "Appointment:practitioner").toLocked();
3559
3560  /**
3561   * Search parameter: <b>part-status</b>
3562   * <p>
3563   * Description: <b>The Participation status of the subject, or other participant
3564   * on the appointment. Can be used to locate participants that have not
3565   * responded to meeting requests.</b><br>
3566   * Type: <b>token</b><br>
3567   * Path: <b>Appointment.participant.status</b><br>
3568   * </p>
3569   */
3570  @SearchParamDefinition(name = "part-status", path = "Appointment.participant.status", description = "The Participation status of the subject, or other participant on the appointment. Can be used to locate participants that have not responded to meeting requests.", type = "token")
3571  public static final String SP_PART_STATUS = "part-status";
3572  /**
3573   * <b>Fluent Client</b> search parameter constant for <b>part-status</b>
3574   * <p>
3575   * Description: <b>The Participation status of the subject, or other participant
3576   * on the appointment. Can be used to locate participants that have not
3577   * responded to meeting requests.</b><br>
3578   * Type: <b>token</b><br>
3579   * Path: <b>Appointment.participant.status</b><br>
3580   * </p>
3581   */
3582  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PART_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3583      SP_PART_STATUS);
3584
3585  /**
3586   * Search parameter: <b>appointment-type</b>
3587   * <p>
3588   * Description: <b>The style of appointment or patient that has been booked in
3589   * the slot (not service type)</b><br>
3590   * Type: <b>token</b><br>
3591   * Path: <b>Appointment.appointmentType</b><br>
3592   * </p>
3593   */
3594  @SearchParamDefinition(name = "appointment-type", path = "Appointment.appointmentType", description = "The style of appointment or patient that has been booked in the slot (not service type)", type = "token")
3595  public static final String SP_APPOINTMENT_TYPE = "appointment-type";
3596  /**
3597   * <b>Fluent Client</b> search parameter constant for <b>appointment-type</b>
3598   * <p>
3599   * Description: <b>The style of appointment or patient that has been booked in
3600   * the slot (not service type)</b><br>
3601   * Type: <b>token</b><br>
3602   * Path: <b>Appointment.appointmentType</b><br>
3603   * </p>
3604   */
3605  public static final ca.uhn.fhir.rest.gclient.TokenClientParam APPOINTMENT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3606      SP_APPOINTMENT_TYPE);
3607
3608  /**
3609   * Search parameter: <b>service-type</b>
3610   * <p>
3611   * Description: <b>The specific service that is to be performed during this
3612   * appointment</b><br>
3613   * Type: <b>token</b><br>
3614   * Path: <b>Appointment.serviceType</b><br>
3615   * </p>
3616   */
3617  @SearchParamDefinition(name = "service-type", path = "Appointment.serviceType", description = "The specific service that is to be performed during this appointment", type = "token")
3618  public static final String SP_SERVICE_TYPE = "service-type";
3619  /**
3620   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
3621   * <p>
3622   * Description: <b>The specific service that is to be performed during this
3623   * appointment</b><br>
3624   * Type: <b>token</b><br>
3625   * Path: <b>Appointment.serviceType</b><br>
3626   * </p>
3627   */
3628  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3629      SP_SERVICE_TYPE);
3630
3631  /**
3632   * Search parameter: <b>slot</b>
3633   * <p>
3634   * Description: <b>The slots that this appointment is filling</b><br>
3635   * Type: <b>reference</b><br>
3636   * Path: <b>Appointment.slot</b><br>
3637   * </p>
3638   */
3639  @SearchParamDefinition(name = "slot", path = "Appointment.slot", description = "The slots that this appointment is filling", type = "reference", target = {
3640      Slot.class })
3641  public static final String SP_SLOT = "slot";
3642  /**
3643   * <b>Fluent Client</b> search parameter constant for <b>slot</b>
3644   * <p>
3645   * Description: <b>The slots that this appointment is filling</b><br>
3646   * Type: <b>reference</b><br>
3647   * Path: <b>Appointment.slot</b><br>
3648   * </p>
3649   */
3650  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SLOT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3651      SP_SLOT);
3652
3653  /**
3654   * Constant for fluent queries to be used to add include statements. Specifies
3655   * the path value of "<b>Appointment:slot</b>".
3656   */
3657  public static final ca.uhn.fhir.model.api.Include INCLUDE_SLOT = new ca.uhn.fhir.model.api.Include("Appointment:slot")
3658      .toLocked();
3659
3660  /**
3661   * Search parameter: <b>reason-code</b>
3662   * <p>
3663   * Description: <b>Coded reason this appointment is scheduled</b><br>
3664   * Type: <b>token</b><br>
3665   * Path: <b>Appointment.reasonCode</b><br>
3666   * </p>
3667   */
3668  @SearchParamDefinition(name = "reason-code", path = "Appointment.reasonCode", description = "Coded reason this appointment is scheduled", type = "token")
3669  public static final String SP_REASON_CODE = "reason-code";
3670  /**
3671   * <b>Fluent Client</b> search parameter constant for <b>reason-code</b>
3672   * <p>
3673   * Description: <b>Coded reason this appointment is scheduled</b><br>
3674   * Type: <b>token</b><br>
3675   * Path: <b>Appointment.reasonCode</b><br>
3676   * </p>
3677   */
3678  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3679      SP_REASON_CODE);
3680
3681  /**
3682   * Search parameter: <b>actor</b>
3683   * <p>
3684   * Description: <b>Any one of the individuals participating in the
3685   * appointment</b><br>
3686   * Type: <b>reference</b><br>
3687   * Path: <b>Appointment.participant.actor</b><br>
3688   * </p>
3689   */
3690  @SearchParamDefinition(name = "actor", path = "Appointment.participant.actor", description = "Any one of the individuals participating in the appointment", type = "reference", providesMembershipIn = {
3691      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3692      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
3693      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
3694      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class,
3695          HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class,
3696          RelatedPerson.class })
3697  public static final String SP_ACTOR = "actor";
3698  /**
3699   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
3700   * <p>
3701   * Description: <b>Any one of the individuals participating in the
3702   * appointment</b><br>
3703   * Type: <b>reference</b><br>
3704   * Path: <b>Appointment.participant.actor</b><br>
3705   * </p>
3706   */
3707  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3708      SP_ACTOR);
3709
3710  /**
3711   * Constant for fluent queries to be used to add include statements. Specifies
3712   * the path value of "<b>Appointment:actor</b>".
3713   */
3714  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include(
3715      "Appointment:actor").toLocked();
3716
3717  /**
3718   * Search parameter: <b>based-on</b>
3719   * <p>
3720   * Description: <b>The service request this appointment is allocated to
3721   * assess</b><br>
3722   * Type: <b>reference</b><br>
3723   * Path: <b>Appointment.basedOn</b><br>
3724   * </p>
3725   */
3726  @SearchParamDefinition(name = "based-on", path = "Appointment.basedOn", description = "The service request this appointment is allocated to assess", type = "reference", target = {
3727      ServiceRequest.class })
3728  public static final String SP_BASED_ON = "based-on";
3729  /**
3730   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
3731   * <p>
3732   * Description: <b>The service request this appointment is allocated to
3733   * assess</b><br>
3734   * Type: <b>reference</b><br>
3735   * Path: <b>Appointment.basedOn</b><br>
3736   * </p>
3737   */
3738  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3739      SP_BASED_ON);
3740
3741  /**
3742   * Constant for fluent queries to be used to add include statements. Specifies
3743   * the path value of "<b>Appointment:based-on</b>".
3744   */
3745  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include(
3746      "Appointment:based-on").toLocked();
3747
3748  /**
3749   * Search parameter: <b>patient</b>
3750   * <p>
3751   * Description: <b>One of the individuals of the appointment is this
3752   * patient</b><br>
3753   * Type: <b>reference</b><br>
3754   * Path: <b>Appointment.participant.actor</b><br>
3755   * </p>
3756   */
3757  @SearchParamDefinition(name = "patient", path = "Appointment.participant.actor.where(resolve() is Patient)", description = "One of the individuals of the appointment is this patient", type = "reference", target = {
3758      Patient.class })
3759  public static final String SP_PATIENT = "patient";
3760  /**
3761   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3762   * <p>
3763   * Description: <b>One of the individuals of the appointment is this
3764   * patient</b><br>
3765   * Type: <b>reference</b><br>
3766   * Path: <b>Appointment.participant.actor</b><br>
3767   * </p>
3768   */
3769  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3770      SP_PATIENT);
3771
3772  /**
3773   * Constant for fluent queries to be used to add include statements. Specifies
3774   * the path value of "<b>Appointment:patient</b>".
3775   */
3776  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
3777      "Appointment:patient").toLocked();
3778
3779  /**
3780   * Search parameter: <b>reason-reference</b>
3781   * <p>
3782   * Description: <b>Reason the appointment is to take place (resource)</b><br>
3783   * Type: <b>reference</b><br>
3784   * Path: <b>Appointment.reasonReference</b><br>
3785   * </p>
3786   */
3787  @SearchParamDefinition(name = "reason-reference", path = "Appointment.reasonReference", description = "Reason the appointment is to take place (resource)", type = "reference", target = {
3788      Condition.class, ImmunizationRecommendation.class, Observation.class, Procedure.class })
3789  public static final String SP_REASON_REFERENCE = "reason-reference";
3790  /**
3791   * <b>Fluent Client</b> search parameter constant for <b>reason-reference</b>
3792   * <p>
3793   * Description: <b>Reason the appointment is to take place (resource)</b><br>
3794   * Type: <b>reference</b><br>
3795   * Path: <b>Appointment.reasonReference</b><br>
3796   * </p>
3797   */
3798  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REASON_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3799      SP_REASON_REFERENCE);
3800
3801  /**
3802   * Constant for fluent queries to be used to add include statements. Specifies
3803   * the path value of "<b>Appointment:reason-reference</b>".
3804   */
3805  public static final ca.uhn.fhir.model.api.Include INCLUDE_REASON_REFERENCE = new ca.uhn.fhir.model.api.Include(
3806      "Appointment:reason-reference").toLocked();
3807
3808  /**
3809   * Search parameter: <b>supporting-info</b>
3810   * <p>
3811   * Description: <b>Additional information to support the appointment</b><br>
3812   * Type: <b>reference</b><br>
3813   * Path: <b>Appointment.supportingInformation</b><br>
3814   * </p>
3815   */
3816  @SearchParamDefinition(name = "supporting-info", path = "Appointment.supportingInformation", description = "Additional information to support the appointment", type = "reference")
3817  public static final String SP_SUPPORTING_INFO = "supporting-info";
3818  /**
3819   * <b>Fluent Client</b> search parameter constant for <b>supporting-info</b>
3820   * <p>
3821   * Description: <b>Additional information to support the appointment</b><br>
3822   * Type: <b>reference</b><br>
3823   * Path: <b>Appointment.supportingInformation</b><br>
3824   * </p>
3825   */
3826  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPORTING_INFO = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3827      SP_SUPPORTING_INFO);
3828
3829  /**
3830   * Constant for fluent queries to be used to add include statements. Specifies
3831   * the path value of "<b>Appointment:supporting-info</b>".
3832   */
3833  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPORTING_INFO = new ca.uhn.fhir.model.api.Include(
3834      "Appointment:supporting-info").toLocked();
3835
3836  /**
3837   * Search parameter: <b>location</b>
3838   * <p>
3839   * Description: <b>This location is listed in the participants of the
3840   * appointment</b><br>
3841   * Type: <b>reference</b><br>
3842   * Path: <b>Appointment.participant.actor</b><br>
3843   * </p>
3844   */
3845  @SearchParamDefinition(name = "location", path = "Appointment.participant.actor.where(resolve() is Location)", description = "This location is listed in the participants of the appointment", type = "reference", target = {
3846      Location.class })
3847  public static final String SP_LOCATION = "location";
3848  /**
3849   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3850   * <p>
3851   * Description: <b>This location is listed in the participants of the
3852   * appointment</b><br>
3853   * Type: <b>reference</b><br>
3854   * Path: <b>Appointment.participant.actor</b><br>
3855   * </p>
3856   */
3857  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3858      SP_LOCATION);
3859
3860  /**
3861   * Constant for fluent queries to be used to add include statements. Specifies
3862   * the path value of "<b>Appointment:location</b>".
3863   */
3864  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include(
3865      "Appointment:location").toLocked();
3866
3867  /**
3868   * Search parameter: <b>status</b>
3869   * <p>
3870   * Description: <b>The overall status of the appointment</b><br>
3871   * Type: <b>token</b><br>
3872   * Path: <b>Appointment.status</b><br>
3873   * </p>
3874   */
3875  @SearchParamDefinition(name = "status", path = "Appointment.status", description = "The overall status of the appointment", type = "token")
3876  public static final String SP_STATUS = "status";
3877  /**
3878   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3879   * <p>
3880   * Description: <b>The overall status of the appointment</b><br>
3881   * Type: <b>token</b><br>
3882   * Path: <b>Appointment.status</b><br>
3883   * </p>
3884   */
3885  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3886      SP_STATUS);
3887
3888}