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