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