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