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