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