001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s).
070 */
071@ResourceDef(name="Appointment", profile="http://hl7.org/fhir/StructureDefinition/Appointment")
072public class Appointment extends DomainResource {
073
074    public enum AppointmentStatus {
075        /**
076         * None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time might not be set yet.
077         */
078        PROPOSED, 
079        /**
080         * Some or all of the participant(s) have not finalized their acceptance of the appointment request.
081         */
082        PENDING, 
083        /**
084         * All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.
085         */
086        BOOKED, 
087        /**
088         * The patient/patients has/have arrived and is/are waiting to be seen.
089         */
090        ARRIVED, 
091        /**
092         * 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.
093         */
094        FULFILLED, 
095        /**
096         * The appointment has been cancelled.
097         */
098        CANCELLED, 
099        /**
100         * Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).
101         */
102        NOSHOW, 
103        /**
104         * This instance should not have been part of this patient's medical record.
105         */
106        ENTEREDINERROR, 
107        /**
108         * When checked in, all pre-encounter administrative work is complete, and the encounter may begin. (where multiple patients are involved, they are all present).
109         */
110        CHECKEDIN, 
111        /**
112         * The appointment has been placed on a waitlist, to be scheduled/confirmed in the future when a slot/service is available.
113A specific time might or might not be pre-allocated.
114         */
115        WAITLIST, 
116        /**
117         * added to help the parsers with the generic types
118         */
119        NULL;
120        public static AppointmentStatus fromCode(String codeString) throws FHIRException {
121            if (codeString == null || "".equals(codeString))
122                return null;
123        if ("proposed".equals(codeString))
124          return PROPOSED;
125        if ("pending".equals(codeString))
126          return PENDING;
127        if ("booked".equals(codeString))
128          return BOOKED;
129        if ("arrived".equals(codeString))
130          return ARRIVED;
131        if ("fulfilled".equals(codeString))
132          return FULFILLED;
133        if ("cancelled".equals(codeString))
134          return CANCELLED;
135        if ("noshow".equals(codeString))
136          return NOSHOW;
137        if ("entered-in-error".equals(codeString))
138          return ENTEREDINERROR;
139        if ("checked-in".equals(codeString))
140          return CHECKEDIN;
141        if ("waitlist".equals(codeString))
142          return WAITLIST;
143        if (Configuration.isAcceptInvalidEnums())
144          return null;
145        else
146          throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'");
147        }
148        public String toCode() {
149          switch (this) {
150            case PROPOSED: return "proposed";
151            case PENDING: return "pending";
152            case BOOKED: return "booked";
153            case ARRIVED: return "arrived";
154            case FULFILLED: return "fulfilled";
155            case CANCELLED: return "cancelled";
156            case NOSHOW: return "noshow";
157            case ENTEREDINERROR: return "entered-in-error";
158            case CHECKEDIN: return "checked-in";
159            case WAITLIST: return "waitlist";
160            default: return "?";
161          }
162        }
163        public String getSystem() {
164          switch (this) {
165            case PROPOSED: return "http://hl7.org/fhir/appointmentstatus";
166            case PENDING: return "http://hl7.org/fhir/appointmentstatus";
167            case BOOKED: return "http://hl7.org/fhir/appointmentstatus";
168            case ARRIVED: return "http://hl7.org/fhir/appointmentstatus";
169            case FULFILLED: return "http://hl7.org/fhir/appointmentstatus";
170            case CANCELLED: return "http://hl7.org/fhir/appointmentstatus";
171            case NOSHOW: return "http://hl7.org/fhir/appointmentstatus";
172            case ENTEREDINERROR: return "http://hl7.org/fhir/appointmentstatus";
173            case CHECKEDIN: return "http://hl7.org/fhir/appointmentstatus";
174            case WAITLIST: return "http://hl7.org/fhir/appointmentstatus";
175            default: return "?";
176          }
177        }
178        public String getDefinition() {
179          switch (this) {
180            case PROPOSED: return "None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time might not be set yet.";
181            case PENDING: return "Some or all of the participant(s) have not finalized their acceptance of the appointment request.";
182            case BOOKED: return "All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.";
183            case ARRIVED: return "The patient/patients has/have arrived and is/are waiting to be seen.";
184            case FULFILLED: 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.";
185            case CANCELLED: return "The appointment has been cancelled.";
186            case NOSHOW: return "Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).";
187            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
188            case CHECKEDIN: 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).";
189            case WAITLIST: 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.";
190            default: return "?";
191          }
192        }
193        public String getDisplay() {
194          switch (this) {
195            case PROPOSED: return "Proposed";
196            case PENDING: return "Pending";
197            case BOOKED: return "Booked";
198            case ARRIVED: return "Arrived";
199            case FULFILLED: return "Fulfilled";
200            case CANCELLED: return "Cancelled";
201            case NOSHOW: return "No Show";
202            case ENTEREDINERROR: return "Entered in error";
203            case CHECKEDIN: return "Checked In";
204            case WAITLIST: return "Waitlisted";
205            default: return "?";
206          }
207        }
208    }
209
210  public static class AppointmentStatusEnumFactory implements EnumFactory<AppointmentStatus> {
211    public AppointmentStatus fromCode(String codeString) throws IllegalArgumentException {
212      if (codeString == null || "".equals(codeString))
213            if (codeString == null || "".equals(codeString))
214                return null;
215        if ("proposed".equals(codeString))
216          return AppointmentStatus.PROPOSED;
217        if ("pending".equals(codeString))
218          return AppointmentStatus.PENDING;
219        if ("booked".equals(codeString))
220          return AppointmentStatus.BOOKED;
221        if ("arrived".equals(codeString))
222          return AppointmentStatus.ARRIVED;
223        if ("fulfilled".equals(codeString))
224          return AppointmentStatus.FULFILLED;
225        if ("cancelled".equals(codeString))
226          return AppointmentStatus.CANCELLED;
227        if ("noshow".equals(codeString))
228          return AppointmentStatus.NOSHOW;
229        if ("entered-in-error".equals(codeString))
230          return AppointmentStatus.ENTEREDINERROR;
231        if ("checked-in".equals(codeString))
232          return AppointmentStatus.CHECKEDIN;
233        if ("waitlist".equals(codeString))
234          return AppointmentStatus.WAITLIST;
235        throw new IllegalArgumentException("Unknown AppointmentStatus code '"+codeString+"'");
236        }
237        public Enumeration<AppointmentStatus> fromType(Base code) throws FHIRException {
238          if (code == null)
239            return null;
240          if (code.isEmpty())
241            return new Enumeration<AppointmentStatus>(this);
242          String codeString = ((PrimitiveType) code).asStringValue();
243          if (codeString == null || "".equals(codeString))
244            return null;
245        if ("proposed".equals(codeString))
246          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PROPOSED);
247        if ("pending".equals(codeString))
248          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PENDING);
249        if ("booked".equals(codeString))
250          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.BOOKED);
251        if ("arrived".equals(codeString))
252          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ARRIVED);
253        if ("fulfilled".equals(codeString))
254          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.FULFILLED);
255        if ("cancelled".equals(codeString))
256          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CANCELLED);
257        if ("noshow".equals(codeString))
258          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NOSHOW);
259        if ("entered-in-error".equals(codeString))
260          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ENTEREDINERROR);
261        if ("checked-in".equals(codeString))
262          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CHECKEDIN);
263        if ("waitlist".equals(codeString))
264          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.WAITLIST);
265        throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'");
266        }
267    public String toCode(AppointmentStatus code) {
268      if (code == AppointmentStatus.PROPOSED)
269        return "proposed";
270      if (code == AppointmentStatus.PENDING)
271        return "pending";
272      if (code == AppointmentStatus.BOOKED)
273        return "booked";
274      if (code == AppointmentStatus.ARRIVED)
275        return "arrived";
276      if (code == AppointmentStatus.FULFILLED)
277        return "fulfilled";
278      if (code == AppointmentStatus.CANCELLED)
279        return "cancelled";
280      if (code == AppointmentStatus.NOSHOW)
281        return "noshow";
282      if (code == AppointmentStatus.ENTEREDINERROR)
283        return "entered-in-error";
284      if (code == AppointmentStatus.CHECKEDIN)
285        return "checked-in";
286      if (code == AppointmentStatus.WAITLIST)
287        return "waitlist";
288      return "?";
289      }
290    public String toSystem(AppointmentStatus code) {
291      return code.getSystem();
292      }
293    }
294
295    public enum ParticipantRequired {
296        /**
297         * The participant is required to attend the appointment.
298         */
299        REQUIRED, 
300        /**
301         * The participant may optionally attend the appointment.
302         */
303        OPTIONAL, 
304        /**
305         * 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).
306         */
307        INFORMATIONONLY, 
308        /**
309         * added to help the parsers with the generic types
310         */
311        NULL;
312        public static ParticipantRequired fromCode(String codeString) throws FHIRException {
313            if (codeString == null || "".equals(codeString))
314                return null;
315        if ("required".equals(codeString))
316          return REQUIRED;
317        if ("optional".equals(codeString))
318          return OPTIONAL;
319        if ("information-only".equals(codeString))
320          return INFORMATIONONLY;
321        if (Configuration.isAcceptInvalidEnums())
322          return null;
323        else
324          throw new FHIRException("Unknown ParticipantRequired code '"+codeString+"'");
325        }
326        public String toCode() {
327          switch (this) {
328            case REQUIRED: return "required";
329            case OPTIONAL: return "optional";
330            case INFORMATIONONLY: return "information-only";
331            default: return "?";
332          }
333        }
334        public String getSystem() {
335          switch (this) {
336            case REQUIRED: return "http://hl7.org/fhir/participantrequired";
337            case OPTIONAL: return "http://hl7.org/fhir/participantrequired";
338            case INFORMATIONONLY: return "http://hl7.org/fhir/participantrequired";
339            default: return "?";
340          }
341        }
342        public String getDefinition() {
343          switch (this) {
344            case REQUIRED: return "The participant is required to attend the appointment.";
345            case OPTIONAL: return "The participant may optionally attend the appointment.";
346            case INFORMATIONONLY: 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).";
347            default: return "?";
348          }
349        }
350        public String getDisplay() {
351          switch (this) {
352            case REQUIRED: return "Required";
353            case OPTIONAL: return "Optional";
354            case INFORMATIONONLY: return "Information Only";
355            default: return "?";
356          }
357        }
358    }
359
360  public static class ParticipantRequiredEnumFactory implements EnumFactory<ParticipantRequired> {
361    public ParticipantRequired fromCode(String codeString) throws IllegalArgumentException {
362      if (codeString == null || "".equals(codeString))
363            if (codeString == null || "".equals(codeString))
364                return null;
365        if ("required".equals(codeString))
366          return ParticipantRequired.REQUIRED;
367        if ("optional".equals(codeString))
368          return ParticipantRequired.OPTIONAL;
369        if ("information-only".equals(codeString))
370          return ParticipantRequired.INFORMATIONONLY;
371        throw new IllegalArgumentException("Unknown ParticipantRequired code '"+codeString+"'");
372        }
373        public Enumeration<ParticipantRequired> fromType(Base code) throws FHIRException {
374          if (code == null)
375            return null;
376          if (code.isEmpty())
377            return new Enumeration<ParticipantRequired>(this);
378          String codeString = ((PrimitiveType) code).asStringValue();
379          if (codeString == null || "".equals(codeString))
380            return null;
381        if ("required".equals(codeString))
382          return new Enumeration<ParticipantRequired>(this, ParticipantRequired.REQUIRED);
383        if ("optional".equals(codeString))
384          return new Enumeration<ParticipantRequired>(this, ParticipantRequired.OPTIONAL);
385        if ("information-only".equals(codeString))
386          return new Enumeration<ParticipantRequired>(this, ParticipantRequired.INFORMATIONONLY);
387        throw new FHIRException("Unknown ParticipantRequired code '"+codeString+"'");
388        }
389    public String toCode(ParticipantRequired code) {
390      if (code == ParticipantRequired.REQUIRED)
391        return "required";
392      if (code == ParticipantRequired.OPTIONAL)
393        return "optional";
394      if (code == ParticipantRequired.INFORMATIONONLY)
395        return "information-only";
396      return "?";
397      }
398    public String toSystem(ParticipantRequired code) {
399      return code.getSystem();
400      }
401    }
402
403    public enum ParticipationStatus {
404        /**
405         * The participant has accepted the appointment.
406         */
407        ACCEPTED, 
408        /**
409         * The participant has declined the appointment and will not participate in the appointment.
410         */
411        DECLINED, 
412        /**
413         * 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.
414         */
415        TENTATIVE, 
416        /**
417         * The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.
418         */
419        NEEDSACTION, 
420        /**
421         * added to help the parsers with the generic types
422         */
423        NULL;
424        public static ParticipationStatus fromCode(String codeString) throws FHIRException {
425            if (codeString == null || "".equals(codeString))
426                return null;
427        if ("accepted".equals(codeString))
428          return ACCEPTED;
429        if ("declined".equals(codeString))
430          return DECLINED;
431        if ("tentative".equals(codeString))
432          return TENTATIVE;
433        if ("needs-action".equals(codeString))
434          return NEEDSACTION;
435        if (Configuration.isAcceptInvalidEnums())
436          return null;
437        else
438          throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'");
439        }
440        public String toCode() {
441          switch (this) {
442            case ACCEPTED: return "accepted";
443            case DECLINED: return "declined";
444            case TENTATIVE: return "tentative";
445            case NEEDSACTION: return "needs-action";
446            default: return "?";
447          }
448        }
449        public String getSystem() {
450          switch (this) {
451            case ACCEPTED: return "http://hl7.org/fhir/participationstatus";
452            case DECLINED: return "http://hl7.org/fhir/participationstatus";
453            case TENTATIVE: return "http://hl7.org/fhir/participationstatus";
454            case NEEDSACTION: return "http://hl7.org/fhir/participationstatus";
455            default: return "?";
456          }
457        }
458        public String getDefinition() {
459          switch (this) {
460            case ACCEPTED: return "The participant has accepted the appointment.";
461            case DECLINED: return "The participant has declined the appointment and will not participate in the appointment.";
462            case TENTATIVE: return "The participant has  tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur.";
463            case NEEDSACTION: return "The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.";
464            default: return "?";
465          }
466        }
467        public String getDisplay() {
468          switch (this) {
469            case ACCEPTED: return "Accepted";
470            case DECLINED: return "Declined";
471            case TENTATIVE: return "Tentative";
472            case NEEDSACTION: return "Needs Action";
473            default: return "?";
474          }
475        }
476    }
477
478  public static class ParticipationStatusEnumFactory implements EnumFactory<ParticipationStatus> {
479    public ParticipationStatus fromCode(String codeString) throws IllegalArgumentException {
480      if (codeString == null || "".equals(codeString))
481            if (codeString == null || "".equals(codeString))
482                return null;
483        if ("accepted".equals(codeString))
484          return ParticipationStatus.ACCEPTED;
485        if ("declined".equals(codeString))
486          return ParticipationStatus.DECLINED;
487        if ("tentative".equals(codeString))
488          return ParticipationStatus.TENTATIVE;
489        if ("needs-action".equals(codeString))
490          return ParticipationStatus.NEEDSACTION;
491        throw new IllegalArgumentException("Unknown ParticipationStatus code '"+codeString+"'");
492        }
493        public Enumeration<ParticipationStatus> fromType(Base code) throws FHIRException {
494          if (code == null)
495            return null;
496          if (code.isEmpty())
497            return new Enumeration<ParticipationStatus>(this);
498          String codeString = ((PrimitiveType) code).asStringValue();
499          if (codeString == null || "".equals(codeString))
500            return null;
501        if ("accepted".equals(codeString))
502          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.ACCEPTED);
503        if ("declined".equals(codeString))
504          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.DECLINED);
505        if ("tentative".equals(codeString))
506          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.TENTATIVE);
507        if ("needs-action".equals(codeString))
508          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NEEDSACTION);
509        throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'");
510        }
511    public String toCode(ParticipationStatus code) {
512      if (code == ParticipationStatus.ACCEPTED)
513        return "accepted";
514      if (code == ParticipationStatus.DECLINED)
515        return "declined";
516      if (code == ParticipationStatus.TENTATIVE)
517        return "tentative";
518      if (code == ParticipationStatus.NEEDSACTION)
519        return "needs-action";
520      return "?";
521      }
522    public String toSystem(ParticipationStatus code) {
523      return code.getSystem();
524      }
525    }
526
527    @Block()
528    public static class AppointmentParticipantComponent extends BackboneElement implements IBaseBackboneElement {
529        /**
530         * Role of participant in the appointment.
531         */
532        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
533        @Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." )
534        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-participant-type")
535        protected List<CodeableConcept> type;
536
537        /**
538         * A Person, Location/HealthcareService or Device that is participating in the appointment.
539         */
540        @Child(name = "actor", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=2, min=0, max=1, modifier=false, summary=true)
541        @Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." )
542        protected Reference actor;
543
544        /**
545         * 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.
546         */
547        @Child(name = "required", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
548        @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." )
549        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participantrequired")
550        protected Enumeration<ParticipantRequired> required;
551
552        /**
553         * Participation status of the actor.
554         */
555        @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
556        @Description(shortDefinition="accepted | declined | tentative | needs-action", formalDefinition="Participation status of the actor." )
557        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participationstatus")
558        protected Enumeration<ParticipationStatus> status;
559
560        /**
561         * Participation period of the actor.
562         */
563        @Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
564        @Description(shortDefinition="Participation period of the actor", formalDefinition="Participation period of the actor." )
565        protected Period period;
566
567        private static final long serialVersionUID = -1993862145L;
568
569    /**
570     * Constructor
571     */
572      public AppointmentParticipantComponent() {
573        super();
574      }
575
576    /**
577     * Constructor
578     */
579      public AppointmentParticipantComponent(Enumeration<ParticipationStatus> status) {
580        super();
581        this.status = status;
582      }
583
584        /**
585         * @return {@link #type} (Role of participant in the appointment.)
586         */
587        public List<CodeableConcept> getType() { 
588          if (this.type == null)
589            this.type = new ArrayList<CodeableConcept>();
590          return this.type;
591        }
592
593        /**
594         * @return Returns a reference to <code>this</code> for easy method chaining
595         */
596        public AppointmentParticipantComponent setType(List<CodeableConcept> theType) { 
597          this.type = theType;
598          return this;
599        }
600
601        public boolean hasType() { 
602          if (this.type == null)
603            return false;
604          for (CodeableConcept item : this.type)
605            if (!item.isEmpty())
606              return true;
607          return false;
608        }
609
610        public CodeableConcept addType() { //3
611          CodeableConcept t = new CodeableConcept();
612          if (this.type == null)
613            this.type = new ArrayList<CodeableConcept>();
614          this.type.add(t);
615          return t;
616        }
617
618        public AppointmentParticipantComponent addType(CodeableConcept t) { //3
619          if (t == null)
620            return this;
621          if (this.type == null)
622            this.type = new ArrayList<CodeableConcept>();
623          this.type.add(t);
624          return this;
625        }
626
627        /**
628         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
629         */
630        public CodeableConcept getTypeFirstRep() { 
631          if (getType().isEmpty()) {
632            addType();
633          }
634          return getType().get(0);
635        }
636
637        /**
638         * @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
639         */
640        public Reference getActor() { 
641          if (this.actor == null)
642            if (Configuration.errorOnAutoCreate())
643              throw new Error("Attempt to auto-create AppointmentParticipantComponent.actor");
644            else if (Configuration.doAutoCreate())
645              this.actor = new Reference(); // cc
646          return this.actor;
647        }
648
649        public boolean hasActor() { 
650          return this.actor != null && !this.actor.isEmpty();
651        }
652
653        /**
654         * @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
655         */
656        public AppointmentParticipantComponent setActor(Reference value) { 
657          this.actor = value;
658          return this;
659        }
660
661        /**
662         * @return {@link #required} (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.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
663         */
664        public Enumeration<ParticipantRequired> getRequiredElement() { 
665          if (this.required == null)
666            if (Configuration.errorOnAutoCreate())
667              throw new Error("Attempt to auto-create AppointmentParticipantComponent.required");
668            else if (Configuration.doAutoCreate())
669              this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory()); // bb
670          return this.required;
671        }
672
673        public boolean hasRequiredElement() { 
674          return this.required != null && !this.required.isEmpty();
675        }
676
677        public boolean hasRequired() { 
678          return this.required != null && !this.required.isEmpty();
679        }
680
681        /**
682         * @param value {@link #required} (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.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
683         */
684        public AppointmentParticipantComponent setRequiredElement(Enumeration<ParticipantRequired> value) { 
685          this.required = value;
686          return this;
687        }
688
689        /**
690         * @return 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.
691         */
692        public ParticipantRequired getRequired() { 
693          return this.required == null ? null : this.required.getValue();
694        }
695
696        /**
697         * @param value 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.
698         */
699        public AppointmentParticipantComponent setRequired(ParticipantRequired value) { 
700          if (value == null)
701            this.required = null;
702          else {
703            if (this.required == null)
704              this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory());
705            this.required.setValue(value);
706          }
707          return this;
708        }
709
710        /**
711         * @return {@link #status} (Participation status of the actor.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
712         */
713        public Enumeration<ParticipationStatus> getStatusElement() { 
714          if (this.status == null)
715            if (Configuration.errorOnAutoCreate())
716              throw new Error("Attempt to auto-create AppointmentParticipantComponent.status");
717            else if (Configuration.doAutoCreate())
718              this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory()); // bb
719          return this.status;
720        }
721
722        public boolean hasStatusElement() { 
723          return this.status != null && !this.status.isEmpty();
724        }
725
726        public boolean hasStatus() { 
727          return this.status != null && !this.status.isEmpty();
728        }
729
730        /**
731         * @param value {@link #status} (Participation status of the actor.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
732         */
733        public AppointmentParticipantComponent setStatusElement(Enumeration<ParticipationStatus> value) { 
734          this.status = value;
735          return this;
736        }
737
738        /**
739         * @return Participation status of the actor.
740         */
741        public ParticipationStatus getStatus() { 
742          return this.status == null ? null : this.status.getValue();
743        }
744
745        /**
746         * @param value Participation status of the actor.
747         */
748        public AppointmentParticipantComponent setStatus(ParticipationStatus value) { 
749            if (this.status == null)
750              this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory());
751            this.status.setValue(value);
752          return this;
753        }
754
755        /**
756         * @return {@link #period} (Participation period of the actor.)
757         */
758        public Period getPeriod() { 
759          if (this.period == null)
760            if (Configuration.errorOnAutoCreate())
761              throw new Error("Attempt to auto-create AppointmentParticipantComponent.period");
762            else if (Configuration.doAutoCreate())
763              this.period = new Period(); // cc
764          return this.period;
765        }
766
767        public boolean hasPeriod() { 
768          return this.period != null && !this.period.isEmpty();
769        }
770
771        /**
772         * @param value {@link #period} (Participation period of the actor.)
773         */
774        public AppointmentParticipantComponent setPeriod(Period value) { 
775          this.period = value;
776          return this;
777        }
778
779        protected void listChildren(List<Property> children) {
780          super.listChildren(children);
781          children.add(new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, type));
782          children.add(new Property("actor", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor));
783          children.add(new Property("required", "code", "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.", 0, 1, required));
784          children.add(new Property("status", "code", "Participation status of the actor.", 0, 1, status));
785          children.add(new Property("period", "Period", "Participation period of the actor.", 0, 1, period));
786        }
787
788        @Override
789        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
790          switch (_hash) {
791          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, type);
792          case 92645877: /*actor*/  return new Property("actor", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor);
793          case -393139297: /*required*/  return new Property("required", "code", "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.", 0, 1, required);
794          case -892481550: /*status*/  return new Property("status", "code", "Participation status of the actor.", 0, 1, status);
795          case -991726143: /*period*/  return new Property("period", "Period", "Participation period of the actor.", 0, 1, period);
796          default: return super.getNamedProperty(_hash, _name, _checkValid);
797          }
798
799        }
800
801      @Override
802      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
803        switch (hash) {
804        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
805        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
806        case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // Enumeration<ParticipantRequired>
807        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ParticipationStatus>
808        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
809        default: return super.getProperty(hash, name, checkValid);
810        }
811
812      }
813
814      @Override
815      public Base setProperty(int hash, String name, Base value) throws FHIRException {
816        switch (hash) {
817        case 3575610: // type
818          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
819          return value;
820        case 92645877: // actor
821          this.actor = castToReference(value); // Reference
822          return value;
823        case -393139297: // required
824          value = new ParticipantRequiredEnumFactory().fromType(castToCode(value));
825          this.required = (Enumeration) value; // Enumeration<ParticipantRequired>
826          return value;
827        case -892481550: // status
828          value = new ParticipationStatusEnumFactory().fromType(castToCode(value));
829          this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
830          return value;
831        case -991726143: // period
832          this.period = castToPeriod(value); // Period
833          return value;
834        default: return super.setProperty(hash, name, value);
835        }
836
837      }
838
839      @Override
840      public Base setProperty(String name, Base value) throws FHIRException {
841        if (name.equals("type")) {
842          this.getType().add(castToCodeableConcept(value));
843        } else if (name.equals("actor")) {
844          this.actor = castToReference(value); // Reference
845        } else if (name.equals("required")) {
846          value = new ParticipantRequiredEnumFactory().fromType(castToCode(value));
847          this.required = (Enumeration) value; // Enumeration<ParticipantRequired>
848        } else if (name.equals("status")) {
849          value = new ParticipationStatusEnumFactory().fromType(castToCode(value));
850          this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
851        } else if (name.equals("period")) {
852          this.period = castToPeriod(value); // Period
853        } else
854          return super.setProperty(name, value);
855        return value;
856      }
857
858      @Override
859      public Base makeProperty(int hash, String name) throws FHIRException {
860        switch (hash) {
861        case 3575610:  return addType(); 
862        case 92645877:  return getActor();
863        case -393139297:  return getRequiredElement();
864        case -892481550:  return getStatusElement();
865        case -991726143:  return getPeriod();
866        default: return super.makeProperty(hash, name);
867        }
868
869      }
870
871      @Override
872      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
873        switch (hash) {
874        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
875        case 92645877: /*actor*/ return new String[] {"Reference"};
876        case -393139297: /*required*/ return new String[] {"code"};
877        case -892481550: /*status*/ return new String[] {"code"};
878        case -991726143: /*period*/ return new String[] {"Period"};
879        default: return super.getTypesForProperty(hash, name);
880        }
881
882      }
883
884      @Override
885      public Base addChild(String name) throws FHIRException {
886        if (name.equals("type")) {
887          return addType();
888        }
889        else if (name.equals("actor")) {
890          this.actor = new Reference();
891          return this.actor;
892        }
893        else if (name.equals("required")) {
894          throw new FHIRException("Cannot call addChild on a primitive type Appointment.required");
895        }
896        else if (name.equals("status")) {
897          throw new FHIRException("Cannot call addChild on a primitive type Appointment.status");
898        }
899        else if (name.equals("period")) {
900          this.period = new Period();
901          return this.period;
902        }
903        else
904          return super.addChild(name);
905      }
906
907      public AppointmentParticipantComponent copy() {
908        AppointmentParticipantComponent dst = new AppointmentParticipantComponent();
909        copyValues(dst);
910        return dst;
911      }
912
913      public void copyValues(AppointmentParticipantComponent dst) {
914        super.copyValues(dst);
915        if (type != null) {
916          dst.type = new ArrayList<CodeableConcept>();
917          for (CodeableConcept i : type)
918            dst.type.add(i.copy());
919        };
920        dst.actor = actor == null ? null : actor.copy();
921        dst.required = required == null ? null : required.copy();
922        dst.status = status == null ? null : status.copy();
923        dst.period = period == null ? null : period.copy();
924      }
925
926      @Override
927      public boolean equalsDeep(Base other_) {
928        if (!super.equalsDeep(other_))
929          return false;
930        if (!(other_ instanceof AppointmentParticipantComponent))
931          return false;
932        AppointmentParticipantComponent o = (AppointmentParticipantComponent) other_;
933        return compareDeep(type, o.type, true) && compareDeep(actor, o.actor, true) && compareDeep(required, o.required, true)
934           && compareDeep(status, o.status, true) && compareDeep(period, o.period, true);
935      }
936
937      @Override
938      public boolean equalsShallow(Base other_) {
939        if (!super.equalsShallow(other_))
940          return false;
941        if (!(other_ instanceof AppointmentParticipantComponent))
942          return false;
943        AppointmentParticipantComponent o = (AppointmentParticipantComponent) other_;
944        return compareValues(required, o.required, true) && compareValues(status, o.status, true);
945      }
946
947      public boolean isEmpty() {
948        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, actor, required, status
949          , period);
950      }
951
952  public String fhirType() {
953    return "Appointment.participant";
954
955  }
956
957  }
958
959    /**
960     * 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).
961     */
962    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
963    @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)." )
964    protected List<Identifier> identifier;
965
966    /**
967     * 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.
968     */
969    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
970    @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." )
971    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/appointmentstatus")
972    protected Enumeration<AppointmentStatus> status;
973
974    /**
975     * 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.
976     */
977    @Child(name = "cancelationReason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
978    @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." )
979    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/appointment-cancellation-reason")
980    protected CodeableConcept cancelationReason;
981
982    /**
983     * A broad categorization of the service that is to be performed during this appointment.
984     */
985    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
986    @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." )
987    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
988    protected List<CodeableConcept> serviceCategory;
989
990    /**
991     * The specific service that is to be performed during this appointment.
992     */
993    @Child(name = "serviceType", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
994    @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." )
995    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-type")
996    protected List<CodeableConcept> serviceType;
997
998    /**
999     * The specialty of a practitioner that would be required to perform the service requested in this appointment.
1000     */
1001    @Child(name = "specialty", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1002    @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." )
1003    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
1004    protected List<CodeableConcept> specialty;
1005
1006    /**
1007     * The style of appointment or patient that has been booked in the slot (not service type).
1008     */
1009    @Child(name = "appointmentType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
1010    @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)." )
1011    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0276")
1012    protected CodeableConcept appointmentType;
1013
1014    /**
1015     * The coded reason that this appointment is being scheduled. This is more clinical than administrative.
1016     */
1017    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1018    @Description(shortDefinition="Coded reason this appointment is scheduled", formalDefinition="The coded reason that this appointment is being scheduled. This is more clinical than administrative." )
1019    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-reason")
1020    protected List<CodeableConcept> reasonCode;
1021
1022    /**
1023     * 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.
1024     */
1025    @Child(name = "reasonReference", type = {Condition.class, Procedure.class, Observation.class, ImmunizationRecommendation.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1026    @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." )
1027    protected List<Reference> reasonReference;
1028
1029    /**
1030     * 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).
1031     */
1032    @Child(name = "priority", type = {UnsignedIntType.class}, order=9, min=0, max=1, modifier=false, summary=false)
1033    @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)." )
1034    protected UnsignedIntType priority;
1035
1036    /**
1037     * 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.
1038     */
1039    @Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
1040    @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." )
1041    protected StringType description;
1042
1043    /**
1044     * Additional information to support the appointment provided when making the appointment.
1045     */
1046    @Child(name = "supportingInformation", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1047    @Description(shortDefinition="Additional information to support the appointment", formalDefinition="Additional information to support the appointment provided when making the appointment." )
1048    protected List<Reference> supportingInformation;
1049
1050    /**
1051     * Date/Time that the appointment is to take place.
1052     */
1053    @Child(name = "start", type = {InstantType.class}, order=12, min=0, max=1, modifier=false, summary=true)
1054    @Description(shortDefinition="When appointment is to take place", formalDefinition="Date/Time that the appointment is to take place." )
1055    protected InstantType start;
1056
1057    /**
1058     * Date/Time that the appointment is to conclude.
1059     */
1060    @Child(name = "end", type = {InstantType.class}, order=13, min=0, max=1, modifier=false, summary=true)
1061    @Description(shortDefinition="When appointment is to conclude", formalDefinition="Date/Time that the appointment is to conclude." )
1062    protected InstantType end;
1063
1064    /**
1065     * 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.
1066     */
1067    @Child(name = "minutesDuration", type = {PositiveIntType.class}, order=14, min=0, max=1, modifier=false, summary=false)
1068    @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." )
1069    protected PositiveIntType minutesDuration;
1070
1071    /**
1072     * The slots from the participants' schedules that will be filled by the appointment.
1073     */
1074    @Child(name = "slot", type = {Slot.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1075    @Description(shortDefinition="The slots that this appointment is filling", formalDefinition="The slots from the participants' schedules that will be filled by the appointment." )
1076    protected List<Reference> slot;
1077
1078    /**
1079     * 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.
1080     */
1081    @Child(name = "created", type = {DateTimeType.class}, order=16, min=0, max=1, modifier=false, summary=false)
1082    @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." )
1083    protected DateTimeType created;
1084
1085    /**
1086     * Additional comments about the appointment.
1087     */
1088    @Child(name = "comment", type = {StringType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1089    @Description(shortDefinition="Additional comments", formalDefinition="Additional comments about the appointment." )
1090    protected StringType comment;
1091
1092    /**
1093     * 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).
1094     */
1095    @Child(name = "patientInstruction", type = {StringType.class}, order=18, min=0, max=1, modifier=false, summary=false)
1096    @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)." )
1097    protected StringType patientInstruction;
1098
1099    /**
1100     * The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).
1101     */
1102    @Child(name = "basedOn", type = {ServiceRequest.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1103    @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)." )
1104    protected List<Reference> basedOn;
1105
1106    /**
1107     * List of participants involved in the appointment.
1108     */
1109    @Child(name = "participant", type = {}, order=20, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1110    @Description(shortDefinition="Participants involved in appointment", formalDefinition="List of participants involved in the appointment." )
1111    protected List<AppointmentParticipantComponent> participant;
1112
1113    /**
1114     * A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.
1115
1116The 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.
1117     */
1118    @Child(name = "requestedPeriod", type = {Period.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1119    @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." )
1120    protected List<Period> requestedPeriod;
1121
1122    private static final long serialVersionUID = 267666863L;
1123
1124  /**
1125   * Constructor
1126   */
1127    public Appointment() {
1128      super();
1129    }
1130
1131  /**
1132   * Constructor
1133   */
1134    public Appointment(Enumeration<AppointmentStatus> status) {
1135      super();
1136      this.status = status;
1137    }
1138
1139    /**
1140     * @return {@link #identifier} (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).)
1141     */
1142    public List<Identifier> getIdentifier() { 
1143      if (this.identifier == null)
1144        this.identifier = new ArrayList<Identifier>();
1145      return this.identifier;
1146    }
1147
1148    /**
1149     * @return Returns a reference to <code>this</code> for easy method chaining
1150     */
1151    public Appointment setIdentifier(List<Identifier> theIdentifier) { 
1152      this.identifier = theIdentifier;
1153      return this;
1154    }
1155
1156    public boolean hasIdentifier() { 
1157      if (this.identifier == null)
1158        return false;
1159      for (Identifier item : this.identifier)
1160        if (!item.isEmpty())
1161          return true;
1162      return false;
1163    }
1164
1165    public Identifier addIdentifier() { //3
1166      Identifier t = new Identifier();
1167      if (this.identifier == null)
1168        this.identifier = new ArrayList<Identifier>();
1169      this.identifier.add(t);
1170      return t;
1171    }
1172
1173    public Appointment addIdentifier(Identifier t) { //3
1174      if (t == null)
1175        return this;
1176      if (this.identifier == null)
1177        this.identifier = new ArrayList<Identifier>();
1178      this.identifier.add(t);
1179      return this;
1180    }
1181
1182    /**
1183     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1184     */
1185    public Identifier getIdentifierFirstRep() { 
1186      if (getIdentifier().isEmpty()) {
1187        addIdentifier();
1188      }
1189      return getIdentifier().get(0);
1190    }
1191
1192    /**
1193     * @return {@link #status} (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.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1194     */
1195    public Enumeration<AppointmentStatus> getStatusElement() { 
1196      if (this.status == null)
1197        if (Configuration.errorOnAutoCreate())
1198          throw new Error("Attempt to auto-create Appointment.status");
1199        else if (Configuration.doAutoCreate())
1200          this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory()); // bb
1201      return this.status;
1202    }
1203
1204    public boolean hasStatusElement() { 
1205      return this.status != null && !this.status.isEmpty();
1206    }
1207
1208    public boolean hasStatus() { 
1209      return this.status != null && !this.status.isEmpty();
1210    }
1211
1212    /**
1213     * @param value {@link #status} (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.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1214     */
1215    public Appointment setStatusElement(Enumeration<AppointmentStatus> value) { 
1216      this.status = value;
1217      return this;
1218    }
1219
1220    /**
1221     * @return 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.
1222     */
1223    public AppointmentStatus getStatus() { 
1224      return this.status == null ? null : this.status.getValue();
1225    }
1226
1227    /**
1228     * @param value 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.
1229     */
1230    public Appointment setStatus(AppointmentStatus value) { 
1231        if (this.status == null)
1232          this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory());
1233        this.status.setValue(value);
1234      return this;
1235    }
1236
1237    /**
1238     * @return {@link #cancelationReason} (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.)
1239     */
1240    public CodeableConcept getCancelationReason() { 
1241      if (this.cancelationReason == null)
1242        if (Configuration.errorOnAutoCreate())
1243          throw new Error("Attempt to auto-create Appointment.cancelationReason");
1244        else if (Configuration.doAutoCreate())
1245          this.cancelationReason = new CodeableConcept(); // cc
1246      return this.cancelationReason;
1247    }
1248
1249    public boolean hasCancelationReason() { 
1250      return this.cancelationReason != null && !this.cancelationReason.isEmpty();
1251    }
1252
1253    /**
1254     * @param value {@link #cancelationReason} (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.)
1255     */
1256    public Appointment setCancelationReason(CodeableConcept value) { 
1257      this.cancelationReason = value;
1258      return this;
1259    }
1260
1261    /**
1262     * @return {@link #serviceCategory} (A broad categorization of the service that is to be performed during this appointment.)
1263     */
1264    public List<CodeableConcept> getServiceCategory() { 
1265      if (this.serviceCategory == null)
1266        this.serviceCategory = new ArrayList<CodeableConcept>();
1267      return this.serviceCategory;
1268    }
1269
1270    /**
1271     * @return Returns a reference to <code>this</code> for easy method chaining
1272     */
1273    public Appointment setServiceCategory(List<CodeableConcept> theServiceCategory) { 
1274      this.serviceCategory = theServiceCategory;
1275      return this;
1276    }
1277
1278    public boolean hasServiceCategory() { 
1279      if (this.serviceCategory == null)
1280        return false;
1281      for (CodeableConcept item : this.serviceCategory)
1282        if (!item.isEmpty())
1283          return true;
1284      return false;
1285    }
1286
1287    public CodeableConcept addServiceCategory() { //3
1288      CodeableConcept t = new CodeableConcept();
1289      if (this.serviceCategory == null)
1290        this.serviceCategory = new ArrayList<CodeableConcept>();
1291      this.serviceCategory.add(t);
1292      return t;
1293    }
1294
1295    public Appointment addServiceCategory(CodeableConcept t) { //3
1296      if (t == null)
1297        return this;
1298      if (this.serviceCategory == null)
1299        this.serviceCategory = new ArrayList<CodeableConcept>();
1300      this.serviceCategory.add(t);
1301      return this;
1302    }
1303
1304    /**
1305     * @return The first repetition of repeating field {@link #serviceCategory}, creating it if it does not already exist
1306     */
1307    public CodeableConcept getServiceCategoryFirstRep() { 
1308      if (getServiceCategory().isEmpty()) {
1309        addServiceCategory();
1310      }
1311      return getServiceCategory().get(0);
1312    }
1313
1314    /**
1315     * @return {@link #serviceType} (The specific service that is to be performed during this appointment.)
1316     */
1317    public List<CodeableConcept> getServiceType() { 
1318      if (this.serviceType == null)
1319        this.serviceType = new ArrayList<CodeableConcept>();
1320      return this.serviceType;
1321    }
1322
1323    /**
1324     * @return Returns a reference to <code>this</code> for easy method chaining
1325     */
1326    public Appointment setServiceType(List<CodeableConcept> theServiceType) { 
1327      this.serviceType = theServiceType;
1328      return this;
1329    }
1330
1331    public boolean hasServiceType() { 
1332      if (this.serviceType == null)
1333        return false;
1334      for (CodeableConcept item : this.serviceType)
1335        if (!item.isEmpty())
1336          return true;
1337      return false;
1338    }
1339
1340    public CodeableConcept addServiceType() { //3
1341      CodeableConcept t = new CodeableConcept();
1342      if (this.serviceType == null)
1343        this.serviceType = new ArrayList<CodeableConcept>();
1344      this.serviceType.add(t);
1345      return t;
1346    }
1347
1348    public Appointment addServiceType(CodeableConcept t) { //3
1349      if (t == null)
1350        return this;
1351      if (this.serviceType == null)
1352        this.serviceType = new ArrayList<CodeableConcept>();
1353      this.serviceType.add(t);
1354      return this;
1355    }
1356
1357    /**
1358     * @return The first repetition of repeating field {@link #serviceType}, creating it if it does not already exist
1359     */
1360    public CodeableConcept getServiceTypeFirstRep() { 
1361      if (getServiceType().isEmpty()) {
1362        addServiceType();
1363      }
1364      return getServiceType().get(0);
1365    }
1366
1367    /**
1368     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
1369     */
1370    public List<CodeableConcept> getSpecialty() { 
1371      if (this.specialty == null)
1372        this.specialty = new ArrayList<CodeableConcept>();
1373      return this.specialty;
1374    }
1375
1376    /**
1377     * @return Returns a reference to <code>this</code> for easy method chaining
1378     */
1379    public Appointment setSpecialty(List<CodeableConcept> theSpecialty) { 
1380      this.specialty = theSpecialty;
1381      return this;
1382    }
1383
1384    public boolean hasSpecialty() { 
1385      if (this.specialty == null)
1386        return false;
1387      for (CodeableConcept item : this.specialty)
1388        if (!item.isEmpty())
1389          return true;
1390      return false;
1391    }
1392
1393    public CodeableConcept addSpecialty() { //3
1394      CodeableConcept t = new CodeableConcept();
1395      if (this.specialty == null)
1396        this.specialty = new ArrayList<CodeableConcept>();
1397      this.specialty.add(t);
1398      return t;
1399    }
1400
1401    public Appointment addSpecialty(CodeableConcept t) { //3
1402      if (t == null)
1403        return this;
1404      if (this.specialty == null)
1405        this.specialty = new ArrayList<CodeableConcept>();
1406      this.specialty.add(t);
1407      return this;
1408    }
1409
1410    /**
1411     * @return The first repetition of repeating field {@link #specialty}, creating it if it does not already exist
1412     */
1413    public CodeableConcept getSpecialtyFirstRep() { 
1414      if (getSpecialty().isEmpty()) {
1415        addSpecialty();
1416      }
1417      return getSpecialty().get(0);
1418    }
1419
1420    /**
1421     * @return {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
1422     */
1423    public CodeableConcept getAppointmentType() { 
1424      if (this.appointmentType == null)
1425        if (Configuration.errorOnAutoCreate())
1426          throw new Error("Attempt to auto-create Appointment.appointmentType");
1427        else if (Configuration.doAutoCreate())
1428          this.appointmentType = new CodeableConcept(); // cc
1429      return this.appointmentType;
1430    }
1431
1432    public boolean hasAppointmentType() { 
1433      return this.appointmentType != null && !this.appointmentType.isEmpty();
1434    }
1435
1436    /**
1437     * @param value {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
1438     */
1439    public Appointment setAppointmentType(CodeableConcept value) { 
1440      this.appointmentType = value;
1441      return this;
1442    }
1443
1444    /**
1445     * @return {@link #reasonCode} (The coded reason that this appointment is being scheduled. This is more clinical than administrative.)
1446     */
1447    public List<CodeableConcept> getReasonCode() { 
1448      if (this.reasonCode == null)
1449        this.reasonCode = new ArrayList<CodeableConcept>();
1450      return this.reasonCode;
1451    }
1452
1453    /**
1454     * @return Returns a reference to <code>this</code> for easy method chaining
1455     */
1456    public Appointment setReasonCode(List<CodeableConcept> theReasonCode) { 
1457      this.reasonCode = theReasonCode;
1458      return this;
1459    }
1460
1461    public boolean hasReasonCode() { 
1462      if (this.reasonCode == null)
1463        return false;
1464      for (CodeableConcept item : this.reasonCode)
1465        if (!item.isEmpty())
1466          return true;
1467      return false;
1468    }
1469
1470    public CodeableConcept addReasonCode() { //3
1471      CodeableConcept t = new CodeableConcept();
1472      if (this.reasonCode == null)
1473        this.reasonCode = new ArrayList<CodeableConcept>();
1474      this.reasonCode.add(t);
1475      return t;
1476    }
1477
1478    public Appointment addReasonCode(CodeableConcept t) { //3
1479      if (t == null)
1480        return this;
1481      if (this.reasonCode == null)
1482        this.reasonCode = new ArrayList<CodeableConcept>();
1483      this.reasonCode.add(t);
1484      return this;
1485    }
1486
1487    /**
1488     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1489     */
1490    public CodeableConcept getReasonCodeFirstRep() { 
1491      if (getReasonCode().isEmpty()) {
1492        addReasonCode();
1493      }
1494      return getReasonCode().get(0);
1495    }
1496
1497    /**
1498     * @return {@link #reasonReference} (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.)
1499     */
1500    public List<Reference> getReasonReference() { 
1501      if (this.reasonReference == null)
1502        this.reasonReference = new ArrayList<Reference>();
1503      return this.reasonReference;
1504    }
1505
1506    /**
1507     * @return Returns a reference to <code>this</code> for easy method chaining
1508     */
1509    public Appointment setReasonReference(List<Reference> theReasonReference) { 
1510      this.reasonReference = theReasonReference;
1511      return this;
1512    }
1513
1514    public boolean hasReasonReference() { 
1515      if (this.reasonReference == null)
1516        return false;
1517      for (Reference item : this.reasonReference)
1518        if (!item.isEmpty())
1519          return true;
1520      return false;
1521    }
1522
1523    public Reference addReasonReference() { //3
1524      Reference t = new Reference();
1525      if (this.reasonReference == null)
1526        this.reasonReference = new ArrayList<Reference>();
1527      this.reasonReference.add(t);
1528      return t;
1529    }
1530
1531    public Appointment addReasonReference(Reference t) { //3
1532      if (t == null)
1533        return this;
1534      if (this.reasonReference == null)
1535        this.reasonReference = new ArrayList<Reference>();
1536      this.reasonReference.add(t);
1537      return this;
1538    }
1539
1540    /**
1541     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1542     */
1543    public Reference getReasonReferenceFirstRep() { 
1544      if (getReasonReference().isEmpty()) {
1545        addReasonReference();
1546      }
1547      return getReasonReference().get(0);
1548    }
1549
1550    /**
1551     * @return {@link #priority} (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).). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1552     */
1553    public UnsignedIntType getPriorityElement() { 
1554      if (this.priority == null)
1555        if (Configuration.errorOnAutoCreate())
1556          throw new Error("Attempt to auto-create Appointment.priority");
1557        else if (Configuration.doAutoCreate())
1558          this.priority = new UnsignedIntType(); // bb
1559      return this.priority;
1560    }
1561
1562    public boolean hasPriorityElement() { 
1563      return this.priority != null && !this.priority.isEmpty();
1564    }
1565
1566    public boolean hasPriority() { 
1567      return this.priority != null && !this.priority.isEmpty();
1568    }
1569
1570    /**
1571     * @param value {@link #priority} (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).). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1572     */
1573    public Appointment setPriorityElement(UnsignedIntType value) { 
1574      this.priority = value;
1575      return this;
1576    }
1577
1578    /**
1579     * @return 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).
1580     */
1581    public int getPriority() { 
1582      return this.priority == null || this.priority.isEmpty() ? 0 : this.priority.getValue();
1583    }
1584
1585    /**
1586     * @param value 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).
1587     */
1588    public Appointment setPriority(int value) { 
1589        if (this.priority == null)
1590          this.priority = new UnsignedIntType();
1591        this.priority.setValue(value);
1592      return this;
1593    }
1594
1595    /**
1596     * @return {@link #description} (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.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1597     */
1598    public StringType getDescriptionElement() { 
1599      if (this.description == null)
1600        if (Configuration.errorOnAutoCreate())
1601          throw new Error("Attempt to auto-create Appointment.description");
1602        else if (Configuration.doAutoCreate())
1603          this.description = new StringType(); // bb
1604      return this.description;
1605    }
1606
1607    public boolean hasDescriptionElement() { 
1608      return this.description != null && !this.description.isEmpty();
1609    }
1610
1611    public boolean hasDescription() { 
1612      return this.description != null && !this.description.isEmpty();
1613    }
1614
1615    /**
1616     * @param value {@link #description} (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.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1617     */
1618    public Appointment setDescriptionElement(StringType value) { 
1619      this.description = value;
1620      return this;
1621    }
1622
1623    /**
1624     * @return 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.
1625     */
1626    public String getDescription() { 
1627      return this.description == null ? null : this.description.getValue();
1628    }
1629
1630    /**
1631     * @param value 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.
1632     */
1633    public Appointment setDescription(String value) { 
1634      if (Utilities.noString(value))
1635        this.description = null;
1636      else {
1637        if (this.description == null)
1638          this.description = new StringType();
1639        this.description.setValue(value);
1640      }
1641      return this;
1642    }
1643
1644    /**
1645     * @return {@link #supportingInformation} (Additional information to support the appointment provided when making the appointment.)
1646     */
1647    public List<Reference> getSupportingInformation() { 
1648      if (this.supportingInformation == null)
1649        this.supportingInformation = new ArrayList<Reference>();
1650      return this.supportingInformation;
1651    }
1652
1653    /**
1654     * @return Returns a reference to <code>this</code> for easy method chaining
1655     */
1656    public Appointment setSupportingInformation(List<Reference> theSupportingInformation) { 
1657      this.supportingInformation = theSupportingInformation;
1658      return this;
1659    }
1660
1661    public boolean hasSupportingInformation() { 
1662      if (this.supportingInformation == null)
1663        return false;
1664      for (Reference item : this.supportingInformation)
1665        if (!item.isEmpty())
1666          return true;
1667      return false;
1668    }
1669
1670    public Reference addSupportingInformation() { //3
1671      Reference t = new Reference();
1672      if (this.supportingInformation == null)
1673        this.supportingInformation = new ArrayList<Reference>();
1674      this.supportingInformation.add(t);
1675      return t;
1676    }
1677
1678    public Appointment addSupportingInformation(Reference t) { //3
1679      if (t == null)
1680        return this;
1681      if (this.supportingInformation == null)
1682        this.supportingInformation = new ArrayList<Reference>();
1683      this.supportingInformation.add(t);
1684      return this;
1685    }
1686
1687    /**
1688     * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist
1689     */
1690    public Reference getSupportingInformationFirstRep() { 
1691      if (getSupportingInformation().isEmpty()) {
1692        addSupportingInformation();
1693      }
1694      return getSupportingInformation().get(0);
1695    }
1696
1697    /**
1698     * @return {@link #start} (Date/Time that the appointment is to take place.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
1699     */
1700    public InstantType getStartElement() { 
1701      if (this.start == null)
1702        if (Configuration.errorOnAutoCreate())
1703          throw new Error("Attempt to auto-create Appointment.start");
1704        else if (Configuration.doAutoCreate())
1705          this.start = new InstantType(); // bb
1706      return this.start;
1707    }
1708
1709    public boolean hasStartElement() { 
1710      return this.start != null && !this.start.isEmpty();
1711    }
1712
1713    public boolean hasStart() { 
1714      return this.start != null && !this.start.isEmpty();
1715    }
1716
1717    /**
1718     * @param value {@link #start} (Date/Time that the appointment is to take place.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
1719     */
1720    public Appointment setStartElement(InstantType value) { 
1721      this.start = value;
1722      return this;
1723    }
1724
1725    /**
1726     * @return Date/Time that the appointment is to take place.
1727     */
1728    public Date getStart() { 
1729      return this.start == null ? null : this.start.getValue();
1730    }
1731
1732    /**
1733     * @param value Date/Time that the appointment is to take place.
1734     */
1735    public Appointment setStart(Date value) { 
1736      if (value == null)
1737        this.start = null;
1738      else {
1739        if (this.start == null)
1740          this.start = new InstantType();
1741        this.start.setValue(value);
1742      }
1743      return this;
1744    }
1745
1746    /**
1747     * @return {@link #end} (Date/Time that the appointment is to conclude.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
1748     */
1749    public InstantType getEndElement() { 
1750      if (this.end == null)
1751        if (Configuration.errorOnAutoCreate())
1752          throw new Error("Attempt to auto-create Appointment.end");
1753        else if (Configuration.doAutoCreate())
1754          this.end = new InstantType(); // bb
1755      return this.end;
1756    }
1757
1758    public boolean hasEndElement() { 
1759      return this.end != null && !this.end.isEmpty();
1760    }
1761
1762    public boolean hasEnd() { 
1763      return this.end != null && !this.end.isEmpty();
1764    }
1765
1766    /**
1767     * @param value {@link #end} (Date/Time that the appointment is to conclude.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
1768     */
1769    public Appointment setEndElement(InstantType value) { 
1770      this.end = value;
1771      return this;
1772    }
1773
1774    /**
1775     * @return Date/Time that the appointment is to conclude.
1776     */
1777    public Date getEnd() { 
1778      return this.end == null ? null : this.end.getValue();
1779    }
1780
1781    /**
1782     * @param value Date/Time that the appointment is to conclude.
1783     */
1784    public Appointment setEnd(Date value) { 
1785      if (value == null)
1786        this.end = null;
1787      else {
1788        if (this.end == null)
1789          this.end = new InstantType();
1790        this.end.setValue(value);
1791      }
1792      return this;
1793    }
1794
1795    /**
1796     * @return {@link #minutesDuration} (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.). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
1797     */
1798    public PositiveIntType getMinutesDurationElement() { 
1799      if (this.minutesDuration == null)
1800        if (Configuration.errorOnAutoCreate())
1801          throw new Error("Attempt to auto-create Appointment.minutesDuration");
1802        else if (Configuration.doAutoCreate())
1803          this.minutesDuration = new PositiveIntType(); // bb
1804      return this.minutesDuration;
1805    }
1806
1807    public boolean hasMinutesDurationElement() { 
1808      return this.minutesDuration != null && !this.minutesDuration.isEmpty();
1809    }
1810
1811    public boolean hasMinutesDuration() { 
1812      return this.minutesDuration != null && !this.minutesDuration.isEmpty();
1813    }
1814
1815    /**
1816     * @param value {@link #minutesDuration} (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.). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
1817     */
1818    public Appointment setMinutesDurationElement(PositiveIntType value) { 
1819      this.minutesDuration = value;
1820      return this;
1821    }
1822
1823    /**
1824     * @return 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.
1825     */
1826    public int getMinutesDuration() { 
1827      return this.minutesDuration == null || this.minutesDuration.isEmpty() ? 0 : this.minutesDuration.getValue();
1828    }
1829
1830    /**
1831     * @param value 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.
1832     */
1833    public Appointment setMinutesDuration(int value) { 
1834        if (this.minutesDuration == null)
1835          this.minutesDuration = new PositiveIntType();
1836        this.minutesDuration.setValue(value);
1837      return this;
1838    }
1839
1840    /**
1841     * @return {@link #slot} (The slots from the participants' schedules that will be filled by the appointment.)
1842     */
1843    public List<Reference> getSlot() { 
1844      if (this.slot == null)
1845        this.slot = new ArrayList<Reference>();
1846      return this.slot;
1847    }
1848
1849    /**
1850     * @return Returns a reference to <code>this</code> for easy method chaining
1851     */
1852    public Appointment setSlot(List<Reference> theSlot) { 
1853      this.slot = theSlot;
1854      return this;
1855    }
1856
1857    public boolean hasSlot() { 
1858      if (this.slot == null)
1859        return false;
1860      for (Reference item : this.slot)
1861        if (!item.isEmpty())
1862          return true;
1863      return false;
1864    }
1865
1866    public Reference addSlot() { //3
1867      Reference t = new Reference();
1868      if (this.slot == null)
1869        this.slot = new ArrayList<Reference>();
1870      this.slot.add(t);
1871      return t;
1872    }
1873
1874    public Appointment addSlot(Reference t) { //3
1875      if (t == null)
1876        return this;
1877      if (this.slot == null)
1878        this.slot = new ArrayList<Reference>();
1879      this.slot.add(t);
1880      return this;
1881    }
1882
1883    /**
1884     * @return The first repetition of repeating field {@link #slot}, creating it if it does not already exist
1885     */
1886    public Reference getSlotFirstRep() { 
1887      if (getSlot().isEmpty()) {
1888        addSlot();
1889      }
1890      return getSlot().get(0);
1891    }
1892
1893    /**
1894     * @return {@link #created} (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.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1895     */
1896    public DateTimeType getCreatedElement() { 
1897      if (this.created == null)
1898        if (Configuration.errorOnAutoCreate())
1899          throw new Error("Attempt to auto-create Appointment.created");
1900        else if (Configuration.doAutoCreate())
1901          this.created = new DateTimeType(); // bb
1902      return this.created;
1903    }
1904
1905    public boolean hasCreatedElement() { 
1906      return this.created != null && !this.created.isEmpty();
1907    }
1908
1909    public boolean hasCreated() { 
1910      return this.created != null && !this.created.isEmpty();
1911    }
1912
1913    /**
1914     * @param value {@link #created} (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.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1915     */
1916    public Appointment setCreatedElement(DateTimeType value) { 
1917      this.created = value;
1918      return this;
1919    }
1920
1921    /**
1922     * @return 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.
1923     */
1924    public Date getCreated() { 
1925      return this.created == null ? null : this.created.getValue();
1926    }
1927
1928    /**
1929     * @param value 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.
1930     */
1931    public Appointment setCreated(Date value) { 
1932      if (value == null)
1933        this.created = null;
1934      else {
1935        if (this.created == null)
1936          this.created = new DateTimeType();
1937        this.created.setValue(value);
1938      }
1939      return this;
1940    }
1941
1942    /**
1943     * @return {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1944     */
1945    public StringType getCommentElement() { 
1946      if (this.comment == null)
1947        if (Configuration.errorOnAutoCreate())
1948          throw new Error("Attempt to auto-create Appointment.comment");
1949        else if (Configuration.doAutoCreate())
1950          this.comment = new StringType(); // bb
1951      return this.comment;
1952    }
1953
1954    public boolean hasCommentElement() { 
1955      return this.comment != null && !this.comment.isEmpty();
1956    }
1957
1958    public boolean hasComment() { 
1959      return this.comment != null && !this.comment.isEmpty();
1960    }
1961
1962    /**
1963     * @param value {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1964     */
1965    public Appointment setCommentElement(StringType value) { 
1966      this.comment = value;
1967      return this;
1968    }
1969
1970    /**
1971     * @return Additional comments about the appointment.
1972     */
1973    public String getComment() { 
1974      return this.comment == null ? null : this.comment.getValue();
1975    }
1976
1977    /**
1978     * @param value Additional comments about the appointment.
1979     */
1980    public Appointment setComment(String value) { 
1981      if (Utilities.noString(value))
1982        this.comment = null;
1983      else {
1984        if (this.comment == null)
1985          this.comment = new StringType();
1986        this.comment.setValue(value);
1987      }
1988      return this;
1989    }
1990
1991    /**
1992     * @return {@link #patientInstruction} (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).). This is the underlying object with id, value and extensions. The accessor "getPatientInstruction" gives direct access to the value
1993     */
1994    public StringType getPatientInstructionElement() { 
1995      if (this.patientInstruction == null)
1996        if (Configuration.errorOnAutoCreate())
1997          throw new Error("Attempt to auto-create Appointment.patientInstruction");
1998        else if (Configuration.doAutoCreate())
1999          this.patientInstruction = new StringType(); // bb
2000      return this.patientInstruction;
2001    }
2002
2003    public boolean hasPatientInstructionElement() { 
2004      return this.patientInstruction != null && !this.patientInstruction.isEmpty();
2005    }
2006
2007    public boolean hasPatientInstruction() { 
2008      return this.patientInstruction != null && !this.patientInstruction.isEmpty();
2009    }
2010
2011    /**
2012     * @param value {@link #patientInstruction} (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).). This is the underlying object with id, value and extensions. The accessor "getPatientInstruction" gives direct access to the value
2013     */
2014    public Appointment setPatientInstructionElement(StringType value) { 
2015      this.patientInstruction = value;
2016      return this;
2017    }
2018
2019    /**
2020     * @return 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).
2021     */
2022    public String getPatientInstruction() { 
2023      return this.patientInstruction == null ? null : this.patientInstruction.getValue();
2024    }
2025
2026    /**
2027     * @param value 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).
2028     */
2029    public Appointment setPatientInstruction(String value) { 
2030      if (Utilities.noString(value))
2031        this.patientInstruction = null;
2032      else {
2033        if (this.patientInstruction == null)
2034          this.patientInstruction = new StringType();
2035        this.patientInstruction.setValue(value);
2036      }
2037      return this;
2038    }
2039
2040    /**
2041     * @return {@link #basedOn} (The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).)
2042     */
2043    public List<Reference> getBasedOn() { 
2044      if (this.basedOn == null)
2045        this.basedOn = new ArrayList<Reference>();
2046      return this.basedOn;
2047    }
2048
2049    /**
2050     * @return Returns a reference to <code>this</code> for easy method chaining
2051     */
2052    public Appointment setBasedOn(List<Reference> theBasedOn) { 
2053      this.basedOn = theBasedOn;
2054      return this;
2055    }
2056
2057    public boolean hasBasedOn() { 
2058      if (this.basedOn == null)
2059        return false;
2060      for (Reference item : this.basedOn)
2061        if (!item.isEmpty())
2062          return true;
2063      return false;
2064    }
2065
2066    public Reference addBasedOn() { //3
2067      Reference t = new Reference();
2068      if (this.basedOn == null)
2069        this.basedOn = new ArrayList<Reference>();
2070      this.basedOn.add(t);
2071      return t;
2072    }
2073
2074    public Appointment addBasedOn(Reference t) { //3
2075      if (t == null)
2076        return this;
2077      if (this.basedOn == null)
2078        this.basedOn = new ArrayList<Reference>();
2079      this.basedOn.add(t);
2080      return this;
2081    }
2082
2083    /**
2084     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
2085     */
2086    public Reference getBasedOnFirstRep() { 
2087      if (getBasedOn().isEmpty()) {
2088        addBasedOn();
2089      }
2090      return getBasedOn().get(0);
2091    }
2092
2093    /**
2094     * @return {@link #participant} (List of participants involved in the appointment.)
2095     */
2096    public List<AppointmentParticipantComponent> getParticipant() { 
2097      if (this.participant == null)
2098        this.participant = new ArrayList<AppointmentParticipantComponent>();
2099      return this.participant;
2100    }
2101
2102    /**
2103     * @return Returns a reference to <code>this</code> for easy method chaining
2104     */
2105    public Appointment setParticipant(List<AppointmentParticipantComponent> theParticipant) { 
2106      this.participant = theParticipant;
2107      return this;
2108    }
2109
2110    public boolean hasParticipant() { 
2111      if (this.participant == null)
2112        return false;
2113      for (AppointmentParticipantComponent item : this.participant)
2114        if (!item.isEmpty())
2115          return true;
2116      return false;
2117    }
2118
2119    public AppointmentParticipantComponent addParticipant() { //3
2120      AppointmentParticipantComponent t = new AppointmentParticipantComponent();
2121      if (this.participant == null)
2122        this.participant = new ArrayList<AppointmentParticipantComponent>();
2123      this.participant.add(t);
2124      return t;
2125    }
2126
2127    public Appointment addParticipant(AppointmentParticipantComponent t) { //3
2128      if (t == null)
2129        return this;
2130      if (this.participant == null)
2131        this.participant = new ArrayList<AppointmentParticipantComponent>();
2132      this.participant.add(t);
2133      return this;
2134    }
2135
2136    /**
2137     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist
2138     */
2139    public AppointmentParticipantComponent getParticipantFirstRep() { 
2140      if (getParticipant().isEmpty()) {
2141        addParticipant();
2142      }
2143      return getParticipant().get(0);
2144    }
2145
2146    /**
2147     * @return {@link #requestedPeriod} (A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.
2148
2149The 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.)
2150     */
2151    public List<Period> getRequestedPeriod() { 
2152      if (this.requestedPeriod == null)
2153        this.requestedPeriod = new ArrayList<Period>();
2154      return this.requestedPeriod;
2155    }
2156
2157    /**
2158     * @return Returns a reference to <code>this</code> for easy method chaining
2159     */
2160    public Appointment setRequestedPeriod(List<Period> theRequestedPeriod) { 
2161      this.requestedPeriod = theRequestedPeriod;
2162      return this;
2163    }
2164
2165    public boolean hasRequestedPeriod() { 
2166      if (this.requestedPeriod == null)
2167        return false;
2168      for (Period item : this.requestedPeriod)
2169        if (!item.isEmpty())
2170          return true;
2171      return false;
2172    }
2173
2174    public Period addRequestedPeriod() { //3
2175      Period t = new Period();
2176      if (this.requestedPeriod == null)
2177        this.requestedPeriod = new ArrayList<Period>();
2178      this.requestedPeriod.add(t);
2179      return t;
2180    }
2181
2182    public Appointment addRequestedPeriod(Period t) { //3
2183      if (t == null)
2184        return this;
2185      if (this.requestedPeriod == null)
2186        this.requestedPeriod = new ArrayList<Period>();
2187      this.requestedPeriod.add(t);
2188      return this;
2189    }
2190
2191    /**
2192     * @return The first repetition of repeating field {@link #requestedPeriod}, creating it if it does not already exist
2193     */
2194    public Period getRequestedPeriodFirstRep() { 
2195      if (getRequestedPeriod().isEmpty()) {
2196        addRequestedPeriod();
2197      }
2198      return getRequestedPeriod().get(0);
2199    }
2200
2201      protected void listChildren(List<Property> children) {
2202        super.listChildren(children);
2203        children.add(new Property("identifier", "Identifier", "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).", 0, java.lang.Integer.MAX_VALUE, identifier));
2204        children.add(new Property("status", "code", "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.", 0, 1, status));
2205        children.add(new Property("cancelationReason", "CodeableConcept", "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.", 0, 1, cancelationReason));
2206        children.add(new Property("serviceCategory", "CodeableConcept", "A broad categorization of the service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceCategory));
2207        children.add(new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType));
2208        children.add(new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty));
2209        children.add(new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1, appointmentType));
2210        children.add(new Property("reasonCode", "CodeableConcept", "The coded reason that this appointment is being scheduled. This is more clinical than administrative.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2211        children.add(new Property("reasonReference", "Reference(Condition|Procedure|Observation|ImmunizationRecommendation)", "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.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2212        children.add(new Property("priority", "unsignedInt", "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).", 0, 1, priority));
2213        children.add(new Property("description", "string", "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.", 0, 1, description));
2214        children.add(new Property("supportingInformation", "Reference(Any)", "Additional information to support the appointment provided when making the appointment.", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
2215        children.add(new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1, start));
2216        children.add(new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end));
2217        children.add(new Property("minutesDuration", "positiveInt", "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.", 0, 1, minutesDuration));
2218        children.add(new Property("slot", "Reference(Slot)", "The slots from the participants' schedules that will be filled by the appointment.", 0, java.lang.Integer.MAX_VALUE, slot));
2219        children.add(new Property("created", "dateTime", "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.", 0, 1, created));
2220        children.add(new Property("comment", "string", "Additional comments about the appointment.", 0, 1, comment));
2221        children.add(new Property("patientInstruction", "string", "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).", 0, 1, patientInstruction));
2222        children.add(new Property("basedOn", "Reference(ServiceRequest)", "The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).", 0, java.lang.Integer.MAX_VALUE, basedOn));
2223        children.add(new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant));
2224        children.add(new Property("requestedPeriod", "Period", "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.", 0, java.lang.Integer.MAX_VALUE, requestedPeriod));
2225      }
2226
2227      @Override
2228      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2229        switch (_hash) {
2230        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "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).", 0, java.lang.Integer.MAX_VALUE, identifier);
2231        case -892481550: /*status*/  return new Property("status", "code", "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.", 0, 1, status);
2232        case 987811551: /*cancelationReason*/  return new Property("cancelationReason", "CodeableConcept", "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.", 0, 1, cancelationReason);
2233        case 1281188563: /*serviceCategory*/  return new Property("serviceCategory", "CodeableConcept", "A broad categorization of the service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceCategory);
2234        case -1928370289: /*serviceType*/  return new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType);
2235        case -1694759682: /*specialty*/  return new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty);
2236        case -1596426375: /*appointmentType*/  return new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1, appointmentType);
2237        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "The coded reason that this appointment is being scheduled. This is more clinical than administrative.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2238        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Procedure|Observation|ImmunizationRecommendation)", "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.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2239        case -1165461084: /*priority*/  return new Property("priority", "unsignedInt", "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).", 0, 1, priority);
2240        case -1724546052: /*description*/  return new Property("description", "string", "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.", 0, 1, description);
2241        case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "Reference(Any)", "Additional information to support the appointment provided when making the appointment.", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
2242        case 109757538: /*start*/  return new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1, start);
2243        case 100571: /*end*/  return new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end);
2244        case -413630573: /*minutesDuration*/  return new Property("minutesDuration", "positiveInt", "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.", 0, 1, minutesDuration);
2245        case 3533310: /*slot*/  return new Property("slot", "Reference(Slot)", "The slots from the participants' schedules that will be filled by the appointment.", 0, java.lang.Integer.MAX_VALUE, slot);
2246        case 1028554472: /*created*/  return new Property("created", "dateTime", "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.", 0, 1, created);
2247        case 950398559: /*comment*/  return new Property("comment", "string", "Additional comments about the appointment.", 0, 1, comment);
2248        case 737543241: /*patientInstruction*/  return new Property("patientInstruction", "string", "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).", 0, 1, patientInstruction);
2249        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(ServiceRequest)", "The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).", 0, java.lang.Integer.MAX_VALUE, basedOn);
2250        case 767422259: /*participant*/  return new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant);
2251        case -897241393: /*requestedPeriod*/  return new Property("requestedPeriod", "Period", "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.", 0, java.lang.Integer.MAX_VALUE, requestedPeriod);
2252        default: return super.getNamedProperty(_hash, _name, _checkValid);
2253        }
2254
2255      }
2256
2257      @Override
2258      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2259        switch (hash) {
2260        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2261        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AppointmentStatus>
2262        case 987811551: /*cancelationReason*/ return this.cancelationReason == null ? new Base[0] : new Base[] {this.cancelationReason}; // CodeableConcept
2263        case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : this.serviceCategory.toArray(new Base[this.serviceCategory.size()]); // CodeableConcept
2264        case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
2265        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
2266        case -1596426375: /*appointmentType*/ return this.appointmentType == null ? new Base[0] : new Base[] {this.appointmentType}; // CodeableConcept
2267        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2268        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2269        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // UnsignedIntType
2270        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2271        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
2272        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // InstantType
2273        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
2274        case -413630573: /*minutesDuration*/ return this.minutesDuration == null ? new Base[0] : new Base[] {this.minutesDuration}; // PositiveIntType
2275        case 3533310: /*slot*/ return this.slot == null ? new Base[0] : this.slot.toArray(new Base[this.slot.size()]); // Reference
2276        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
2277        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
2278        case 737543241: /*patientInstruction*/ return this.patientInstruction == null ? new Base[0] : new Base[] {this.patientInstruction}; // StringType
2279        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2280        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // AppointmentParticipantComponent
2281        case -897241393: /*requestedPeriod*/ return this.requestedPeriod == null ? new Base[0] : this.requestedPeriod.toArray(new Base[this.requestedPeriod.size()]); // Period
2282        default: return super.getProperty(hash, name, checkValid);
2283        }
2284
2285      }
2286
2287      @Override
2288      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2289        switch (hash) {
2290        case -1618432855: // identifier
2291          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2292          return value;
2293        case -892481550: // status
2294          value = new AppointmentStatusEnumFactory().fromType(castToCode(value));
2295          this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
2296          return value;
2297        case 987811551: // cancelationReason
2298          this.cancelationReason = castToCodeableConcept(value); // CodeableConcept
2299          return value;
2300        case 1281188563: // serviceCategory
2301          this.getServiceCategory().add(castToCodeableConcept(value)); // CodeableConcept
2302          return value;
2303        case -1928370289: // serviceType
2304          this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
2305          return value;
2306        case -1694759682: // specialty
2307          this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
2308          return value;
2309        case -1596426375: // appointmentType
2310          this.appointmentType = castToCodeableConcept(value); // CodeableConcept
2311          return value;
2312        case 722137681: // reasonCode
2313          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2314          return value;
2315        case -1146218137: // reasonReference
2316          this.getReasonReference().add(castToReference(value)); // Reference
2317          return value;
2318        case -1165461084: // priority
2319          this.priority = castToUnsignedInt(value); // UnsignedIntType
2320          return value;
2321        case -1724546052: // description
2322          this.description = castToString(value); // StringType
2323          return value;
2324        case -1248768647: // supportingInformation
2325          this.getSupportingInformation().add(castToReference(value)); // Reference
2326          return value;
2327        case 109757538: // start
2328          this.start = castToInstant(value); // InstantType
2329          return value;
2330        case 100571: // end
2331          this.end = castToInstant(value); // InstantType
2332          return value;
2333        case -413630573: // minutesDuration
2334          this.minutesDuration = castToPositiveInt(value); // PositiveIntType
2335          return value;
2336        case 3533310: // slot
2337          this.getSlot().add(castToReference(value)); // Reference
2338          return value;
2339        case 1028554472: // created
2340          this.created = castToDateTime(value); // DateTimeType
2341          return value;
2342        case 950398559: // comment
2343          this.comment = castToString(value); // StringType
2344          return value;
2345        case 737543241: // patientInstruction
2346          this.patientInstruction = castToString(value); // StringType
2347          return value;
2348        case -332612366: // basedOn
2349          this.getBasedOn().add(castToReference(value)); // Reference
2350          return value;
2351        case 767422259: // participant
2352          this.getParticipant().add((AppointmentParticipantComponent) value); // AppointmentParticipantComponent
2353          return value;
2354        case -897241393: // requestedPeriod
2355          this.getRequestedPeriod().add(castToPeriod(value)); // Period
2356          return value;
2357        default: return super.setProperty(hash, name, value);
2358        }
2359
2360      }
2361
2362      @Override
2363      public Base setProperty(String name, Base value) throws FHIRException {
2364        if (name.equals("identifier")) {
2365          this.getIdentifier().add(castToIdentifier(value));
2366        } else if (name.equals("status")) {
2367          value = new AppointmentStatusEnumFactory().fromType(castToCode(value));
2368          this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
2369        } else if (name.equals("cancelationReason")) {
2370          this.cancelationReason = castToCodeableConcept(value); // CodeableConcept
2371        } else if (name.equals("serviceCategory")) {
2372          this.getServiceCategory().add(castToCodeableConcept(value));
2373        } else if (name.equals("serviceType")) {
2374          this.getServiceType().add(castToCodeableConcept(value));
2375        } else if (name.equals("specialty")) {
2376          this.getSpecialty().add(castToCodeableConcept(value));
2377        } else if (name.equals("appointmentType")) {
2378          this.appointmentType = castToCodeableConcept(value); // CodeableConcept
2379        } else if (name.equals("reasonCode")) {
2380          this.getReasonCode().add(castToCodeableConcept(value));
2381        } else if (name.equals("reasonReference")) {
2382          this.getReasonReference().add(castToReference(value));
2383        } else if (name.equals("priority")) {
2384          this.priority = castToUnsignedInt(value); // UnsignedIntType
2385        } else if (name.equals("description")) {
2386          this.description = castToString(value); // StringType
2387        } else if (name.equals("supportingInformation")) {
2388          this.getSupportingInformation().add(castToReference(value));
2389        } else if (name.equals("start")) {
2390          this.start = castToInstant(value); // InstantType
2391        } else if (name.equals("end")) {
2392          this.end = castToInstant(value); // InstantType
2393        } else if (name.equals("minutesDuration")) {
2394          this.minutesDuration = castToPositiveInt(value); // PositiveIntType
2395        } else if (name.equals("slot")) {
2396          this.getSlot().add(castToReference(value));
2397        } else if (name.equals("created")) {
2398          this.created = castToDateTime(value); // DateTimeType
2399        } else if (name.equals("comment")) {
2400          this.comment = castToString(value); // StringType
2401        } else if (name.equals("patientInstruction")) {
2402          this.patientInstruction = castToString(value); // StringType
2403        } else if (name.equals("basedOn")) {
2404          this.getBasedOn().add(castToReference(value));
2405        } else if (name.equals("participant")) {
2406          this.getParticipant().add((AppointmentParticipantComponent) value);
2407        } else if (name.equals("requestedPeriod")) {
2408          this.getRequestedPeriod().add(castToPeriod(value));
2409        } else
2410          return super.setProperty(name, value);
2411        return value;
2412      }
2413
2414      @Override
2415      public Base makeProperty(int hash, String name) throws FHIRException {
2416        switch (hash) {
2417        case -1618432855:  return addIdentifier(); 
2418        case -892481550:  return getStatusElement();
2419        case 987811551:  return getCancelationReason();
2420        case 1281188563:  return addServiceCategory(); 
2421        case -1928370289:  return addServiceType(); 
2422        case -1694759682:  return addSpecialty(); 
2423        case -1596426375:  return getAppointmentType();
2424        case 722137681:  return addReasonCode(); 
2425        case -1146218137:  return addReasonReference(); 
2426        case -1165461084:  return getPriorityElement();
2427        case -1724546052:  return getDescriptionElement();
2428        case -1248768647:  return addSupportingInformation(); 
2429        case 109757538:  return getStartElement();
2430        case 100571:  return getEndElement();
2431        case -413630573:  return getMinutesDurationElement();
2432        case 3533310:  return addSlot(); 
2433        case 1028554472:  return getCreatedElement();
2434        case 950398559:  return getCommentElement();
2435        case 737543241:  return getPatientInstructionElement();
2436        case -332612366:  return addBasedOn(); 
2437        case 767422259:  return addParticipant(); 
2438        case -897241393:  return addRequestedPeriod(); 
2439        default: return super.makeProperty(hash, name);
2440        }
2441
2442      }
2443
2444      @Override
2445      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2446        switch (hash) {
2447        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2448        case -892481550: /*status*/ return new String[] {"code"};
2449        case 987811551: /*cancelationReason*/ return new String[] {"CodeableConcept"};
2450        case 1281188563: /*serviceCategory*/ return new String[] {"CodeableConcept"};
2451        case -1928370289: /*serviceType*/ return new String[] {"CodeableConcept"};
2452        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
2453        case -1596426375: /*appointmentType*/ return new String[] {"CodeableConcept"};
2454        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2455        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2456        case -1165461084: /*priority*/ return new String[] {"unsignedInt"};
2457        case -1724546052: /*description*/ return new String[] {"string"};
2458        case -1248768647: /*supportingInformation*/ return new String[] {"Reference"};
2459        case 109757538: /*start*/ return new String[] {"instant"};
2460        case 100571: /*end*/ return new String[] {"instant"};
2461        case -413630573: /*minutesDuration*/ return new String[] {"positiveInt"};
2462        case 3533310: /*slot*/ return new String[] {"Reference"};
2463        case 1028554472: /*created*/ return new String[] {"dateTime"};
2464        case 950398559: /*comment*/ return new String[] {"string"};
2465        case 737543241: /*patientInstruction*/ return new String[] {"string"};
2466        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2467        case 767422259: /*participant*/ return new String[] {};
2468        case -897241393: /*requestedPeriod*/ return new String[] {"Period"};
2469        default: return super.getTypesForProperty(hash, name);
2470        }
2471
2472      }
2473
2474      @Override
2475      public Base addChild(String name) throws FHIRException {
2476        if (name.equals("identifier")) {
2477          return addIdentifier();
2478        }
2479        else if (name.equals("status")) {
2480          throw new FHIRException("Cannot call addChild on a primitive type Appointment.status");
2481        }
2482        else if (name.equals("cancelationReason")) {
2483          this.cancelationReason = new CodeableConcept();
2484          return this.cancelationReason;
2485        }
2486        else if (name.equals("serviceCategory")) {
2487          return addServiceCategory();
2488        }
2489        else if (name.equals("serviceType")) {
2490          return addServiceType();
2491        }
2492        else if (name.equals("specialty")) {
2493          return addSpecialty();
2494        }
2495        else if (name.equals("appointmentType")) {
2496          this.appointmentType = new CodeableConcept();
2497          return this.appointmentType;
2498        }
2499        else if (name.equals("reasonCode")) {
2500          return addReasonCode();
2501        }
2502        else if (name.equals("reasonReference")) {
2503          return addReasonReference();
2504        }
2505        else if (name.equals("priority")) {
2506          throw new FHIRException("Cannot call addChild on a primitive type Appointment.priority");
2507        }
2508        else if (name.equals("description")) {
2509          throw new FHIRException("Cannot call addChild on a primitive type Appointment.description");
2510        }
2511        else if (name.equals("supportingInformation")) {
2512          return addSupportingInformation();
2513        }
2514        else if (name.equals("start")) {
2515          throw new FHIRException("Cannot call addChild on a primitive type Appointment.start");
2516        }
2517        else if (name.equals("end")) {
2518          throw new FHIRException("Cannot call addChild on a primitive type Appointment.end");
2519        }
2520        else if (name.equals("minutesDuration")) {
2521          throw new FHIRException("Cannot call addChild on a primitive type Appointment.minutesDuration");
2522        }
2523        else if (name.equals("slot")) {
2524          return addSlot();
2525        }
2526        else if (name.equals("created")) {
2527          throw new FHIRException("Cannot call addChild on a primitive type Appointment.created");
2528        }
2529        else if (name.equals("comment")) {
2530          throw new FHIRException("Cannot call addChild on a primitive type Appointment.comment");
2531        }
2532        else if (name.equals("patientInstruction")) {
2533          throw new FHIRException("Cannot call addChild on a primitive type Appointment.patientInstruction");
2534        }
2535        else if (name.equals("basedOn")) {
2536          return addBasedOn();
2537        }
2538        else if (name.equals("participant")) {
2539          return addParticipant();
2540        }
2541        else if (name.equals("requestedPeriod")) {
2542          return addRequestedPeriod();
2543        }
2544        else
2545          return super.addChild(name);
2546      }
2547
2548  public String fhirType() {
2549    return "Appointment";
2550
2551  }
2552
2553      public Appointment copy() {
2554        Appointment dst = new Appointment();
2555        copyValues(dst);
2556        return dst;
2557      }
2558
2559      public void copyValues(Appointment dst) {
2560        super.copyValues(dst);
2561        if (identifier != null) {
2562          dst.identifier = new ArrayList<Identifier>();
2563          for (Identifier i : identifier)
2564            dst.identifier.add(i.copy());
2565        };
2566        dst.status = status == null ? null : status.copy();
2567        dst.cancelationReason = cancelationReason == null ? null : cancelationReason.copy();
2568        if (serviceCategory != null) {
2569          dst.serviceCategory = new ArrayList<CodeableConcept>();
2570          for (CodeableConcept i : serviceCategory)
2571            dst.serviceCategory.add(i.copy());
2572        };
2573        if (serviceType != null) {
2574          dst.serviceType = new ArrayList<CodeableConcept>();
2575          for (CodeableConcept i : serviceType)
2576            dst.serviceType.add(i.copy());
2577        };
2578        if (specialty != null) {
2579          dst.specialty = new ArrayList<CodeableConcept>();
2580          for (CodeableConcept i : specialty)
2581            dst.specialty.add(i.copy());
2582        };
2583        dst.appointmentType = appointmentType == null ? null : appointmentType.copy();
2584        if (reasonCode != null) {
2585          dst.reasonCode = new ArrayList<CodeableConcept>();
2586          for (CodeableConcept i : reasonCode)
2587            dst.reasonCode.add(i.copy());
2588        };
2589        if (reasonReference != null) {
2590          dst.reasonReference = new ArrayList<Reference>();
2591          for (Reference i : reasonReference)
2592            dst.reasonReference.add(i.copy());
2593        };
2594        dst.priority = priority == null ? null : priority.copy();
2595        dst.description = description == null ? null : description.copy();
2596        if (supportingInformation != null) {
2597          dst.supportingInformation = new ArrayList<Reference>();
2598          for (Reference i : supportingInformation)
2599            dst.supportingInformation.add(i.copy());
2600        };
2601        dst.start = start == null ? null : start.copy();
2602        dst.end = end == null ? null : end.copy();
2603        dst.minutesDuration = minutesDuration == null ? null : minutesDuration.copy();
2604        if (slot != null) {
2605          dst.slot = new ArrayList<Reference>();
2606          for (Reference i : slot)
2607            dst.slot.add(i.copy());
2608        };
2609        dst.created = created == null ? null : created.copy();
2610        dst.comment = comment == null ? null : comment.copy();
2611        dst.patientInstruction = patientInstruction == null ? null : patientInstruction.copy();
2612        if (basedOn != null) {
2613          dst.basedOn = new ArrayList<Reference>();
2614          for (Reference i : basedOn)
2615            dst.basedOn.add(i.copy());
2616        };
2617        if (participant != null) {
2618          dst.participant = new ArrayList<AppointmentParticipantComponent>();
2619          for (AppointmentParticipantComponent i : participant)
2620            dst.participant.add(i.copy());
2621        };
2622        if (requestedPeriod != null) {
2623          dst.requestedPeriod = new ArrayList<Period>();
2624          for (Period i : requestedPeriod)
2625            dst.requestedPeriod.add(i.copy());
2626        };
2627      }
2628
2629      protected Appointment typedCopy() {
2630        return copy();
2631      }
2632
2633      @Override
2634      public boolean equalsDeep(Base other_) {
2635        if (!super.equalsDeep(other_))
2636          return false;
2637        if (!(other_ instanceof Appointment))
2638          return false;
2639        Appointment o = (Appointment) other_;
2640        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(cancelationReason, o.cancelationReason, true)
2641           && compareDeep(serviceCategory, o.serviceCategory, true) && compareDeep(serviceType, o.serviceType, true)
2642           && compareDeep(specialty, o.specialty, true) && compareDeep(appointmentType, o.appointmentType, true)
2643           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
2644           && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true) && compareDeep(supportingInformation, o.supportingInformation, true)
2645           && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(minutesDuration, o.minutesDuration, true)
2646           && compareDeep(slot, o.slot, true) && compareDeep(created, o.created, true) && compareDeep(comment, o.comment, true)
2647           && compareDeep(patientInstruction, o.patientInstruction, true) && compareDeep(basedOn, o.basedOn, true)
2648           && compareDeep(participant, o.participant, true) && compareDeep(requestedPeriod, o.requestedPeriod, true)
2649          ;
2650      }
2651
2652      @Override
2653      public boolean equalsShallow(Base other_) {
2654        if (!super.equalsShallow(other_))
2655          return false;
2656        if (!(other_ instanceof Appointment))
2657          return false;
2658        Appointment o = (Appointment) other_;
2659        return compareValues(status, o.status, true) && compareValues(priority, o.priority, true) && compareValues(description, o.description, true)
2660           && compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(minutesDuration, o.minutesDuration, true)
2661           && compareValues(created, o.created, true) && compareValues(comment, o.comment, true) && compareValues(patientInstruction, o.patientInstruction, true)
2662          ;
2663      }
2664
2665      public boolean isEmpty() {
2666        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, cancelationReason
2667          , serviceCategory, serviceType, specialty, appointmentType, reasonCode, reasonReference
2668          , priority, description, supportingInformation, start, end, minutesDuration, slot
2669          , created, comment, patientInstruction, basedOn, participant, requestedPeriod);
2670      }
2671
2672  @Override
2673  public ResourceType getResourceType() {
2674    return ResourceType.Appointment;
2675   }
2676
2677 /**
2678   * Search parameter: <b>date</b>
2679   * <p>
2680   * Description: <b>Appointment date/time.</b><br>
2681   * Type: <b>date</b><br>
2682   * Path: <b>Appointment.start</b><br>
2683   * </p>
2684   */
2685  @SearchParamDefinition(name="date", path="Appointment.start", description="Appointment date/time.", type="date" )
2686  public static final String SP_DATE = "date";
2687 /**
2688   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2689   * <p>
2690   * Description: <b>Appointment date/time.</b><br>
2691   * Type: <b>date</b><br>
2692   * Path: <b>Appointment.start</b><br>
2693   * </p>
2694   */
2695  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2696
2697 /**
2698   * Search parameter: <b>identifier</b>
2699   * <p>
2700   * Description: <b>An Identifier of the Appointment</b><br>
2701   * Type: <b>token</b><br>
2702   * Path: <b>Appointment.identifier</b><br>
2703   * </p>
2704   */
2705  @SearchParamDefinition(name="identifier", path="Appointment.identifier", description="An Identifier of the Appointment", type="token" )
2706  public static final String SP_IDENTIFIER = "identifier";
2707 /**
2708   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2709   * <p>
2710   * Description: <b>An Identifier of the Appointment</b><br>
2711   * Type: <b>token</b><br>
2712   * Path: <b>Appointment.identifier</b><br>
2713   * </p>
2714   */
2715  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2716
2717 /**
2718   * Search parameter: <b>specialty</b>
2719   * <p>
2720   * Description: <b>The specialty of a practitioner that would be required to perform the service requested in this appointment</b><br>
2721   * Type: <b>token</b><br>
2722   * Path: <b>Appointment.specialty</b><br>
2723   * </p>
2724   */
2725  @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" )
2726  public static final String SP_SPECIALTY = "specialty";
2727 /**
2728   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
2729   * <p>
2730   * Description: <b>The specialty of a practitioner that would be required to perform the service requested in this appointment</b><br>
2731   * Type: <b>token</b><br>
2732   * Path: <b>Appointment.specialty</b><br>
2733   * </p>
2734   */
2735  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIALTY);
2736
2737 /**
2738   * Search parameter: <b>service-category</b>
2739   * <p>
2740   * Description: <b>A broad categorization of the service that is to be performed during this appointment</b><br>
2741   * Type: <b>token</b><br>
2742   * Path: <b>Appointment.serviceCategory</b><br>
2743   * </p>
2744   */
2745  @SearchParamDefinition(name="service-category", path="Appointment.serviceCategory", description="A broad categorization of the service that is to be performed during this appointment", type="token" )
2746  public static final String SP_SERVICE_CATEGORY = "service-category";
2747 /**
2748   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
2749   * <p>
2750   * Description: <b>A broad categorization of the service that is to be performed during this appointment</b><br>
2751   * Type: <b>token</b><br>
2752   * Path: <b>Appointment.serviceCategory</b><br>
2753   * </p>
2754   */
2755  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_CATEGORY);
2756
2757 /**
2758   * Search parameter: <b>practitioner</b>
2759   * <p>
2760   * Description: <b>One of the individuals of the appointment is this practitioner</b><br>
2761   * Type: <b>reference</b><br>
2762   * Path: <b>Appointment.participant.actor</b><br>
2763   * </p>
2764   */
2765  @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={Practitioner.class } )
2766  public static final String SP_PRACTITIONER = "practitioner";
2767 /**
2768   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
2769   * <p>
2770   * Description: <b>One of the individuals of the appointment is this practitioner</b><br>
2771   * Type: <b>reference</b><br>
2772   * Path: <b>Appointment.participant.actor</b><br>
2773   * </p>
2774   */
2775  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
2776
2777/**
2778   * Constant for fluent queries to be used to add include statements. Specifies
2779   * the path value of "<b>Appointment:practitioner</b>".
2780   */
2781  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("Appointment:practitioner").toLocked();
2782
2783 /**
2784   * Search parameter: <b>part-status</b>
2785   * <p>
2786   * Description: <b>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.</b><br>
2787   * Type: <b>token</b><br>
2788   * Path: <b>Appointment.participant.status</b><br>
2789   * </p>
2790   */
2791  @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" )
2792  public static final String SP_PART_STATUS = "part-status";
2793 /**
2794   * <b>Fluent Client</b> search parameter constant for <b>part-status</b>
2795   * <p>
2796   * Description: <b>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.</b><br>
2797   * Type: <b>token</b><br>
2798   * Path: <b>Appointment.participant.status</b><br>
2799   * </p>
2800   */
2801  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PART_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PART_STATUS);
2802
2803 /**
2804   * Search parameter: <b>appointment-type</b>
2805   * <p>
2806   * Description: <b>The style of appointment or patient that has been booked in the slot (not service type)</b><br>
2807   * Type: <b>token</b><br>
2808   * Path: <b>Appointment.appointmentType</b><br>
2809   * </p>
2810   */
2811  @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" )
2812  public static final String SP_APPOINTMENT_TYPE = "appointment-type";
2813 /**
2814   * <b>Fluent Client</b> search parameter constant for <b>appointment-type</b>
2815   * <p>
2816   * Description: <b>The style of appointment or patient that has been booked in the slot (not service type)</b><br>
2817   * Type: <b>token</b><br>
2818   * Path: <b>Appointment.appointmentType</b><br>
2819   * </p>
2820   */
2821  public static final ca.uhn.fhir.rest.gclient.TokenClientParam APPOINTMENT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_APPOINTMENT_TYPE);
2822
2823 /**
2824   * Search parameter: <b>service-type</b>
2825   * <p>
2826   * Description: <b>The specific service that is to be performed during this appointment</b><br>
2827   * Type: <b>token</b><br>
2828   * Path: <b>Appointment.serviceType</b><br>
2829   * </p>
2830   */
2831  @SearchParamDefinition(name="service-type", path="Appointment.serviceType", description="The specific service that is to be performed during this appointment", type="token" )
2832  public static final String SP_SERVICE_TYPE = "service-type";
2833 /**
2834   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
2835   * <p>
2836   * Description: <b>The specific service that is to be performed during this appointment</b><br>
2837   * Type: <b>token</b><br>
2838   * Path: <b>Appointment.serviceType</b><br>
2839   * </p>
2840   */
2841  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_TYPE);
2842
2843 /**
2844   * Search parameter: <b>slot</b>
2845   * <p>
2846   * Description: <b>The slots that this appointment is filling</b><br>
2847   * Type: <b>reference</b><br>
2848   * Path: <b>Appointment.slot</b><br>
2849   * </p>
2850   */
2851  @SearchParamDefinition(name="slot", path="Appointment.slot", description="The slots that this appointment is filling", type="reference", target={Slot.class } )
2852  public static final String SP_SLOT = "slot";
2853 /**
2854   * <b>Fluent Client</b> search parameter constant for <b>slot</b>
2855   * <p>
2856   * Description: <b>The slots that this appointment is filling</b><br>
2857   * Type: <b>reference</b><br>
2858   * Path: <b>Appointment.slot</b><br>
2859   * </p>
2860   */
2861  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SLOT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SLOT);
2862
2863/**
2864   * Constant for fluent queries to be used to add include statements. Specifies
2865   * the path value of "<b>Appointment:slot</b>".
2866   */
2867  public static final ca.uhn.fhir.model.api.Include INCLUDE_SLOT = new ca.uhn.fhir.model.api.Include("Appointment:slot").toLocked();
2868
2869 /**
2870   * Search parameter: <b>reason-code</b>
2871   * <p>
2872   * Description: <b>Coded reason this appointment is scheduled</b><br>
2873   * Type: <b>token</b><br>
2874   * Path: <b>Appointment.reasonCode</b><br>
2875   * </p>
2876   */
2877  @SearchParamDefinition(name="reason-code", path="Appointment.reasonCode", description="Coded reason this appointment is scheduled", type="token" )
2878  public static final String SP_REASON_CODE = "reason-code";
2879 /**
2880   * <b>Fluent Client</b> search parameter constant for <b>reason-code</b>
2881   * <p>
2882   * Description: <b>Coded reason this appointment is scheduled</b><br>
2883   * Type: <b>token</b><br>
2884   * Path: <b>Appointment.reasonCode</b><br>
2885   * </p>
2886   */
2887  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_CODE);
2888
2889 /**
2890   * Search parameter: <b>actor</b>
2891   * <p>
2892   * Description: <b>Any one of the individuals participating in the appointment</b><br>
2893   * Type: <b>reference</b><br>
2894   * Path: <b>Appointment.participant.actor</b><br>
2895   * </p>
2896   */
2897  @SearchParamDefinition(name="actor", path="Appointment.participant.actor", description="Any one of the individuals participating in the appointment", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2898  public static final String SP_ACTOR = "actor";
2899 /**
2900   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
2901   * <p>
2902   * Description: <b>Any one of the individuals participating in the appointment</b><br>
2903   * Type: <b>reference</b><br>
2904   * Path: <b>Appointment.participant.actor</b><br>
2905   * </p>
2906   */
2907  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
2908
2909/**
2910   * Constant for fluent queries to be used to add include statements. Specifies
2911   * the path value of "<b>Appointment:actor</b>".
2912   */
2913  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Appointment:actor").toLocked();
2914
2915 /**
2916   * Search parameter: <b>based-on</b>
2917   * <p>
2918   * Description: <b>The service request this appointment is allocated to assess</b><br>
2919   * Type: <b>reference</b><br>
2920   * Path: <b>Appointment.basedOn</b><br>
2921   * </p>
2922   */
2923  @SearchParamDefinition(name="based-on", path="Appointment.basedOn", description="The service request this appointment is allocated to assess", type="reference", target={ServiceRequest.class } )
2924  public static final String SP_BASED_ON = "based-on";
2925 /**
2926   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2927   * <p>
2928   * Description: <b>The service request this appointment is allocated to assess</b><br>
2929   * Type: <b>reference</b><br>
2930   * Path: <b>Appointment.basedOn</b><br>
2931   * </p>
2932   */
2933  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2934
2935/**
2936   * Constant for fluent queries to be used to add include statements. Specifies
2937   * the path value of "<b>Appointment:based-on</b>".
2938   */
2939  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Appointment:based-on").toLocked();
2940
2941 /**
2942   * Search parameter: <b>patient</b>
2943   * <p>
2944   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2945   * Type: <b>reference</b><br>
2946   * Path: <b>Appointment.participant.actor</b><br>
2947   * </p>
2948   */
2949  @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={Patient.class } )
2950  public static final String SP_PATIENT = "patient";
2951 /**
2952   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2953   * <p>
2954   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2955   * Type: <b>reference</b><br>
2956   * Path: <b>Appointment.participant.actor</b><br>
2957   * </p>
2958   */
2959  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2960
2961/**
2962   * Constant for fluent queries to be used to add include statements. Specifies
2963   * the path value of "<b>Appointment:patient</b>".
2964   */
2965  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Appointment:patient").toLocked();
2966
2967 /**
2968   * Search parameter: <b>reason-reference</b>
2969   * <p>
2970   * Description: <b>Reason the appointment is to take place (resource)</b><br>
2971   * Type: <b>reference</b><br>
2972   * Path: <b>Appointment.reasonReference</b><br>
2973   * </p>
2974   */
2975  @SearchParamDefinition(name="reason-reference", path="Appointment.reasonReference", description="Reason the appointment is to take place (resource)", type="reference", target={Condition.class, ImmunizationRecommendation.class, Observation.class, Procedure.class } )
2976  public static final String SP_REASON_REFERENCE = "reason-reference";
2977 /**
2978   * <b>Fluent Client</b> search parameter constant for <b>reason-reference</b>
2979   * <p>
2980   * Description: <b>Reason the appointment is to take place (resource)</b><br>
2981   * Type: <b>reference</b><br>
2982   * Path: <b>Appointment.reasonReference</b><br>
2983   * </p>
2984   */
2985  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REASON_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REASON_REFERENCE);
2986
2987/**
2988   * Constant for fluent queries to be used to add include statements. Specifies
2989   * the path value of "<b>Appointment:reason-reference</b>".
2990   */
2991  public static final ca.uhn.fhir.model.api.Include INCLUDE_REASON_REFERENCE = new ca.uhn.fhir.model.api.Include("Appointment:reason-reference").toLocked();
2992
2993 /**
2994   * Search parameter: <b>supporting-info</b>
2995   * <p>
2996   * Description: <b>Additional information to support the appointment</b><br>
2997   * Type: <b>reference</b><br>
2998   * Path: <b>Appointment.supportingInformation</b><br>
2999   * </p>
3000   */
3001  @SearchParamDefinition(name="supporting-info", path="Appointment.supportingInformation", description="Additional information to support the appointment", type="reference" )
3002  public static final String SP_SUPPORTING_INFO = "supporting-info";
3003 /**
3004   * <b>Fluent Client</b> search parameter constant for <b>supporting-info</b>
3005   * <p>
3006   * Description: <b>Additional information to support the appointment</b><br>
3007   * Type: <b>reference</b><br>
3008   * Path: <b>Appointment.supportingInformation</b><br>
3009   * </p>
3010   */
3011  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPORTING_INFO = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUPPORTING_INFO);
3012
3013/**
3014   * Constant for fluent queries to be used to add include statements. Specifies
3015   * the path value of "<b>Appointment:supporting-info</b>".
3016   */
3017  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPORTING_INFO = new ca.uhn.fhir.model.api.Include("Appointment:supporting-info").toLocked();
3018
3019 /**
3020   * Search parameter: <b>location</b>
3021   * <p>
3022   * Description: <b>This location is listed in the participants of the appointment</b><br>
3023   * Type: <b>reference</b><br>
3024   * Path: <b>Appointment.participant.actor</b><br>
3025   * </p>
3026   */
3027  @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={Location.class } )
3028  public static final String SP_LOCATION = "location";
3029 /**
3030   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3031   * <p>
3032   * Description: <b>This location is listed in the participants of the appointment</b><br>
3033   * Type: <b>reference</b><br>
3034   * Path: <b>Appointment.participant.actor</b><br>
3035   * </p>
3036   */
3037  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3038
3039/**
3040   * Constant for fluent queries to be used to add include statements. Specifies
3041   * the path value of "<b>Appointment:location</b>".
3042   */
3043  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Appointment:location").toLocked();
3044
3045 /**
3046   * Search parameter: <b>status</b>
3047   * <p>
3048   * Description: <b>The overall status of the appointment</b><br>
3049   * Type: <b>token</b><br>
3050   * Path: <b>Appointment.status</b><br>
3051   * </p>
3052   */
3053  @SearchParamDefinition(name="status", path="Appointment.status", description="The overall status of the appointment", type="token" )
3054  public static final String SP_STATUS = "status";
3055 /**
3056   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3057   * <p>
3058   * Description: <b>The overall status of the appointment</b><br>
3059   * Type: <b>token</b><br>
3060   * Path: <b>Appointment.status</b><br>
3061   * </p>
3062   */
3063  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3064
3065
3066}
3067