001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046/**
047 * 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).
048 */
049@ResourceDef(name="Appointment", profile="http://hl7.org/fhir/Profile/Appointment")
050public class Appointment extends DomainResource {
051
052    public enum AppointmentStatus {
053        /**
054         * None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time may not be set yet.
055         */
056        PROPOSED, 
057        /**
058         * Some or all of the participant(s) have not finalized their acceptance of the appointment request.
059         */
060        PENDING, 
061        /**
062         * All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.
063         */
064        BOOKED, 
065        /**
066         * Some of the patients have arrived.
067         */
068        ARRIVED, 
069        /**
070         * This appointment has completed and may have resulted in an encounter.
071         */
072        FULFILLED, 
073        /**
074         * The appointment has been cancelled.
075         */
076        CANCELLED, 
077        /**
078         * Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).
079         */
080        NOSHOW, 
081        /**
082         * added to help the parsers
083         */
084        NULL;
085        public static AppointmentStatus fromCode(String codeString) throws FHIRException {
086            if (codeString == null || "".equals(codeString))
087                return null;
088        if ("proposed".equals(codeString))
089          return PROPOSED;
090        if ("pending".equals(codeString))
091          return PENDING;
092        if ("booked".equals(codeString))
093          return BOOKED;
094        if ("arrived".equals(codeString))
095          return ARRIVED;
096        if ("fulfilled".equals(codeString))
097          return FULFILLED;
098        if ("cancelled".equals(codeString))
099          return CANCELLED;
100        if ("noshow".equals(codeString))
101          return NOSHOW;
102        throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'");
103        }
104        public String toCode() {
105          switch (this) {
106            case PROPOSED: return "proposed";
107            case PENDING: return "pending";
108            case BOOKED: return "booked";
109            case ARRIVED: return "arrived";
110            case FULFILLED: return "fulfilled";
111            case CANCELLED: return "cancelled";
112            case NOSHOW: return "noshow";
113            default: return "?";
114          }
115        }
116        public String getSystem() {
117          switch (this) {
118            case PROPOSED: return "http://hl7.org/fhir/appointmentstatus";
119            case PENDING: return "http://hl7.org/fhir/appointmentstatus";
120            case BOOKED: return "http://hl7.org/fhir/appointmentstatus";
121            case ARRIVED: return "http://hl7.org/fhir/appointmentstatus";
122            case FULFILLED: return "http://hl7.org/fhir/appointmentstatus";
123            case CANCELLED: return "http://hl7.org/fhir/appointmentstatus";
124            case NOSHOW: return "http://hl7.org/fhir/appointmentstatus";
125            default: return "?";
126          }
127        }
128        public String getDefinition() {
129          switch (this) {
130            case PROPOSED: return "None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time may not be set yet.";
131            case PENDING: return "Some or all of the participant(s) have not finalized their acceptance of the appointment request.";
132            case BOOKED: return "All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.";
133            case ARRIVED: return "Some of the patients have arrived.";
134            case FULFILLED: return "This appointment has completed and may have resulted in an encounter.";
135            case CANCELLED: return "The appointment has been cancelled.";
136            case NOSHOW: return "Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).";
137            default: return "?";
138          }
139        }
140        public String getDisplay() {
141          switch (this) {
142            case PROPOSED: return "Proposed";
143            case PENDING: return "Pending";
144            case BOOKED: return "Booked";
145            case ARRIVED: return "Arrived";
146            case FULFILLED: return "Fulfilled";
147            case CANCELLED: return "Cancelled";
148            case NOSHOW: return "No Show";
149            default: return "?";
150          }
151        }
152    }
153
154  public static class AppointmentStatusEnumFactory implements EnumFactory<AppointmentStatus> {
155    public AppointmentStatus fromCode(String codeString) throws IllegalArgumentException {
156      if (codeString == null || "".equals(codeString))
157            if (codeString == null || "".equals(codeString))
158                return null;
159        if ("proposed".equals(codeString))
160          return AppointmentStatus.PROPOSED;
161        if ("pending".equals(codeString))
162          return AppointmentStatus.PENDING;
163        if ("booked".equals(codeString))
164          return AppointmentStatus.BOOKED;
165        if ("arrived".equals(codeString))
166          return AppointmentStatus.ARRIVED;
167        if ("fulfilled".equals(codeString))
168          return AppointmentStatus.FULFILLED;
169        if ("cancelled".equals(codeString))
170          return AppointmentStatus.CANCELLED;
171        if ("noshow".equals(codeString))
172          return AppointmentStatus.NOSHOW;
173        throw new IllegalArgumentException("Unknown AppointmentStatus code '"+codeString+"'");
174        }
175        public Enumeration<AppointmentStatus> fromType(Base code) throws FHIRException {
176          if (code == null || code.isEmpty())
177            return null;
178          String codeString = ((PrimitiveType) code).asStringValue();
179          if (codeString == null || "".equals(codeString))
180            return null;
181        if ("proposed".equals(codeString))
182          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PROPOSED);
183        if ("pending".equals(codeString))
184          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PENDING);
185        if ("booked".equals(codeString))
186          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.BOOKED);
187        if ("arrived".equals(codeString))
188          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ARRIVED);
189        if ("fulfilled".equals(codeString))
190          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.FULFILLED);
191        if ("cancelled".equals(codeString))
192          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CANCELLED);
193        if ("noshow".equals(codeString))
194          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NOSHOW);
195        throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'");
196        }
197    public String toCode(AppointmentStatus code) {
198      if (code == AppointmentStatus.PROPOSED)
199        return "proposed";
200      if (code == AppointmentStatus.PENDING)
201        return "pending";
202      if (code == AppointmentStatus.BOOKED)
203        return "booked";
204      if (code == AppointmentStatus.ARRIVED)
205        return "arrived";
206      if (code == AppointmentStatus.FULFILLED)
207        return "fulfilled";
208      if (code == AppointmentStatus.CANCELLED)
209        return "cancelled";
210      if (code == AppointmentStatus.NOSHOW)
211        return "noshow";
212      return "?";
213      }
214    public String toSystem(AppointmentStatus code) {
215      return code.getSystem();
216      }
217    }
218
219    public enum ParticipantRequired {
220        /**
221         * The participant is required to attend the appointment.
222         */
223        REQUIRED, 
224        /**
225         * The participant may optionally attend the appointment.
226         */
227        OPTIONAL, 
228        /**
229         * The participant is excluded from the appointment, and may 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).
230         */
231        INFORMATIONONLY, 
232        /**
233         * added to help the parsers
234         */
235        NULL;
236        public static ParticipantRequired fromCode(String codeString) throws FHIRException {
237            if (codeString == null || "".equals(codeString))
238                return null;
239        if ("required".equals(codeString))
240          return REQUIRED;
241        if ("optional".equals(codeString))
242          return OPTIONAL;
243        if ("information-only".equals(codeString))
244          return INFORMATIONONLY;
245        throw new FHIRException("Unknown ParticipantRequired code '"+codeString+"'");
246        }
247        public String toCode() {
248          switch (this) {
249            case REQUIRED: return "required";
250            case OPTIONAL: return "optional";
251            case INFORMATIONONLY: return "information-only";
252            default: return "?";
253          }
254        }
255        public String getSystem() {
256          switch (this) {
257            case REQUIRED: return "http://hl7.org/fhir/participantrequired";
258            case OPTIONAL: return "http://hl7.org/fhir/participantrequired";
259            case INFORMATIONONLY: return "http://hl7.org/fhir/participantrequired";
260            default: return "?";
261          }
262        }
263        public String getDefinition() {
264          switch (this) {
265            case REQUIRED: return "The participant is required to attend the appointment.";
266            case OPTIONAL: return "The participant may optionally attend the appointment.";
267            case INFORMATIONONLY: return "The participant is excluded from the appointment, and may 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).";
268            default: return "?";
269          }
270        }
271        public String getDisplay() {
272          switch (this) {
273            case REQUIRED: return "Required";
274            case OPTIONAL: return "Optional";
275            case INFORMATIONONLY: return "Information Only";
276            default: return "?";
277          }
278        }
279    }
280
281  public static class ParticipantRequiredEnumFactory implements EnumFactory<ParticipantRequired> {
282    public ParticipantRequired fromCode(String codeString) throws IllegalArgumentException {
283      if (codeString == null || "".equals(codeString))
284            if (codeString == null || "".equals(codeString))
285                return null;
286        if ("required".equals(codeString))
287          return ParticipantRequired.REQUIRED;
288        if ("optional".equals(codeString))
289          return ParticipantRequired.OPTIONAL;
290        if ("information-only".equals(codeString))
291          return ParticipantRequired.INFORMATIONONLY;
292        throw new IllegalArgumentException("Unknown ParticipantRequired code '"+codeString+"'");
293        }
294        public Enumeration<ParticipantRequired> fromType(Base code) throws FHIRException {
295          if (code == null || code.isEmpty())
296            return null;
297          String codeString = ((PrimitiveType) code).asStringValue();
298          if (codeString == null || "".equals(codeString))
299            return null;
300        if ("required".equals(codeString))
301          return new Enumeration<ParticipantRequired>(this, ParticipantRequired.REQUIRED);
302        if ("optional".equals(codeString))
303          return new Enumeration<ParticipantRequired>(this, ParticipantRequired.OPTIONAL);
304        if ("information-only".equals(codeString))
305          return new Enumeration<ParticipantRequired>(this, ParticipantRequired.INFORMATIONONLY);
306        throw new FHIRException("Unknown ParticipantRequired code '"+codeString+"'");
307        }
308    public String toCode(ParticipantRequired code) {
309      if (code == ParticipantRequired.REQUIRED)
310        return "required";
311      if (code == ParticipantRequired.OPTIONAL)
312        return "optional";
313      if (code == ParticipantRequired.INFORMATIONONLY)
314        return "information-only";
315      return "?";
316      }
317    public String toSystem(ParticipantRequired code) {
318      return code.getSystem();
319      }
320    }
321
322    public enum ParticipationStatus {
323        /**
324         * The participant has accepted the appointment.
325         */
326        ACCEPTED, 
327        /**
328         * The participant has declined the appointment and will not participate in the appointment.
329         */
330        DECLINED, 
331        /**
332         * 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.
333         */
334        TENTATIVE, 
335        /**
336         * The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.
337         */
338        NEEDSACTION, 
339        /**
340         * added to help the parsers
341         */
342        NULL;
343        public static ParticipationStatus fromCode(String codeString) throws FHIRException {
344            if (codeString == null || "".equals(codeString))
345                return null;
346        if ("accepted".equals(codeString))
347          return ACCEPTED;
348        if ("declined".equals(codeString))
349          return DECLINED;
350        if ("tentative".equals(codeString))
351          return TENTATIVE;
352        if ("needs-action".equals(codeString))
353          return NEEDSACTION;
354        throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'");
355        }
356        public String toCode() {
357          switch (this) {
358            case ACCEPTED: return "accepted";
359            case DECLINED: return "declined";
360            case TENTATIVE: return "tentative";
361            case NEEDSACTION: return "needs-action";
362            default: return "?";
363          }
364        }
365        public String getSystem() {
366          switch (this) {
367            case ACCEPTED: return "http://hl7.org/fhir/participationstatus";
368            case DECLINED: return "http://hl7.org/fhir/participationstatus";
369            case TENTATIVE: return "http://hl7.org/fhir/participationstatus";
370            case NEEDSACTION: return "http://hl7.org/fhir/participationstatus";
371            default: return "?";
372          }
373        }
374        public String getDefinition() {
375          switch (this) {
376            case ACCEPTED: return "The participant has accepted the appointment.";
377            case DECLINED: return "The participant has declined the appointment and will not participate in the appointment.";
378            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.";
379            case NEEDSACTION: return "The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.";
380            default: return "?";
381          }
382        }
383        public String getDisplay() {
384          switch (this) {
385            case ACCEPTED: return "Accepted";
386            case DECLINED: return "Declined";
387            case TENTATIVE: return "Tentative";
388            case NEEDSACTION: return "Needs Action";
389            default: return "?";
390          }
391        }
392    }
393
394  public static class ParticipationStatusEnumFactory implements EnumFactory<ParticipationStatus> {
395    public ParticipationStatus fromCode(String codeString) throws IllegalArgumentException {
396      if (codeString == null || "".equals(codeString))
397            if (codeString == null || "".equals(codeString))
398                return null;
399        if ("accepted".equals(codeString))
400          return ParticipationStatus.ACCEPTED;
401        if ("declined".equals(codeString))
402          return ParticipationStatus.DECLINED;
403        if ("tentative".equals(codeString))
404          return ParticipationStatus.TENTATIVE;
405        if ("needs-action".equals(codeString))
406          return ParticipationStatus.NEEDSACTION;
407        throw new IllegalArgumentException("Unknown ParticipationStatus code '"+codeString+"'");
408        }
409        public Enumeration<ParticipationStatus> fromType(Base code) throws FHIRException {
410          if (code == null || code.isEmpty())
411            return null;
412          String codeString = ((PrimitiveType) code).asStringValue();
413          if (codeString == null || "".equals(codeString))
414            return null;
415        if ("accepted".equals(codeString))
416          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.ACCEPTED);
417        if ("declined".equals(codeString))
418          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.DECLINED);
419        if ("tentative".equals(codeString))
420          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.TENTATIVE);
421        if ("needs-action".equals(codeString))
422          return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NEEDSACTION);
423        throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'");
424        }
425    public String toCode(ParticipationStatus code) {
426      if (code == ParticipationStatus.ACCEPTED)
427        return "accepted";
428      if (code == ParticipationStatus.DECLINED)
429        return "declined";
430      if (code == ParticipationStatus.TENTATIVE)
431        return "tentative";
432      if (code == ParticipationStatus.NEEDSACTION)
433        return "needs-action";
434      return "?";
435      }
436    public String toSystem(ParticipationStatus code) {
437      return code.getSystem();
438      }
439    }
440
441    @Block()
442    public static class AppointmentParticipantComponent extends BackboneElement implements IBaseBackboneElement {
443        /**
444         * Role of participant in the appointment.
445         */
446        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
447        @Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." )
448        protected List<CodeableConcept> type;
449
450        /**
451         * A Person, Location/HealthcareService or Device that is participating in the appointment.
452         */
453        @Child(name = "actor", type = {Patient.class, Practitioner.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=2, min=0, max=1, modifier=false, summary=true)
454        @Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." )
455        protected Reference actor;
456
457        /**
458         * The actual object that is the target of the reference (A Person, Location/HealthcareService or Device that is participating in the appointment.)
459         */
460        protected Resource actorTarget;
461
462        /**
463         * Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.
464         */
465        @Child(name = "required", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
466        @Description(shortDefinition="required | optional | information-only", formalDefinition="Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present." )
467        protected Enumeration<ParticipantRequired> required;
468
469        /**
470         * Participation status of the Patient.
471         */
472        @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=false)
473        @Description(shortDefinition="accepted | declined | tentative | needs-action", formalDefinition="Participation status of the Patient." )
474        protected Enumeration<ParticipationStatus> status;
475
476        private static final long serialVersionUID = -1620552507L;
477
478    /**
479     * Constructor
480     */
481      public AppointmentParticipantComponent() {
482        super();
483      }
484
485    /**
486     * Constructor
487     */
488      public AppointmentParticipantComponent(Enumeration<ParticipationStatus> status) {
489        super();
490        this.status = status;
491      }
492
493        /**
494         * @return {@link #type} (Role of participant in the appointment.)
495         */
496        public List<CodeableConcept> getType() { 
497          if (this.type == null)
498            this.type = new ArrayList<CodeableConcept>();
499          return this.type;
500        }
501
502        public boolean hasType() { 
503          if (this.type == null)
504            return false;
505          for (CodeableConcept item : this.type)
506            if (!item.isEmpty())
507              return true;
508          return false;
509        }
510
511        /**
512         * @return {@link #type} (Role of participant in the appointment.)
513         */
514    // syntactic sugar
515        public CodeableConcept addType() { //3
516          CodeableConcept t = new CodeableConcept();
517          if (this.type == null)
518            this.type = new ArrayList<CodeableConcept>();
519          this.type.add(t);
520          return t;
521        }
522
523    // syntactic sugar
524        public AppointmentParticipantComponent addType(CodeableConcept t) { //3
525          if (t == null)
526            return this;
527          if (this.type == null)
528            this.type = new ArrayList<CodeableConcept>();
529          this.type.add(t);
530          return this;
531        }
532
533        /**
534         * @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
535         */
536        public Reference getActor() { 
537          if (this.actor == null)
538            if (Configuration.errorOnAutoCreate())
539              throw new Error("Attempt to auto-create AppointmentParticipantComponent.actor");
540            else if (Configuration.doAutoCreate())
541              this.actor = new Reference(); // cc
542          return this.actor;
543        }
544
545        public boolean hasActor() { 
546          return this.actor != null && !this.actor.isEmpty();
547        }
548
549        /**
550         * @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
551         */
552        public AppointmentParticipantComponent setActor(Reference value) { 
553          this.actor = value;
554          return this;
555        }
556
557        /**
558         * @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.)
559         */
560        public Resource getActorTarget() { 
561          return this.actorTarget;
562        }
563
564        /**
565         * @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.)
566         */
567        public AppointmentParticipantComponent setActorTarget(Resource value) { 
568          this.actorTarget = value;
569          return this;
570        }
571
572        /**
573         * @return {@link #required} (Is this participant required to be present at the meeting. This covers a use-case where 2 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
574         */
575        public Enumeration<ParticipantRequired> getRequiredElement() { 
576          if (this.required == null)
577            if (Configuration.errorOnAutoCreate())
578              throw new Error("Attempt to auto-create AppointmentParticipantComponent.required");
579            else if (Configuration.doAutoCreate())
580              this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory()); // bb
581          return this.required;
582        }
583
584        public boolean hasRequiredElement() { 
585          return this.required != null && !this.required.isEmpty();
586        }
587
588        public boolean hasRequired() { 
589          return this.required != null && !this.required.isEmpty();
590        }
591
592        /**
593         * @param value {@link #required} (Is this participant required to be present at the meeting. This covers a use-case where 2 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
594         */
595        public AppointmentParticipantComponent setRequiredElement(Enumeration<ParticipantRequired> value) { 
596          this.required = value;
597          return this;
598        }
599
600        /**
601         * @return Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.
602         */
603        public ParticipantRequired getRequired() { 
604          return this.required == null ? null : this.required.getValue();
605        }
606
607        /**
608         * @param value Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.
609         */
610        public AppointmentParticipantComponent setRequired(ParticipantRequired value) { 
611          if (value == null)
612            this.required = null;
613          else {
614            if (this.required == null)
615              this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory());
616            this.required.setValue(value);
617          }
618          return this;
619        }
620
621        /**
622         * @return {@link #status} (Participation status of the Patient.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
623         */
624        public Enumeration<ParticipationStatus> getStatusElement() { 
625          if (this.status == null)
626            if (Configuration.errorOnAutoCreate())
627              throw new Error("Attempt to auto-create AppointmentParticipantComponent.status");
628            else if (Configuration.doAutoCreate())
629              this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory()); // bb
630          return this.status;
631        }
632
633        public boolean hasStatusElement() { 
634          return this.status != null && !this.status.isEmpty();
635        }
636
637        public boolean hasStatus() { 
638          return this.status != null && !this.status.isEmpty();
639        }
640
641        /**
642         * @param value {@link #status} (Participation status of the Patient.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
643         */
644        public AppointmentParticipantComponent setStatusElement(Enumeration<ParticipationStatus> value) { 
645          this.status = value;
646          return this;
647        }
648
649        /**
650         * @return Participation status of the Patient.
651         */
652        public ParticipationStatus getStatus() { 
653          return this.status == null ? null : this.status.getValue();
654        }
655
656        /**
657         * @param value Participation status of the Patient.
658         */
659        public AppointmentParticipantComponent setStatus(ParticipationStatus value) { 
660            if (this.status == null)
661              this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory());
662            this.status.setValue(value);
663          return this;
664        }
665
666        protected void listChildren(List<Property> childrenList) {
667          super.listChildren(childrenList);
668          childrenList.add(new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, type));
669          childrenList.add(new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, java.lang.Integer.MAX_VALUE, actor));
670          childrenList.add(new Property("required", "code", "Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.", 0, java.lang.Integer.MAX_VALUE, required));
671          childrenList.add(new Property("status", "code", "Participation status of the Patient.", 0, java.lang.Integer.MAX_VALUE, status));
672        }
673
674      @Override
675      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
676        switch (hash) {
677        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
678        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
679        case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // Enumeration<ParticipantRequired>
680        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ParticipationStatus>
681        default: return super.getProperty(hash, name, checkValid);
682        }
683
684      }
685
686      @Override
687      public void setProperty(int hash, String name, Base value) throws FHIRException {
688        switch (hash) {
689        case 3575610: // type
690          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
691          break;
692        case 92645877: // actor
693          this.actor = castToReference(value); // Reference
694          break;
695        case -393139297: // required
696          this.required = new ParticipantRequiredEnumFactory().fromType(value); // Enumeration<ParticipantRequired>
697          break;
698        case -892481550: // status
699          this.status = new ParticipationStatusEnumFactory().fromType(value); // Enumeration<ParticipationStatus>
700          break;
701        default: super.setProperty(hash, name, value);
702        }
703
704      }
705
706      @Override
707      public void setProperty(String name, Base value) throws FHIRException {
708        if (name.equals("type"))
709          this.getType().add(castToCodeableConcept(value));
710        else if (name.equals("actor"))
711          this.actor = castToReference(value); // Reference
712        else if (name.equals("required"))
713          this.required = new ParticipantRequiredEnumFactory().fromType(value); // Enumeration<ParticipantRequired>
714        else if (name.equals("status"))
715          this.status = new ParticipationStatusEnumFactory().fromType(value); // Enumeration<ParticipationStatus>
716        else
717          super.setProperty(name, value);
718      }
719
720      @Override
721      public Base makeProperty(int hash, String name) throws FHIRException {
722        switch (hash) {
723        case 3575610:  return addType(); // CodeableConcept
724        case 92645877:  return getActor(); // Reference
725        case -393139297: throw new FHIRException("Cannot make property required as it is not a complex type"); // Enumeration<ParticipantRequired>
726        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<ParticipationStatus>
727        default: return super.makeProperty(hash, name);
728        }
729
730      }
731
732      @Override
733      public Base addChild(String name) throws FHIRException {
734        if (name.equals("type")) {
735          return addType();
736        }
737        else if (name.equals("actor")) {
738          this.actor = new Reference();
739          return this.actor;
740        }
741        else if (name.equals("required")) {
742          throw new FHIRException("Cannot call addChild on a primitive type Appointment.required");
743        }
744        else if (name.equals("status")) {
745          throw new FHIRException("Cannot call addChild on a primitive type Appointment.status");
746        }
747        else
748          return super.addChild(name);
749      }
750
751      public AppointmentParticipantComponent copy() {
752        AppointmentParticipantComponent dst = new AppointmentParticipantComponent();
753        copyValues(dst);
754        if (type != null) {
755          dst.type = new ArrayList<CodeableConcept>();
756          for (CodeableConcept i : type)
757            dst.type.add(i.copy());
758        };
759        dst.actor = actor == null ? null : actor.copy();
760        dst.required = required == null ? null : required.copy();
761        dst.status = status == null ? null : status.copy();
762        return dst;
763      }
764
765      @Override
766      public boolean equalsDeep(Base other) {
767        if (!super.equalsDeep(other))
768          return false;
769        if (!(other instanceof AppointmentParticipantComponent))
770          return false;
771        AppointmentParticipantComponent o = (AppointmentParticipantComponent) other;
772        return compareDeep(type, o.type, true) && compareDeep(actor, o.actor, true) && compareDeep(required, o.required, true)
773           && compareDeep(status, o.status, true);
774      }
775
776      @Override
777      public boolean equalsShallow(Base other) {
778        if (!super.equalsShallow(other))
779          return false;
780        if (!(other instanceof AppointmentParticipantComponent))
781          return false;
782        AppointmentParticipantComponent o = (AppointmentParticipantComponent) other;
783        return compareValues(required, o.required, true) && compareValues(status, o.status, true);
784      }
785
786      public boolean isEmpty() {
787        return super.isEmpty() && (type == null || type.isEmpty()) && (actor == null || actor.isEmpty())
788           && (required == null || required.isEmpty()) && (status == null || status.isEmpty());
789      }
790
791  public String fhirType() {
792    return "Appointment.participant";
793
794  }
795
796  }
797
798    /**
799     * 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).
800     */
801    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
802    @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)." )
803    protected List<Identifier> identifier;
804
805    /**
806     * 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.
807     */
808    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
809    @Description(shortDefinition="proposed | pending | booked | arrived | fulfilled | cancelled | noshow", 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." )
810    protected Enumeration<AppointmentStatus> status;
811
812    /**
813     * A broad categorisation of the service that is to be performed during this appointment.
814     */
815    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
816    @Description(shortDefinition="A broad categorisation of the service that is to be performed during this appointment", formalDefinition="A broad categorisation of the service that is to be performed during this appointment." )
817    protected CodeableConcept serviceCategory;
818
819    /**
820     * The specific service that is to be performed during this appointment.
821     */
822    @Child(name = "serviceType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
823    @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." )
824    protected List<CodeableConcept> serviceType;
825
826    /**
827     * The specialty of a practitioner that would be required to perform the service requested in this appointment.
828     */
829    @Child(name = "specialty", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
830    @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." )
831    protected List<CodeableConcept> specialty;
832
833    /**
834     * The style of appointment or patient that has been booked in the slot (not service type).
835     */
836    @Child(name = "appointmentType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
837    @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)." )
838    protected CodeableConcept appointmentType;
839
840    /**
841     * The reason that this appointment is being scheduled. This is more clinical than administrative.
842     */
843    @Child(name = "reason", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
844    @Description(shortDefinition="Reason this appointment is scheduled", formalDefinition="The reason that this appointment is being scheduled. This is more clinical than administrative." )
845    protected CodeableConcept reason;
846
847    /**
848     * 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).
849     */
850    @Child(name = "priority", type = {UnsignedIntType.class}, order=7, min=0, max=1, modifier=false, summary=false)
851    @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)." )
852    protected UnsignedIntType priority;
853
854    /**
855     * 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.
856     */
857    @Child(name = "description", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
858    @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." )
859    protected StringType description;
860
861    /**
862     * Date/Time that the appointment is to take place.
863     */
864    @Child(name = "start", type = {InstantType.class}, order=9, min=0, max=1, modifier=false, summary=true)
865    @Description(shortDefinition="When appointment is to take place", formalDefinition="Date/Time that the appointment is to take place." )
866    protected InstantType start;
867
868    /**
869     * Date/Time that the appointment is to conclude.
870     */
871    @Child(name = "end", type = {InstantType.class}, order=10, min=0, max=1, modifier=false, summary=true)
872    @Description(shortDefinition="When appointment is to conclude", formalDefinition="Date/Time that the appointment is to conclude." )
873    protected InstantType end;
874
875    /**
876     * Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).
877     */
878    @Child(name = "minutesDuration", type = {PositiveIntType.class}, order=11, min=0, max=1, modifier=false, summary=false)
879    @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 (where actual time of appointment is only an estimate or is a planned appointment request)." )
880    protected PositiveIntType minutesDuration;
881
882    /**
883     * The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.
884     */
885    @Child(name = "slot", type = {Slot.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
886    @Description(shortDefinition="If provided, then no schedule and start/end values MUST match slot", formalDefinition="The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot." )
887    protected List<Reference> slot;
888    /**
889     * The actual objects that are the target of the reference (The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.)
890     */
891    protected List<Slot> slotTarget;
892
893
894    /**
895     * 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.
896     */
897    @Child(name = "created", type = {DateTimeType.class}, order=13, min=0, max=1, modifier=false, summary=false)
898    @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." )
899    protected DateTimeType created;
900
901    /**
902     * Additional comments about the appointment.
903     */
904    @Child(name = "comment", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
905    @Description(shortDefinition="Additional comments", formalDefinition="Additional comments about the appointment." )
906    protected StringType comment;
907
908    /**
909     * List of participants involved in the appointment.
910     */
911    @Child(name = "participant", type = {}, order=15, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
912    @Description(shortDefinition="Participants involved in appointment", formalDefinition="List of participants involved in the appointment." )
913    protected List<AppointmentParticipantComponent> participant;
914
915    private static final long serialVersionUID = 552749730L;
916
917  /**
918   * Constructor
919   */
920    public Appointment() {
921      super();
922    }
923
924  /**
925   * Constructor
926   */
927    public Appointment(Enumeration<AppointmentStatus> status) {
928      super();
929      this.status = status;
930    }
931
932    /**
933     * @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).)
934     */
935    public List<Identifier> getIdentifier() { 
936      if (this.identifier == null)
937        this.identifier = new ArrayList<Identifier>();
938      return this.identifier;
939    }
940
941    public boolean hasIdentifier() { 
942      if (this.identifier == null)
943        return false;
944      for (Identifier item : this.identifier)
945        if (!item.isEmpty())
946          return true;
947      return false;
948    }
949
950    /**
951     * @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).)
952     */
953    // syntactic sugar
954    public Identifier addIdentifier() { //3
955      Identifier t = new Identifier();
956      if (this.identifier == null)
957        this.identifier = new ArrayList<Identifier>();
958      this.identifier.add(t);
959      return t;
960    }
961
962    // syntactic sugar
963    public Appointment addIdentifier(Identifier t) { //3
964      if (t == null)
965        return this;
966      if (this.identifier == null)
967        this.identifier = new ArrayList<Identifier>();
968      this.identifier.add(t);
969      return this;
970    }
971
972    /**
973     * @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
974     */
975    public Enumeration<AppointmentStatus> getStatusElement() { 
976      if (this.status == null)
977        if (Configuration.errorOnAutoCreate())
978          throw new Error("Attempt to auto-create Appointment.status");
979        else if (Configuration.doAutoCreate())
980          this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory()); // bb
981      return this.status;
982    }
983
984    public boolean hasStatusElement() { 
985      return this.status != null && !this.status.isEmpty();
986    }
987
988    public boolean hasStatus() { 
989      return this.status != null && !this.status.isEmpty();
990    }
991
992    /**
993     * @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
994     */
995    public Appointment setStatusElement(Enumeration<AppointmentStatus> value) { 
996      this.status = value;
997      return this;
998    }
999
1000    /**
1001     * @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.
1002     */
1003    public AppointmentStatus getStatus() { 
1004      return this.status == null ? null : this.status.getValue();
1005    }
1006
1007    /**
1008     * @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.
1009     */
1010    public Appointment setStatus(AppointmentStatus value) { 
1011        if (this.status == null)
1012          this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory());
1013        this.status.setValue(value);
1014      return this;
1015    }
1016
1017    /**
1018     * @return {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
1019     */
1020    public CodeableConcept getServiceCategory() { 
1021      if (this.serviceCategory == null)
1022        if (Configuration.errorOnAutoCreate())
1023          throw new Error("Attempt to auto-create Appointment.serviceCategory");
1024        else if (Configuration.doAutoCreate())
1025          this.serviceCategory = new CodeableConcept(); // cc
1026      return this.serviceCategory;
1027    }
1028
1029    public boolean hasServiceCategory() { 
1030      return this.serviceCategory != null && !this.serviceCategory.isEmpty();
1031    }
1032
1033    /**
1034     * @param value {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
1035     */
1036    public Appointment setServiceCategory(CodeableConcept value) { 
1037      this.serviceCategory = value;
1038      return this;
1039    }
1040
1041    /**
1042     * @return {@link #serviceType} (The specific service that is to be performed during this appointment.)
1043     */
1044    public List<CodeableConcept> getServiceType() { 
1045      if (this.serviceType == null)
1046        this.serviceType = new ArrayList<CodeableConcept>();
1047      return this.serviceType;
1048    }
1049
1050    public boolean hasServiceType() { 
1051      if (this.serviceType == null)
1052        return false;
1053      for (CodeableConcept item : this.serviceType)
1054        if (!item.isEmpty())
1055          return true;
1056      return false;
1057    }
1058
1059    /**
1060     * @return {@link #serviceType} (The specific service that is to be performed during this appointment.)
1061     */
1062    // syntactic sugar
1063    public CodeableConcept addServiceType() { //3
1064      CodeableConcept t = new CodeableConcept();
1065      if (this.serviceType == null)
1066        this.serviceType = new ArrayList<CodeableConcept>();
1067      this.serviceType.add(t);
1068      return t;
1069    }
1070
1071    // syntactic sugar
1072    public Appointment addServiceType(CodeableConcept t) { //3
1073      if (t == null)
1074        return this;
1075      if (this.serviceType == null)
1076        this.serviceType = new ArrayList<CodeableConcept>();
1077      this.serviceType.add(t);
1078      return this;
1079    }
1080
1081    /**
1082     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
1083     */
1084    public List<CodeableConcept> getSpecialty() { 
1085      if (this.specialty == null)
1086        this.specialty = new ArrayList<CodeableConcept>();
1087      return this.specialty;
1088    }
1089
1090    public boolean hasSpecialty() { 
1091      if (this.specialty == null)
1092        return false;
1093      for (CodeableConcept item : this.specialty)
1094        if (!item.isEmpty())
1095          return true;
1096      return false;
1097    }
1098
1099    /**
1100     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
1101     */
1102    // syntactic sugar
1103    public CodeableConcept addSpecialty() { //3
1104      CodeableConcept t = new CodeableConcept();
1105      if (this.specialty == null)
1106        this.specialty = new ArrayList<CodeableConcept>();
1107      this.specialty.add(t);
1108      return t;
1109    }
1110
1111    // syntactic sugar
1112    public Appointment addSpecialty(CodeableConcept t) { //3
1113      if (t == null)
1114        return this;
1115      if (this.specialty == null)
1116        this.specialty = new ArrayList<CodeableConcept>();
1117      this.specialty.add(t);
1118      return this;
1119    }
1120
1121    /**
1122     * @return {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
1123     */
1124    public CodeableConcept getAppointmentType() { 
1125      if (this.appointmentType == null)
1126        if (Configuration.errorOnAutoCreate())
1127          throw new Error("Attempt to auto-create Appointment.appointmentType");
1128        else if (Configuration.doAutoCreate())
1129          this.appointmentType = new CodeableConcept(); // cc
1130      return this.appointmentType;
1131    }
1132
1133    public boolean hasAppointmentType() { 
1134      return this.appointmentType != null && !this.appointmentType.isEmpty();
1135    }
1136
1137    /**
1138     * @param value {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
1139     */
1140    public Appointment setAppointmentType(CodeableConcept value) { 
1141      this.appointmentType = value;
1142      return this;
1143    }
1144
1145    /**
1146     * @return {@link #reason} (The reason that this appointment is being scheduled. This is more clinical than administrative.)
1147     */
1148    public CodeableConcept getReason() { 
1149      if (this.reason == null)
1150        if (Configuration.errorOnAutoCreate())
1151          throw new Error("Attempt to auto-create Appointment.reason");
1152        else if (Configuration.doAutoCreate())
1153          this.reason = new CodeableConcept(); // cc
1154      return this.reason;
1155    }
1156
1157    public boolean hasReason() { 
1158      return this.reason != null && !this.reason.isEmpty();
1159    }
1160
1161    /**
1162     * @param value {@link #reason} (The reason that this appointment is being scheduled. This is more clinical than administrative.)
1163     */
1164    public Appointment setReason(CodeableConcept value) { 
1165      this.reason = value;
1166      return this;
1167    }
1168
1169    /**
1170     * @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
1171     */
1172    public UnsignedIntType getPriorityElement() { 
1173      if (this.priority == null)
1174        if (Configuration.errorOnAutoCreate())
1175          throw new Error("Attempt to auto-create Appointment.priority");
1176        else if (Configuration.doAutoCreate())
1177          this.priority = new UnsignedIntType(); // bb
1178      return this.priority;
1179    }
1180
1181    public boolean hasPriorityElement() { 
1182      return this.priority != null && !this.priority.isEmpty();
1183    }
1184
1185    public boolean hasPriority() { 
1186      return this.priority != null && !this.priority.isEmpty();
1187    }
1188
1189    /**
1190     * @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
1191     */
1192    public Appointment setPriorityElement(UnsignedIntType value) { 
1193      this.priority = value;
1194      return this;
1195    }
1196
1197    /**
1198     * @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).
1199     */
1200    public int getPriority() { 
1201      return this.priority == null || this.priority.isEmpty() ? 0 : this.priority.getValue();
1202    }
1203
1204    /**
1205     * @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).
1206     */
1207    public Appointment setPriority(int value) { 
1208        if (this.priority == null)
1209          this.priority = new UnsignedIntType();
1210        this.priority.setValue(value);
1211      return this;
1212    }
1213
1214    /**
1215     * @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
1216     */
1217    public StringType getDescriptionElement() { 
1218      if (this.description == null)
1219        if (Configuration.errorOnAutoCreate())
1220          throw new Error("Attempt to auto-create Appointment.description");
1221        else if (Configuration.doAutoCreate())
1222          this.description = new StringType(); // bb
1223      return this.description;
1224    }
1225
1226    public boolean hasDescriptionElement() { 
1227      return this.description != null && !this.description.isEmpty();
1228    }
1229
1230    public boolean hasDescription() { 
1231      return this.description != null && !this.description.isEmpty();
1232    }
1233
1234    /**
1235     * @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
1236     */
1237    public Appointment setDescriptionElement(StringType value) { 
1238      this.description = value;
1239      return this;
1240    }
1241
1242    /**
1243     * @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.
1244     */
1245    public String getDescription() { 
1246      return this.description == null ? null : this.description.getValue();
1247    }
1248
1249    /**
1250     * @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.
1251     */
1252    public Appointment setDescription(String value) { 
1253      if (Utilities.noString(value))
1254        this.description = null;
1255      else {
1256        if (this.description == null)
1257          this.description = new StringType();
1258        this.description.setValue(value);
1259      }
1260      return this;
1261    }
1262
1263    /**
1264     * @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
1265     */
1266    public InstantType getStartElement() { 
1267      if (this.start == null)
1268        if (Configuration.errorOnAutoCreate())
1269          throw new Error("Attempt to auto-create Appointment.start");
1270        else if (Configuration.doAutoCreate())
1271          this.start = new InstantType(); // bb
1272      return this.start;
1273    }
1274
1275    public boolean hasStartElement() { 
1276      return this.start != null && !this.start.isEmpty();
1277    }
1278
1279    public boolean hasStart() { 
1280      return this.start != null && !this.start.isEmpty();
1281    }
1282
1283    /**
1284     * @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
1285     */
1286    public Appointment setStartElement(InstantType value) { 
1287      this.start = value;
1288      return this;
1289    }
1290
1291    /**
1292     * @return Date/Time that the appointment is to take place.
1293     */
1294    public Date getStart() { 
1295      return this.start == null ? null : this.start.getValue();
1296    }
1297
1298    /**
1299     * @param value Date/Time that the appointment is to take place.
1300     */
1301    public Appointment setStart(Date value) { 
1302      if (value == null)
1303        this.start = null;
1304      else {
1305        if (this.start == null)
1306          this.start = new InstantType();
1307        this.start.setValue(value);
1308      }
1309      return this;
1310    }
1311
1312    /**
1313     * @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
1314     */
1315    public InstantType getEndElement() { 
1316      if (this.end == null)
1317        if (Configuration.errorOnAutoCreate())
1318          throw new Error("Attempt to auto-create Appointment.end");
1319        else if (Configuration.doAutoCreate())
1320          this.end = new InstantType(); // bb
1321      return this.end;
1322    }
1323
1324    public boolean hasEndElement() { 
1325      return this.end != null && !this.end.isEmpty();
1326    }
1327
1328    public boolean hasEnd() { 
1329      return this.end != null && !this.end.isEmpty();
1330    }
1331
1332    /**
1333     * @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
1334     */
1335    public Appointment setEndElement(InstantType value) { 
1336      this.end = value;
1337      return this;
1338    }
1339
1340    /**
1341     * @return Date/Time that the appointment is to conclude.
1342     */
1343    public Date getEnd() { 
1344      return this.end == null ? null : this.end.getValue();
1345    }
1346
1347    /**
1348     * @param value Date/Time that the appointment is to conclude.
1349     */
1350    public Appointment setEnd(Date value) { 
1351      if (value == null)
1352        this.end = null;
1353      else {
1354        if (this.end == null)
1355          this.end = new InstantType();
1356        this.end.setValue(value);
1357      }
1358      return this;
1359    }
1360
1361    /**
1362     * @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 (where actual time of appointment is only an estimate or is a planned appointment request).). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
1363     */
1364    public PositiveIntType getMinutesDurationElement() { 
1365      if (this.minutesDuration == null)
1366        if (Configuration.errorOnAutoCreate())
1367          throw new Error("Attempt to auto-create Appointment.minutesDuration");
1368        else if (Configuration.doAutoCreate())
1369          this.minutesDuration = new PositiveIntType(); // bb
1370      return this.minutesDuration;
1371    }
1372
1373    public boolean hasMinutesDurationElement() { 
1374      return this.minutesDuration != null && !this.minutesDuration.isEmpty();
1375    }
1376
1377    public boolean hasMinutesDuration() { 
1378      return this.minutesDuration != null && !this.minutesDuration.isEmpty();
1379    }
1380
1381    /**
1382     * @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 (where actual time of appointment is only an estimate or is a planned appointment request).). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
1383     */
1384    public Appointment setMinutesDurationElement(PositiveIntType value) { 
1385      this.minutesDuration = value;
1386      return this;
1387    }
1388
1389    /**
1390     * @return Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).
1391     */
1392    public int getMinutesDuration() { 
1393      return this.minutesDuration == null || this.minutesDuration.isEmpty() ? 0 : this.minutesDuration.getValue();
1394    }
1395
1396    /**
1397     * @param value Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).
1398     */
1399    public Appointment setMinutesDuration(int value) { 
1400        if (this.minutesDuration == null)
1401          this.minutesDuration = new PositiveIntType();
1402        this.minutesDuration.setValue(value);
1403      return this;
1404    }
1405
1406    /**
1407     * @return {@link #slot} (The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.)
1408     */
1409    public List<Reference> getSlot() { 
1410      if (this.slot == null)
1411        this.slot = new ArrayList<Reference>();
1412      return this.slot;
1413    }
1414
1415    public boolean hasSlot() { 
1416      if (this.slot == null)
1417        return false;
1418      for (Reference item : this.slot)
1419        if (!item.isEmpty())
1420          return true;
1421      return false;
1422    }
1423
1424    /**
1425     * @return {@link #slot} (The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.)
1426     */
1427    // syntactic sugar
1428    public Reference addSlot() { //3
1429      Reference t = new Reference();
1430      if (this.slot == null)
1431        this.slot = new ArrayList<Reference>();
1432      this.slot.add(t);
1433      return t;
1434    }
1435
1436    // syntactic sugar
1437    public Appointment addSlot(Reference t) { //3
1438      if (t == null)
1439        return this;
1440      if (this.slot == null)
1441        this.slot = new ArrayList<Reference>();
1442      this.slot.add(t);
1443      return this;
1444    }
1445
1446    /**
1447     * @return {@link #slot} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.)
1448     */
1449    public List<Slot> getSlotTarget() { 
1450      if (this.slotTarget == null)
1451        this.slotTarget = new ArrayList<Slot>();
1452      return this.slotTarget;
1453    }
1454
1455    // syntactic sugar
1456    /**
1457     * @return {@link #slot} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.)
1458     */
1459    public Slot addSlotTarget() { 
1460      Slot r = new Slot();
1461      if (this.slotTarget == null)
1462        this.slotTarget = new ArrayList<Slot>();
1463      this.slotTarget.add(r);
1464      return r;
1465    }
1466
1467    /**
1468     * @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
1469     */
1470    public DateTimeType getCreatedElement() { 
1471      if (this.created == null)
1472        if (Configuration.errorOnAutoCreate())
1473          throw new Error("Attempt to auto-create Appointment.created");
1474        else if (Configuration.doAutoCreate())
1475          this.created = new DateTimeType(); // bb
1476      return this.created;
1477    }
1478
1479    public boolean hasCreatedElement() { 
1480      return this.created != null && !this.created.isEmpty();
1481    }
1482
1483    public boolean hasCreated() { 
1484      return this.created != null && !this.created.isEmpty();
1485    }
1486
1487    /**
1488     * @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
1489     */
1490    public Appointment setCreatedElement(DateTimeType value) { 
1491      this.created = value;
1492      return this;
1493    }
1494
1495    /**
1496     * @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.
1497     */
1498    public Date getCreated() { 
1499      return this.created == null ? null : this.created.getValue();
1500    }
1501
1502    /**
1503     * @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.
1504     */
1505    public Appointment setCreated(Date value) { 
1506      if (value == null)
1507        this.created = null;
1508      else {
1509        if (this.created == null)
1510          this.created = new DateTimeType();
1511        this.created.setValue(value);
1512      }
1513      return this;
1514    }
1515
1516    /**
1517     * @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
1518     */
1519    public StringType getCommentElement() { 
1520      if (this.comment == null)
1521        if (Configuration.errorOnAutoCreate())
1522          throw new Error("Attempt to auto-create Appointment.comment");
1523        else if (Configuration.doAutoCreate())
1524          this.comment = new StringType(); // bb
1525      return this.comment;
1526    }
1527
1528    public boolean hasCommentElement() { 
1529      return this.comment != null && !this.comment.isEmpty();
1530    }
1531
1532    public boolean hasComment() { 
1533      return this.comment != null && !this.comment.isEmpty();
1534    }
1535
1536    /**
1537     * @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
1538     */
1539    public Appointment setCommentElement(StringType value) { 
1540      this.comment = value;
1541      return this;
1542    }
1543
1544    /**
1545     * @return Additional comments about the appointment.
1546     */
1547    public String getComment() { 
1548      return this.comment == null ? null : this.comment.getValue();
1549    }
1550
1551    /**
1552     * @param value Additional comments about the appointment.
1553     */
1554    public Appointment setComment(String value) { 
1555      if (Utilities.noString(value))
1556        this.comment = null;
1557      else {
1558        if (this.comment == null)
1559          this.comment = new StringType();
1560        this.comment.setValue(value);
1561      }
1562      return this;
1563    }
1564
1565    /**
1566     * @return {@link #participant} (List of participants involved in the appointment.)
1567     */
1568    public List<AppointmentParticipantComponent> getParticipant() { 
1569      if (this.participant == null)
1570        this.participant = new ArrayList<AppointmentParticipantComponent>();
1571      return this.participant;
1572    }
1573
1574    public boolean hasParticipant() { 
1575      if (this.participant == null)
1576        return false;
1577      for (AppointmentParticipantComponent item : this.participant)
1578        if (!item.isEmpty())
1579          return true;
1580      return false;
1581    }
1582
1583    /**
1584     * @return {@link #participant} (List of participants involved in the appointment.)
1585     */
1586    // syntactic sugar
1587    public AppointmentParticipantComponent addParticipant() { //3
1588      AppointmentParticipantComponent t = new AppointmentParticipantComponent();
1589      if (this.participant == null)
1590        this.participant = new ArrayList<AppointmentParticipantComponent>();
1591      this.participant.add(t);
1592      return t;
1593    }
1594
1595    // syntactic sugar
1596    public Appointment addParticipant(AppointmentParticipantComponent t) { //3
1597      if (t == null)
1598        return this;
1599      if (this.participant == null)
1600        this.participant = new ArrayList<AppointmentParticipantComponent>();
1601      this.participant.add(t);
1602      return this;
1603    }
1604
1605      protected void listChildren(List<Property> childrenList) {
1606        super.listChildren(childrenList);
1607        childrenList.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));
1608        childrenList.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, java.lang.Integer.MAX_VALUE, status));
1609        childrenList.add(new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceCategory));
1610        childrenList.add(new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType));
1611        childrenList.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));
1612        childrenList.add(new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, java.lang.Integer.MAX_VALUE, appointmentType));
1613        childrenList.add(new Property("reason", "CodeableConcept", "The reason that this appointment is being scheduled. This is more clinical than administrative.", 0, java.lang.Integer.MAX_VALUE, reason));
1614        childrenList.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, java.lang.Integer.MAX_VALUE, priority));
1615        childrenList.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, java.lang.Integer.MAX_VALUE, description));
1616        childrenList.add(new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, java.lang.Integer.MAX_VALUE, start));
1617        childrenList.add(new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, java.lang.Integer.MAX_VALUE, end));
1618        childrenList.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 (where actual time of appointment is only an estimate or is a planned appointment request).", 0, java.lang.Integer.MAX_VALUE, minutesDuration));
1619        childrenList.add(new Property("slot", "Reference(Slot)", "The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.", 0, java.lang.Integer.MAX_VALUE, slot));
1620        childrenList.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, java.lang.Integer.MAX_VALUE, created));
1621        childrenList.add(new Property("comment", "string", "Additional comments about the appointment.", 0, java.lang.Integer.MAX_VALUE, comment));
1622        childrenList.add(new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant));
1623      }
1624
1625      @Override
1626      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1627        switch (hash) {
1628        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1629        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AppointmentStatus>
1630        case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : new Base[] {this.serviceCategory}; // CodeableConcept
1631        case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
1632        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
1633        case -1596426375: /*appointmentType*/ return this.appointmentType == null ? new Base[0] : new Base[] {this.appointmentType}; // CodeableConcept
1634        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
1635        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // UnsignedIntType
1636        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1637        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // InstantType
1638        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
1639        case -413630573: /*minutesDuration*/ return this.minutesDuration == null ? new Base[0] : new Base[] {this.minutesDuration}; // PositiveIntType
1640        case 3533310: /*slot*/ return this.slot == null ? new Base[0] : this.slot.toArray(new Base[this.slot.size()]); // Reference
1641        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
1642        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
1643        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // AppointmentParticipantComponent
1644        default: return super.getProperty(hash, name, checkValid);
1645        }
1646
1647      }
1648
1649      @Override
1650      public void setProperty(int hash, String name, Base value) throws FHIRException {
1651        switch (hash) {
1652        case -1618432855: // identifier
1653          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1654          break;
1655        case -892481550: // status
1656          this.status = new AppointmentStatusEnumFactory().fromType(value); // Enumeration<AppointmentStatus>
1657          break;
1658        case 1281188563: // serviceCategory
1659          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
1660          break;
1661        case -1928370289: // serviceType
1662          this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
1663          break;
1664        case -1694759682: // specialty
1665          this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
1666          break;
1667        case -1596426375: // appointmentType
1668          this.appointmentType = castToCodeableConcept(value); // CodeableConcept
1669          break;
1670        case -934964668: // reason
1671          this.reason = castToCodeableConcept(value); // CodeableConcept
1672          break;
1673        case -1165461084: // priority
1674          this.priority = castToUnsignedInt(value); // UnsignedIntType
1675          break;
1676        case -1724546052: // description
1677          this.description = castToString(value); // StringType
1678          break;
1679        case 109757538: // start
1680          this.start = castToInstant(value); // InstantType
1681          break;
1682        case 100571: // end
1683          this.end = castToInstant(value); // InstantType
1684          break;
1685        case -413630573: // minutesDuration
1686          this.minutesDuration = castToPositiveInt(value); // PositiveIntType
1687          break;
1688        case 3533310: // slot
1689          this.getSlot().add(castToReference(value)); // Reference
1690          break;
1691        case 1028554472: // created
1692          this.created = castToDateTime(value); // DateTimeType
1693          break;
1694        case 950398559: // comment
1695          this.comment = castToString(value); // StringType
1696          break;
1697        case 767422259: // participant
1698          this.getParticipant().add((AppointmentParticipantComponent) value); // AppointmentParticipantComponent
1699          break;
1700        default: super.setProperty(hash, name, value);
1701        }
1702
1703      }
1704
1705      @Override
1706      public void setProperty(String name, Base value) throws FHIRException {
1707        if (name.equals("identifier"))
1708          this.getIdentifier().add(castToIdentifier(value));
1709        else if (name.equals("status"))
1710          this.status = new AppointmentStatusEnumFactory().fromType(value); // Enumeration<AppointmentStatus>
1711        else if (name.equals("serviceCategory"))
1712          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
1713        else if (name.equals("serviceType"))
1714          this.getServiceType().add(castToCodeableConcept(value));
1715        else if (name.equals("specialty"))
1716          this.getSpecialty().add(castToCodeableConcept(value));
1717        else if (name.equals("appointmentType"))
1718          this.appointmentType = castToCodeableConcept(value); // CodeableConcept
1719        else if (name.equals("reason"))
1720          this.reason = castToCodeableConcept(value); // CodeableConcept
1721        else if (name.equals("priority"))
1722          this.priority = castToUnsignedInt(value); // UnsignedIntType
1723        else if (name.equals("description"))
1724          this.description = castToString(value); // StringType
1725        else if (name.equals("start"))
1726          this.start = castToInstant(value); // InstantType
1727        else if (name.equals("end"))
1728          this.end = castToInstant(value); // InstantType
1729        else if (name.equals("minutesDuration"))
1730          this.minutesDuration = castToPositiveInt(value); // PositiveIntType
1731        else if (name.equals("slot"))
1732          this.getSlot().add(castToReference(value));
1733        else if (name.equals("created"))
1734          this.created = castToDateTime(value); // DateTimeType
1735        else if (name.equals("comment"))
1736          this.comment = castToString(value); // StringType
1737        else if (name.equals("participant"))
1738          this.getParticipant().add((AppointmentParticipantComponent) value);
1739        else
1740          super.setProperty(name, value);
1741      }
1742
1743      @Override
1744      public Base makeProperty(int hash, String name) throws FHIRException {
1745        switch (hash) {
1746        case -1618432855:  return addIdentifier(); // Identifier
1747        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<AppointmentStatus>
1748        case 1281188563:  return getServiceCategory(); // CodeableConcept
1749        case -1928370289:  return addServiceType(); // CodeableConcept
1750        case -1694759682:  return addSpecialty(); // CodeableConcept
1751        case -1596426375:  return getAppointmentType(); // CodeableConcept
1752        case -934964668:  return getReason(); // CodeableConcept
1753        case -1165461084: throw new FHIRException("Cannot make property priority as it is not a complex type"); // UnsignedIntType
1754        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
1755        case 109757538: throw new FHIRException("Cannot make property start as it is not a complex type"); // InstantType
1756        case 100571: throw new FHIRException("Cannot make property end as it is not a complex type"); // InstantType
1757        case -413630573: throw new FHIRException("Cannot make property minutesDuration as it is not a complex type"); // PositiveIntType
1758        case 3533310:  return addSlot(); // Reference
1759        case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateTimeType
1760        case 950398559: throw new FHIRException("Cannot make property comment as it is not a complex type"); // StringType
1761        case 767422259:  return addParticipant(); // AppointmentParticipantComponent
1762        default: return super.makeProperty(hash, name);
1763        }
1764
1765      }
1766
1767      @Override
1768      public Base addChild(String name) throws FHIRException {
1769        if (name.equals("identifier")) {
1770          return addIdentifier();
1771        }
1772        else if (name.equals("status")) {
1773          throw new FHIRException("Cannot call addChild on a primitive type Appointment.status");
1774        }
1775        else if (name.equals("serviceCategory")) {
1776          this.serviceCategory = new CodeableConcept();
1777          return this.serviceCategory;
1778        }
1779        else if (name.equals("serviceType")) {
1780          return addServiceType();
1781        }
1782        else if (name.equals("specialty")) {
1783          return addSpecialty();
1784        }
1785        else if (name.equals("appointmentType")) {
1786          this.appointmentType = new CodeableConcept();
1787          return this.appointmentType;
1788        }
1789        else if (name.equals("reason")) {
1790          this.reason = new CodeableConcept();
1791          return this.reason;
1792        }
1793        else if (name.equals("priority")) {
1794          throw new FHIRException("Cannot call addChild on a primitive type Appointment.priority");
1795        }
1796        else if (name.equals("description")) {
1797          throw new FHIRException("Cannot call addChild on a primitive type Appointment.description");
1798        }
1799        else if (name.equals("start")) {
1800          throw new FHIRException("Cannot call addChild on a primitive type Appointment.start");
1801        }
1802        else if (name.equals("end")) {
1803          throw new FHIRException("Cannot call addChild on a primitive type Appointment.end");
1804        }
1805        else if (name.equals("minutesDuration")) {
1806          throw new FHIRException("Cannot call addChild on a primitive type Appointment.minutesDuration");
1807        }
1808        else if (name.equals("slot")) {
1809          return addSlot();
1810        }
1811        else if (name.equals("created")) {
1812          throw new FHIRException("Cannot call addChild on a primitive type Appointment.created");
1813        }
1814        else if (name.equals("comment")) {
1815          throw new FHIRException("Cannot call addChild on a primitive type Appointment.comment");
1816        }
1817        else if (name.equals("participant")) {
1818          return addParticipant();
1819        }
1820        else
1821          return super.addChild(name);
1822      }
1823
1824  public String fhirType() {
1825    return "Appointment";
1826
1827  }
1828
1829      public Appointment copy() {
1830        Appointment dst = new Appointment();
1831        copyValues(dst);
1832        if (identifier != null) {
1833          dst.identifier = new ArrayList<Identifier>();
1834          for (Identifier i : identifier)
1835            dst.identifier.add(i.copy());
1836        };
1837        dst.status = status == null ? null : status.copy();
1838        dst.serviceCategory = serviceCategory == null ? null : serviceCategory.copy();
1839        if (serviceType != null) {
1840          dst.serviceType = new ArrayList<CodeableConcept>();
1841          for (CodeableConcept i : serviceType)
1842            dst.serviceType.add(i.copy());
1843        };
1844        if (specialty != null) {
1845          dst.specialty = new ArrayList<CodeableConcept>();
1846          for (CodeableConcept i : specialty)
1847            dst.specialty.add(i.copy());
1848        };
1849        dst.appointmentType = appointmentType == null ? null : appointmentType.copy();
1850        dst.reason = reason == null ? null : reason.copy();
1851        dst.priority = priority == null ? null : priority.copy();
1852        dst.description = description == null ? null : description.copy();
1853        dst.start = start == null ? null : start.copy();
1854        dst.end = end == null ? null : end.copy();
1855        dst.minutesDuration = minutesDuration == null ? null : minutesDuration.copy();
1856        if (slot != null) {
1857          dst.slot = new ArrayList<Reference>();
1858          for (Reference i : slot)
1859            dst.slot.add(i.copy());
1860        };
1861        dst.created = created == null ? null : created.copy();
1862        dst.comment = comment == null ? null : comment.copy();
1863        if (participant != null) {
1864          dst.participant = new ArrayList<AppointmentParticipantComponent>();
1865          for (AppointmentParticipantComponent i : participant)
1866            dst.participant.add(i.copy());
1867        };
1868        return dst;
1869      }
1870
1871      protected Appointment typedCopy() {
1872        return copy();
1873      }
1874
1875      @Override
1876      public boolean equalsDeep(Base other) {
1877        if (!super.equalsDeep(other))
1878          return false;
1879        if (!(other instanceof Appointment))
1880          return false;
1881        Appointment o = (Appointment) other;
1882        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(serviceCategory, o.serviceCategory, true)
1883           && compareDeep(serviceType, o.serviceType, true) && compareDeep(specialty, o.specialty, true) && compareDeep(appointmentType, o.appointmentType, true)
1884           && compareDeep(reason, o.reason, true) && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true)
1885           && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(minutesDuration, o.minutesDuration, true)
1886           && compareDeep(slot, o.slot, true) && compareDeep(created, o.created, true) && compareDeep(comment, o.comment, true)
1887           && compareDeep(participant, o.participant, true);
1888      }
1889
1890      @Override
1891      public boolean equalsShallow(Base other) {
1892        if (!super.equalsShallow(other))
1893          return false;
1894        if (!(other instanceof Appointment))
1895          return false;
1896        Appointment o = (Appointment) other;
1897        return compareValues(status, o.status, true) && compareValues(priority, o.priority, true) && compareValues(description, o.description, true)
1898           && compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(minutesDuration, o.minutesDuration, true)
1899           && compareValues(created, o.created, true) && compareValues(comment, o.comment, true);
1900      }
1901
1902      public boolean isEmpty() {
1903        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
1904           && (serviceCategory == null || serviceCategory.isEmpty()) && (serviceType == null || serviceType.isEmpty())
1905           && (specialty == null || specialty.isEmpty()) && (appointmentType == null || appointmentType.isEmpty())
1906           && (reason == null || reason.isEmpty()) && (priority == null || priority.isEmpty()) && (description == null || description.isEmpty())
1907           && (start == null || start.isEmpty()) && (end == null || end.isEmpty()) && (minutesDuration == null || minutesDuration.isEmpty())
1908           && (slot == null || slot.isEmpty()) && (created == null || created.isEmpty()) && (comment == null || comment.isEmpty())
1909           && (participant == null || participant.isEmpty());
1910      }
1911
1912  @Override
1913  public ResourceType getResourceType() {
1914    return ResourceType.Appointment;
1915   }
1916
1917 /**
1918   * Search parameter: <b>patient</b>
1919   * <p>
1920   * Description: <b>One of the individuals of the appointment is this patient</b><br>
1921   * Type: <b>reference</b><br>
1922   * Path: <b>Appointment.participant.actor</b><br>
1923   * </p>
1924   */
1925  @SearchParamDefinition(name="patient", path="Appointment.participant.actor", description="One of the individuals of the appointment is this patient", type="reference" )
1926  public static final String SP_PATIENT = "patient";
1927 /**
1928   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1929   * <p>
1930   * Description: <b>One of the individuals of the appointment is this patient</b><br>
1931   * Type: <b>reference</b><br>
1932   * Path: <b>Appointment.participant.actor</b><br>
1933   * </p>
1934   */
1935  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1936
1937/**
1938   * Constant for fluent queries to be used to add include statements. Specifies
1939   * the path value of "<b>Appointment:patient</b>".
1940   */
1941  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Appointment:patient").toLocked();
1942
1943 /**
1944   * Search parameter: <b>service-type</b>
1945   * <p>
1946   * Description: <b>The specific service that is to be performed during this appointment</b><br>
1947   * Type: <b>token</b><br>
1948   * Path: <b>Appointment.serviceType</b><br>
1949   * </p>
1950   */
1951  @SearchParamDefinition(name="service-type", path="Appointment.serviceType", description="The specific service that is to be performed during this appointment", type="token" )
1952  public static final String SP_SERVICE_TYPE = "service-type";
1953 /**
1954   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
1955   * <p>
1956   * Description: <b>The specific service that is to be performed during this appointment</b><br>
1957   * Type: <b>token</b><br>
1958   * Path: <b>Appointment.serviceType</b><br>
1959   * </p>
1960   */
1961  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_TYPE);
1962
1963 /**
1964   * Search parameter: <b>practitioner</b>
1965   * <p>
1966   * Description: <b>One of the individuals of the appointment is this practitioner</b><br>
1967   * Type: <b>reference</b><br>
1968   * Path: <b>Appointment.participant.actor</b><br>
1969   * </p>
1970   */
1971  @SearchParamDefinition(name="practitioner", path="Appointment.participant.actor", description="One of the individuals of the appointment is this practitioner", type="reference" )
1972  public static final String SP_PRACTITIONER = "practitioner";
1973 /**
1974   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
1975   * <p>
1976   * Description: <b>One of the individuals of the appointment is this practitioner</b><br>
1977   * Type: <b>reference</b><br>
1978   * Path: <b>Appointment.participant.actor</b><br>
1979   * </p>
1980   */
1981  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
1982
1983/**
1984   * Constant for fluent queries to be used to add include statements. Specifies
1985   * the path value of "<b>Appointment:practitioner</b>".
1986   */
1987  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("Appointment:practitioner").toLocked();
1988
1989 /**
1990   * Search parameter: <b>location</b>
1991   * <p>
1992   * Description: <b>This location is listed in the participants of the appointment</b><br>
1993   * Type: <b>reference</b><br>
1994   * Path: <b>Appointment.participant.actor</b><br>
1995   * </p>
1996   */
1997  @SearchParamDefinition(name="location", path="Appointment.participant.actor", description="This location is listed in the participants of the appointment", type="reference" )
1998  public static final String SP_LOCATION = "location";
1999 /**
2000   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2001   * <p>
2002   * Description: <b>This location is listed in the participants of the appointment</b><br>
2003   * Type: <b>reference</b><br>
2004   * Path: <b>Appointment.participant.actor</b><br>
2005   * </p>
2006   */
2007  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2008
2009/**
2010   * Constant for fluent queries to be used to add include statements. Specifies
2011   * the path value of "<b>Appointment:location</b>".
2012   */
2013  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Appointment:location").toLocked();
2014
2015 /**
2016   * Search parameter: <b>status</b>
2017   * <p>
2018   * Description: <b>The overall status of the appointment</b><br>
2019   * Type: <b>token</b><br>
2020   * Path: <b>Appointment.status</b><br>
2021   * </p>
2022   */
2023  @SearchParamDefinition(name="status", path="Appointment.status", description="The overall status of the appointment", type="token" )
2024  public static final String SP_STATUS = "status";
2025 /**
2026   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2027   * <p>
2028   * Description: <b>The overall status of the appointment</b><br>
2029   * Type: <b>token</b><br>
2030   * Path: <b>Appointment.status</b><br>
2031   * </p>
2032   */
2033  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2034
2035 /**
2036   * Search parameter: <b>appointment-type</b>
2037   * <p>
2038   * Description: <b>The style of appointment or patient that has been booked in the slot (not service type)</b><br>
2039   * Type: <b>token</b><br>
2040   * Path: <b>Appointment.appointmentType</b><br>
2041   * </p>
2042   */
2043  @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" )
2044  public static final String SP_APPOINTMENT_TYPE = "appointment-type";
2045 /**
2046   * <b>Fluent Client</b> search parameter constant for <b>appointment-type</b>
2047   * <p>
2048   * Description: <b>The style of appointment or patient that has been booked in the slot (not service type)</b><br>
2049   * Type: <b>token</b><br>
2050   * Path: <b>Appointment.appointmentType</b><br>
2051   * </p>
2052   */
2053  public static final ca.uhn.fhir.rest.gclient.TokenClientParam APPOINTMENT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_APPOINTMENT_TYPE);
2054
2055 /**
2056   * Search parameter: <b>part-status</b>
2057   * <p>
2058   * 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>
2059   * Type: <b>token</b><br>
2060   * Path: <b>Appointment.participant.status</b><br>
2061   * </p>
2062   */
2063  @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" )
2064  public static final String SP_PART_STATUS = "part-status";
2065 /**
2066   * <b>Fluent Client</b> search parameter constant for <b>part-status</b>
2067   * <p>
2068   * 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>
2069   * Type: <b>token</b><br>
2070   * Path: <b>Appointment.participant.status</b><br>
2071   * </p>
2072   */
2073  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PART_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PART_STATUS);
2074
2075 /**
2076   * Search parameter: <b>actor</b>
2077   * <p>
2078   * Description: <b>Any one of the individuals participating in the appointment</b><br>
2079   * Type: <b>reference</b><br>
2080   * Path: <b>Appointment.participant.actor</b><br>
2081   * </p>
2082   */
2083  @SearchParamDefinition(name="actor", path="Appointment.participant.actor", description="Any one of the individuals participating in the appointment", type="reference" )
2084  public static final String SP_ACTOR = "actor";
2085 /**
2086   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
2087   * <p>
2088   * Description: <b>Any one of the individuals participating in the appointment</b><br>
2089   * Type: <b>reference</b><br>
2090   * Path: <b>Appointment.participant.actor</b><br>
2091   * </p>
2092   */
2093  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
2094
2095/**
2096   * Constant for fluent queries to be used to add include statements. Specifies
2097   * the path value of "<b>Appointment:actor</b>".
2098   */
2099  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Appointment:actor").toLocked();
2100
2101 /**
2102   * Search parameter: <b>date</b>
2103   * <p>
2104   * Description: <b>Appointment date/time.</b><br>
2105   * Type: <b>date</b><br>
2106   * Path: <b>Appointment.start</b><br>
2107   * </p>
2108   */
2109  @SearchParamDefinition(name="date", path="Appointment.start", description="Appointment date/time.", type="date" )
2110  public static final String SP_DATE = "date";
2111 /**
2112   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2113   * <p>
2114   * Description: <b>Appointment date/time.</b><br>
2115   * Type: <b>date</b><br>
2116   * Path: <b>Appointment.start</b><br>
2117   * </p>
2118   */
2119  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2120
2121 /**
2122   * Search parameter: <b>identifier</b>
2123   * <p>
2124   * Description: <b>An Identifier of the Appointment</b><br>
2125   * Type: <b>token</b><br>
2126   * Path: <b>Appointment.identifier</b><br>
2127   * </p>
2128   */
2129  @SearchParamDefinition(name="identifier", path="Appointment.identifier", description="An Identifier of the Appointment", type="token" )
2130  public static final String SP_IDENTIFIER = "identifier";
2131 /**
2132   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2133   * <p>
2134   * Description: <b>An Identifier of the Appointment</b><br>
2135   * Type: <b>token</b><br>
2136   * Path: <b>Appointment.identifier</b><br>
2137   * </p>
2138   */
2139  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2140
2141
2142}
2143