001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.List;
038
039import ca.uhn.fhir.model.api.annotation.Block;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import org.hl7.fhir.exceptions.FHIRException;
046import org.hl7.fhir.utilities.Utilities;
047/**
048 * The details of a healthcare service available at a location.
049 */
050@ResourceDef(name="HealthcareService", profile="http://hl7.org/fhir/Profile/HealthcareService")
051public class HealthcareService extends DomainResource {
052
053    public enum DaysOfWeek {
054        /**
055         * Monday
056         */
057        MON, 
058        /**
059         * Tuesday
060         */
061        TUE, 
062        /**
063         * Wednesday
064         */
065        WED, 
066        /**
067         * Thursday
068         */
069        THU, 
070        /**
071         * Friday
072         */
073        FRI, 
074        /**
075         * Saturday
076         */
077        SAT, 
078        /**
079         * Sunday
080         */
081        SUN, 
082        /**
083         * added to help the parsers
084         */
085        NULL;
086        public static DaysOfWeek fromCode(String codeString) throws FHIRException {
087            if (codeString == null || "".equals(codeString))
088                return null;
089        if ("mon".equals(codeString))
090          return MON;
091        if ("tue".equals(codeString))
092          return TUE;
093        if ("wed".equals(codeString))
094          return WED;
095        if ("thu".equals(codeString))
096          return THU;
097        if ("fri".equals(codeString))
098          return FRI;
099        if ("sat".equals(codeString))
100          return SAT;
101        if ("sun".equals(codeString))
102          return SUN;
103        throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
104        }
105        public String toCode() {
106          switch (this) {
107            case MON: return "mon";
108            case TUE: return "tue";
109            case WED: return "wed";
110            case THU: return "thu";
111            case FRI: return "fri";
112            case SAT: return "sat";
113            case SUN: return "sun";
114            default: return "?";
115          }
116        }
117        public String getSystem() {
118          switch (this) {
119            case MON: return "http://hl7.org/fhir/days-of-week";
120            case TUE: return "http://hl7.org/fhir/days-of-week";
121            case WED: return "http://hl7.org/fhir/days-of-week";
122            case THU: return "http://hl7.org/fhir/days-of-week";
123            case FRI: return "http://hl7.org/fhir/days-of-week";
124            case SAT: return "http://hl7.org/fhir/days-of-week";
125            case SUN: return "http://hl7.org/fhir/days-of-week";
126            default: return "?";
127          }
128        }
129        public String getDefinition() {
130          switch (this) {
131            case MON: return "Monday";
132            case TUE: return "Tuesday";
133            case WED: return "Wednesday";
134            case THU: return "Thursday";
135            case FRI: return "Friday";
136            case SAT: return "Saturday";
137            case SUN: return "Sunday";
138            default: return "?";
139          }
140        }
141        public String getDisplay() {
142          switch (this) {
143            case MON: return "Monday";
144            case TUE: return "Tuesday";
145            case WED: return "Wednesday";
146            case THU: return "Thursday";
147            case FRI: return "Friday";
148            case SAT: return "Saturday";
149            case SUN: return "Sunday";
150            default: return "?";
151          }
152        }
153    }
154
155  public static class DaysOfWeekEnumFactory implements EnumFactory<DaysOfWeek> {
156    public DaysOfWeek fromCode(String codeString) throws IllegalArgumentException {
157      if (codeString == null || "".equals(codeString))
158            if (codeString == null || "".equals(codeString))
159                return null;
160        if ("mon".equals(codeString))
161          return DaysOfWeek.MON;
162        if ("tue".equals(codeString))
163          return DaysOfWeek.TUE;
164        if ("wed".equals(codeString))
165          return DaysOfWeek.WED;
166        if ("thu".equals(codeString))
167          return DaysOfWeek.THU;
168        if ("fri".equals(codeString))
169          return DaysOfWeek.FRI;
170        if ("sat".equals(codeString))
171          return DaysOfWeek.SAT;
172        if ("sun".equals(codeString))
173          return DaysOfWeek.SUN;
174        throw new IllegalArgumentException("Unknown DaysOfWeek code '"+codeString+"'");
175        }
176        public Enumeration<DaysOfWeek> fromType(Base code) throws FHIRException {
177          if (code == null || code.isEmpty())
178            return null;
179          String codeString = ((PrimitiveType) code).asStringValue();
180          if (codeString == null || "".equals(codeString))
181            return null;
182        if ("mon".equals(codeString))
183          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.MON);
184        if ("tue".equals(codeString))
185          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.TUE);
186        if ("wed".equals(codeString))
187          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.WED);
188        if ("thu".equals(codeString))
189          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.THU);
190        if ("fri".equals(codeString))
191          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.FRI);
192        if ("sat".equals(codeString))
193          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SAT);
194        if ("sun".equals(codeString))
195          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SUN);
196        throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
197        }
198    public String toCode(DaysOfWeek code) {
199      if (code == DaysOfWeek.MON)
200        return "mon";
201      if (code == DaysOfWeek.TUE)
202        return "tue";
203      if (code == DaysOfWeek.WED)
204        return "wed";
205      if (code == DaysOfWeek.THU)
206        return "thu";
207      if (code == DaysOfWeek.FRI)
208        return "fri";
209      if (code == DaysOfWeek.SAT)
210        return "sat";
211      if (code == DaysOfWeek.SUN)
212        return "sun";
213      return "?";
214      }
215    }
216
217    @Block()
218    public static class ServiceTypeComponent extends BackboneElement implements IBaseBackboneElement {
219        /**
220         * The specific type of service being delivered or performed.
221         */
222        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
223        @Description(shortDefinition="Type of service delivered or performed", formalDefinition="The specific type of service being delivered or performed." )
224        protected CodeableConcept type;
225
226        /**
227         * Collection of specialties handled by the service site. This is more of a medical term.
228         */
229        @Child(name = "specialty", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
230        @Description(shortDefinition="Specialties handled by the Service Site", formalDefinition="Collection of specialties handled by the service site. This is more of a medical term." )
231        protected List<CodeableConcept> specialty;
232
233        private static final long serialVersionUID = 1703986174L;
234
235    /*
236     * Constructor
237     */
238      public ServiceTypeComponent() {
239        super();
240      }
241
242    /*
243     * Constructor
244     */
245      public ServiceTypeComponent(CodeableConcept type) {
246        super();
247        this.type = type;
248      }
249
250        /**
251         * @return {@link #type} (The specific type of service being delivered or performed.)
252         */
253        public CodeableConcept getType() { 
254          if (this.type == null)
255            if (Configuration.errorOnAutoCreate())
256              throw new Error("Attempt to auto-create ServiceTypeComponent.type");
257            else if (Configuration.doAutoCreate())
258              this.type = new CodeableConcept(); // cc
259          return this.type;
260        }
261
262        public boolean hasType() { 
263          return this.type != null && !this.type.isEmpty();
264        }
265
266        /**
267         * @param value {@link #type} (The specific type of service being delivered or performed.)
268         */
269        public ServiceTypeComponent setType(CodeableConcept value) { 
270          this.type = value;
271          return this;
272        }
273
274        /**
275         * @return {@link #specialty} (Collection of specialties handled by the service site. This is more of a medical term.)
276         */
277        public List<CodeableConcept> getSpecialty() { 
278          if (this.specialty == null)
279            this.specialty = new ArrayList<CodeableConcept>();
280          return this.specialty;
281        }
282
283        public boolean hasSpecialty() { 
284          if (this.specialty == null)
285            return false;
286          for (CodeableConcept item : this.specialty)
287            if (!item.isEmpty())
288              return true;
289          return false;
290        }
291
292        /**
293         * @return {@link #specialty} (Collection of specialties handled by the service site. This is more of a medical term.)
294         */
295    // syntactic sugar
296        public CodeableConcept addSpecialty() { //3
297          CodeableConcept t = new CodeableConcept();
298          if (this.specialty == null)
299            this.specialty = new ArrayList<CodeableConcept>();
300          this.specialty.add(t);
301          return t;
302        }
303
304    // syntactic sugar
305        public ServiceTypeComponent addSpecialty(CodeableConcept t) { //3
306          if (t == null)
307            return this;
308          if (this.specialty == null)
309            this.specialty = new ArrayList<CodeableConcept>();
310          this.specialty.add(t);
311          return this;
312        }
313
314        protected void listChildren(List<Property> childrenList) {
315          super.listChildren(childrenList);
316          childrenList.add(new Property("type", "CodeableConcept", "The specific type of service being delivered or performed.", 0, java.lang.Integer.MAX_VALUE, type));
317          childrenList.add(new Property("specialty", "CodeableConcept", "Collection of specialties handled by the service site. This is more of a medical term.", 0, java.lang.Integer.MAX_VALUE, specialty));
318        }
319
320      @Override
321      public void setProperty(String name, Base value) throws FHIRException {
322        if (name.equals("type"))
323          this.type = castToCodeableConcept(value); // CodeableConcept
324        else if (name.equals("specialty"))
325          this.getSpecialty().add(castToCodeableConcept(value));
326        else
327          super.setProperty(name, value);
328      }
329
330      @Override
331      public Base addChild(String name) throws FHIRException {
332        if (name.equals("type")) {
333          this.type = new CodeableConcept();
334          return this.type;
335        }
336        else if (name.equals("specialty")) {
337          return addSpecialty();
338        }
339        else
340          return super.addChild(name);
341      }
342
343      public ServiceTypeComponent copy() {
344        ServiceTypeComponent dst = new ServiceTypeComponent();
345        copyValues(dst);
346        dst.type = type == null ? null : type.copy();
347        if (specialty != null) {
348          dst.specialty = new ArrayList<CodeableConcept>();
349          for (CodeableConcept i : specialty)
350            dst.specialty.add(i.copy());
351        };
352        return dst;
353      }
354
355      @Override
356      public boolean equalsDeep(Base other) {
357        if (!super.equalsDeep(other))
358          return false;
359        if (!(other instanceof ServiceTypeComponent))
360          return false;
361        ServiceTypeComponent o = (ServiceTypeComponent) other;
362        return compareDeep(type, o.type, true) && compareDeep(specialty, o.specialty, true);
363      }
364
365      @Override
366      public boolean equalsShallow(Base other) {
367        if (!super.equalsShallow(other))
368          return false;
369        if (!(other instanceof ServiceTypeComponent))
370          return false;
371        ServiceTypeComponent o = (ServiceTypeComponent) other;
372        return true;
373      }
374
375      public boolean isEmpty() {
376        return super.isEmpty() && (type == null || type.isEmpty()) && (specialty == null || specialty.isEmpty())
377          ;
378      }
379
380  public String fhirType() {
381    return "HealthcareService.serviceType";
382
383  }
384
385  }
386
387    @Block()
388    public static class HealthcareServiceAvailableTimeComponent extends BackboneElement implements IBaseBackboneElement {
389        /**
390         * Indicates which days of the week are available between the start and end Times.
391         */
392        @Child(name = "daysOfWeek", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
393        @Description(shortDefinition="mon | tue | wed | thu | fri | sat | sun", formalDefinition="Indicates which days of the week are available between the start and end Times." )
394        protected List<Enumeration<DaysOfWeek>> daysOfWeek;
395
396        /**
397         * Is this always available? (hence times are irrelevant) e.g. 24 hour service.
398         */
399        @Child(name = "allDay", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
400        @Description(shortDefinition="Always available? e.g. 24 hour service", formalDefinition="Is this always available? (hence times are irrelevant) e.g. 24 hour service." )
401        protected BooleanType allDay;
402
403        /**
404         * The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
405         */
406        @Child(name = "availableStartTime", type = {TimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
407        @Description(shortDefinition="Opening time of day (ignored if allDay = true)", formalDefinition="The opening time of day. Note: If the AllDay flag is set, then this time is ignored." )
408        protected TimeType availableStartTime;
409
410        /**
411         * The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
412         */
413        @Child(name = "availableEndTime", type = {TimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
414        @Description(shortDefinition="Closing time of day (ignored if allDay = true)", formalDefinition="The closing time of day. Note: If the AllDay flag is set, then this time is ignored." )
415        protected TimeType availableEndTime;
416
417        private static final long serialVersionUID = -2139510127L;
418
419    /*
420     * Constructor
421     */
422      public HealthcareServiceAvailableTimeComponent() {
423        super();
424      }
425
426        /**
427         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
428         */
429        public List<Enumeration<DaysOfWeek>> getDaysOfWeek() { 
430          if (this.daysOfWeek == null)
431            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
432          return this.daysOfWeek;
433        }
434
435        public boolean hasDaysOfWeek() { 
436          if (this.daysOfWeek == null)
437            return false;
438          for (Enumeration<DaysOfWeek> item : this.daysOfWeek)
439            if (!item.isEmpty())
440              return true;
441          return false;
442        }
443
444        /**
445         * @return Returns a reference to <code>this</code> for easy method chaining
446         */
447        public HealthcareServiceAvailableTimeComponent setDaysOfWeek(List<Enumeration<DaysOfWeek>> daysOfWeek) {
448            this.daysOfWeek = daysOfWeek;
449            return this;
450        }
451
452        /**
453         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
454         */
455    // syntactic sugar
456        public Enumeration<DaysOfWeek> addDaysOfWeekElement() {//2 
457          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
458          if (this.daysOfWeek == null)
459            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
460          this.daysOfWeek.add(t);
461          return t;
462        }
463
464        /**
465         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
466         */
467        public HealthcareServiceAvailableTimeComponent addDaysOfWeek(DaysOfWeek value) { //1
468          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
469          t.setValue(value);
470          if (this.daysOfWeek == null)
471            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
472          this.daysOfWeek.add(t);
473          return this;
474        }
475
476        /**
477         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
478         */
479        public boolean hasDaysOfWeek(DaysOfWeek value) { 
480          if (this.daysOfWeek == null)
481            return false;
482          for (Enumeration<DaysOfWeek> v : this.daysOfWeek)
483            if (v.equals(value)) // code
484              return true;
485          return false;
486        }
487
488        /**
489         * @return {@link #allDay} (Is this always available? (hence times are irrelevant) e.g. 24 hour service.). This is the underlying object with id, value and extensions. The accessor "getAllDay" gives direct access to the value
490         */
491        public BooleanType getAllDayElement() { 
492          if (this.allDay == null)
493            if (Configuration.errorOnAutoCreate())
494              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.allDay");
495            else if (Configuration.doAutoCreate())
496              this.allDay = new BooleanType(); // bb
497          return this.allDay;
498        }
499
500        public boolean hasAllDayElement() { 
501          return this.allDay != null && !this.allDay.isEmpty();
502        }
503
504        public boolean hasAllDay() { 
505          return this.allDay != null && !this.allDay.isEmpty();
506        }
507
508        /**
509         * @param value {@link #allDay} (Is this always available? (hence times are irrelevant) e.g. 24 hour service.). This is the underlying object with id, value and extensions. The accessor "getAllDay" gives direct access to the value
510         */
511        public HealthcareServiceAvailableTimeComponent setAllDayElement(BooleanType value) { 
512          this.allDay = value;
513          return this;
514        }
515
516        /**
517         * @return Is this always available? (hence times are irrelevant) e.g. 24 hour service.
518         */
519        public boolean getAllDay() { 
520          return this.allDay == null || this.allDay.isEmpty() ? false : this.allDay.getValue();
521        }
522
523        /**
524         * @param value Is this always available? (hence times are irrelevant) e.g. 24 hour service.
525         */
526        public HealthcareServiceAvailableTimeComponent setAllDay(boolean value) { 
527            if (this.allDay == null)
528              this.allDay = new BooleanType();
529            this.allDay.setValue(value);
530          return this;
531        }
532
533        /**
534         * @return {@link #availableStartTime} (The opening time of day. Note: If the AllDay flag is set, then this time is ignored.). This is the underlying object with id, value and extensions. The accessor "getAvailableStartTime" gives direct access to the value
535         */
536        public TimeType getAvailableStartTimeElement() { 
537          if (this.availableStartTime == null)
538            if (Configuration.errorOnAutoCreate())
539              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.availableStartTime");
540            else if (Configuration.doAutoCreate())
541              this.availableStartTime = new TimeType(); // bb
542          return this.availableStartTime;
543        }
544
545        public boolean hasAvailableStartTimeElement() { 
546          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
547        }
548
549        public boolean hasAvailableStartTime() { 
550          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
551        }
552
553        /**
554         * @param value {@link #availableStartTime} (The opening time of day. Note: If the AllDay flag is set, then this time is ignored.). This is the underlying object with id, value and extensions. The accessor "getAvailableStartTime" gives direct access to the value
555         */
556        public HealthcareServiceAvailableTimeComponent setAvailableStartTimeElement(TimeType value) { 
557          this.availableStartTime = value;
558          return this;
559        }
560
561        /**
562         * @return The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
563         */
564        public String getAvailableStartTime() { 
565          return this.availableStartTime == null ? null : this.availableStartTime.getValue();
566        }
567
568        /**
569         * @param value The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
570         */
571        public HealthcareServiceAvailableTimeComponent setAvailableStartTime(String value) { 
572          if (value == null)
573            this.availableStartTime = null;
574          else {
575            if (this.availableStartTime == null)
576              this.availableStartTime = new TimeType();
577            this.availableStartTime.setValue(value);
578          }
579          return this;
580        }
581
582        /**
583         * @return {@link #availableEndTime} (The closing time of day. Note: If the AllDay flag is set, then this time is ignored.). This is the underlying object with id, value and extensions. The accessor "getAvailableEndTime" gives direct access to the value
584         */
585        public TimeType getAvailableEndTimeElement() { 
586          if (this.availableEndTime == null)
587            if (Configuration.errorOnAutoCreate())
588              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.availableEndTime");
589            else if (Configuration.doAutoCreate())
590              this.availableEndTime = new TimeType(); // bb
591          return this.availableEndTime;
592        }
593
594        public boolean hasAvailableEndTimeElement() { 
595          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
596        }
597
598        public boolean hasAvailableEndTime() { 
599          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
600        }
601
602        /**
603         * @param value {@link #availableEndTime} (The closing time of day. Note: If the AllDay flag is set, then this time is ignored.). This is the underlying object with id, value and extensions. The accessor "getAvailableEndTime" gives direct access to the value
604         */
605        public HealthcareServiceAvailableTimeComponent setAvailableEndTimeElement(TimeType value) { 
606          this.availableEndTime = value;
607          return this;
608        }
609
610        /**
611         * @return The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
612         */
613        public String getAvailableEndTime() { 
614          return this.availableEndTime == null ? null : this.availableEndTime.getValue();
615        }
616
617        /**
618         * @param value The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
619         */
620        public HealthcareServiceAvailableTimeComponent setAvailableEndTime(String value) { 
621          if (value == null)
622            this.availableEndTime = null;
623          else {
624            if (this.availableEndTime == null)
625              this.availableEndTime = new TimeType();
626            this.availableEndTime.setValue(value);
627          }
628          return this;
629        }
630
631        protected void listChildren(List<Property> childrenList) {
632          super.listChildren(childrenList);
633          childrenList.add(new Property("daysOfWeek", "code", "Indicates which days of the week are available between the start and end Times.", 0, java.lang.Integer.MAX_VALUE, daysOfWeek));
634          childrenList.add(new Property("allDay", "boolean", "Is this always available? (hence times are irrelevant) e.g. 24 hour service.", 0, java.lang.Integer.MAX_VALUE, allDay));
635          childrenList.add(new Property("availableStartTime", "time", "The opening time of day. Note: If the AllDay flag is set, then this time is ignored.", 0, java.lang.Integer.MAX_VALUE, availableStartTime));
636          childrenList.add(new Property("availableEndTime", "time", "The closing time of day. Note: If the AllDay flag is set, then this time is ignored.", 0, java.lang.Integer.MAX_VALUE, availableEndTime));
637        }
638
639      @Override
640      public void setProperty(String name, Base value) throws FHIRException {
641        if (name.equals("daysOfWeek"))
642          this.getDaysOfWeek().add(new DaysOfWeekEnumFactory().fromType(value));
643        else if (name.equals("allDay"))
644          this.allDay = castToBoolean(value); // BooleanType
645        else if (name.equals("availableStartTime"))
646          this.availableStartTime = castToTime(value); // TimeType
647        else if (name.equals("availableEndTime"))
648          this.availableEndTime = castToTime(value); // TimeType
649        else
650          super.setProperty(name, value);
651      }
652
653      @Override
654      public Base addChild(String name) throws FHIRException {
655        if (name.equals("daysOfWeek")) {
656          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.daysOfWeek");
657        }
658        else if (name.equals("allDay")) {
659          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.allDay");
660        }
661        else if (name.equals("availableStartTime")) {
662          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availableStartTime");
663        }
664        else if (name.equals("availableEndTime")) {
665          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availableEndTime");
666        }
667        else
668          return super.addChild(name);
669      }
670
671      public HealthcareServiceAvailableTimeComponent copy() {
672        HealthcareServiceAvailableTimeComponent dst = new HealthcareServiceAvailableTimeComponent();
673        copyValues(dst);
674        if (daysOfWeek != null) {
675          dst.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
676          for (Enumeration<DaysOfWeek> i : daysOfWeek)
677            dst.daysOfWeek.add(i.copy());
678        };
679        dst.allDay = allDay == null ? null : allDay.copy();
680        dst.availableStartTime = availableStartTime == null ? null : availableStartTime.copy();
681        dst.availableEndTime = availableEndTime == null ? null : availableEndTime.copy();
682        return dst;
683      }
684
685      @Override
686      public boolean equalsDeep(Base other) {
687        if (!super.equalsDeep(other))
688          return false;
689        if (!(other instanceof HealthcareServiceAvailableTimeComponent))
690          return false;
691        HealthcareServiceAvailableTimeComponent o = (HealthcareServiceAvailableTimeComponent) other;
692        return compareDeep(daysOfWeek, o.daysOfWeek, true) && compareDeep(allDay, o.allDay, true) && compareDeep(availableStartTime, o.availableStartTime, true)
693           && compareDeep(availableEndTime, o.availableEndTime, true);
694      }
695
696      @Override
697      public boolean equalsShallow(Base other) {
698        if (!super.equalsShallow(other))
699          return false;
700        if (!(other instanceof HealthcareServiceAvailableTimeComponent))
701          return false;
702        HealthcareServiceAvailableTimeComponent o = (HealthcareServiceAvailableTimeComponent) other;
703        return compareValues(daysOfWeek, o.daysOfWeek, true) && compareValues(allDay, o.allDay, true) && compareValues(availableStartTime, o.availableStartTime, true)
704           && compareValues(availableEndTime, o.availableEndTime, true);
705      }
706
707      public boolean isEmpty() {
708        return super.isEmpty() && (daysOfWeek == null || daysOfWeek.isEmpty()) && (allDay == null || allDay.isEmpty())
709           && (availableStartTime == null || availableStartTime.isEmpty()) && (availableEndTime == null || availableEndTime.isEmpty())
710          ;
711      }
712
713  public String fhirType() {
714    return "HealthcareService.availableTime";
715
716  }
717
718  }
719
720    @Block()
721    public static class HealthcareServiceNotAvailableComponent extends BackboneElement implements IBaseBackboneElement {
722        /**
723         * The reason that can be presented to the user as to why this time is not available.
724         */
725        @Child(name = "description", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
726        @Description(shortDefinition="Reason presented to the user explaining why time not available", formalDefinition="The reason that can be presented to the user as to why this time is not available." )
727        protected StringType description;
728
729        /**
730         * Service is not available (seasonally or for a public holiday) from this date.
731         */
732        @Child(name = "during", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
733        @Description(shortDefinition="Service not availablefrom this date", formalDefinition="Service is not available (seasonally or for a public holiday) from this date." )
734        protected Period during;
735
736        private static final long serialVersionUID = 310849929L;
737
738    /*
739     * Constructor
740     */
741      public HealthcareServiceNotAvailableComponent() {
742        super();
743      }
744
745    /*
746     * Constructor
747     */
748      public HealthcareServiceNotAvailableComponent(StringType description) {
749        super();
750        this.description = description;
751      }
752
753        /**
754         * @return {@link #description} (The reason that can be presented to the user as to why this time is not available.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
755         */
756        public StringType getDescriptionElement() { 
757          if (this.description == null)
758            if (Configuration.errorOnAutoCreate())
759              throw new Error("Attempt to auto-create HealthcareServiceNotAvailableComponent.description");
760            else if (Configuration.doAutoCreate())
761              this.description = new StringType(); // bb
762          return this.description;
763        }
764
765        public boolean hasDescriptionElement() { 
766          return this.description != null && !this.description.isEmpty();
767        }
768
769        public boolean hasDescription() { 
770          return this.description != null && !this.description.isEmpty();
771        }
772
773        /**
774         * @param value {@link #description} (The reason that can be presented to the user as to why this time is not available.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
775         */
776        public HealthcareServiceNotAvailableComponent setDescriptionElement(StringType value) { 
777          this.description = value;
778          return this;
779        }
780
781        /**
782         * @return The reason that can be presented to the user as to why this time is not available.
783         */
784        public String getDescription() { 
785          return this.description == null ? null : this.description.getValue();
786        }
787
788        /**
789         * @param value The reason that can be presented to the user as to why this time is not available.
790         */
791        public HealthcareServiceNotAvailableComponent setDescription(String value) { 
792            if (this.description == null)
793              this.description = new StringType();
794            this.description.setValue(value);
795          return this;
796        }
797
798        /**
799         * @return {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
800         */
801        public Period getDuring() { 
802          if (this.during == null)
803            if (Configuration.errorOnAutoCreate())
804              throw new Error("Attempt to auto-create HealthcareServiceNotAvailableComponent.during");
805            else if (Configuration.doAutoCreate())
806              this.during = new Period(); // cc
807          return this.during;
808        }
809
810        public boolean hasDuring() { 
811          return this.during != null && !this.during.isEmpty();
812        }
813
814        /**
815         * @param value {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
816         */
817        public HealthcareServiceNotAvailableComponent setDuring(Period value) { 
818          this.during = value;
819          return this;
820        }
821
822        protected void listChildren(List<Property> childrenList) {
823          super.listChildren(childrenList);
824          childrenList.add(new Property("description", "string", "The reason that can be presented to the user as to why this time is not available.", 0, java.lang.Integer.MAX_VALUE, description));
825          childrenList.add(new Property("during", "Period", "Service is not available (seasonally or for a public holiday) from this date.", 0, java.lang.Integer.MAX_VALUE, during));
826        }
827
828      @Override
829      public void setProperty(String name, Base value) throws FHIRException {
830        if (name.equals("description"))
831          this.description = castToString(value); // StringType
832        else if (name.equals("during"))
833          this.during = castToPeriod(value); // Period
834        else
835          super.setProperty(name, value);
836      }
837
838      @Override
839      public Base addChild(String name) throws FHIRException {
840        if (name.equals("description")) {
841          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.description");
842        }
843        else if (name.equals("during")) {
844          this.during = new Period();
845          return this.during;
846        }
847        else
848          return super.addChild(name);
849      }
850
851      public HealthcareServiceNotAvailableComponent copy() {
852        HealthcareServiceNotAvailableComponent dst = new HealthcareServiceNotAvailableComponent();
853        copyValues(dst);
854        dst.description = description == null ? null : description.copy();
855        dst.during = during == null ? null : during.copy();
856        return dst;
857      }
858
859      @Override
860      public boolean equalsDeep(Base other) {
861        if (!super.equalsDeep(other))
862          return false;
863        if (!(other instanceof HealthcareServiceNotAvailableComponent))
864          return false;
865        HealthcareServiceNotAvailableComponent o = (HealthcareServiceNotAvailableComponent) other;
866        return compareDeep(description, o.description, true) && compareDeep(during, o.during, true);
867      }
868
869      @Override
870      public boolean equalsShallow(Base other) {
871        if (!super.equalsShallow(other))
872          return false;
873        if (!(other instanceof HealthcareServiceNotAvailableComponent))
874          return false;
875        HealthcareServiceNotAvailableComponent o = (HealthcareServiceNotAvailableComponent) other;
876        return compareValues(description, o.description, true);
877      }
878
879      public boolean isEmpty() {
880        return super.isEmpty() && (description == null || description.isEmpty()) && (during == null || during.isEmpty())
881          ;
882      }
883
884  public String fhirType() {
885    return "HealthcareService.notAvailable";
886
887  }
888
889  }
890
891    /**
892     * External identifiers for this item.
893     */
894    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
895    @Description(shortDefinition="External identifiers for this item", formalDefinition="External identifiers for this item." )
896    protected List<Identifier> identifier;
897
898    /**
899     * The organization that provides this healthcare service.
900     */
901    @Child(name = "providedBy", type = {Organization.class}, order=1, min=0, max=1, modifier=false, summary=true)
902    @Description(shortDefinition="Organization that provides this service", formalDefinition="The organization that provides this healthcare service." )
903    protected Reference providedBy;
904
905    /**
906     * The actual object that is the target of the reference (The organization that provides this healthcare service.)
907     */
908    protected Organization providedByTarget;
909
910    /**
911     * Identifies the broad category of service being performed or delivered.
912     */
913    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
914    @Description(shortDefinition="Broad category of service being performed or delivered", formalDefinition="Identifies the broad category of service being performed or delivered." )
915    protected CodeableConcept serviceCategory;
916
917    /**
918     * A specific type of service that may be delivered or performed.
919     */
920    @Child(name = "serviceType", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
921    @Description(shortDefinition="Specific service delivered or performed", formalDefinition="A specific type of service that may be delivered or performed." )
922    protected List<ServiceTypeComponent> serviceType;
923
924    /**
925     * The location where this healthcare service may be provided.
926     */
927    @Child(name = "location", type = {Location.class}, order=4, min=1, max=1, modifier=false, summary=true)
928    @Description(shortDefinition="Location where service may be provided", formalDefinition="The location where this healthcare service may be provided." )
929    protected Reference location;
930
931    /**
932     * The actual object that is the target of the reference (The location where this healthcare service may be provided.)
933     */
934    protected Location locationTarget;
935
936    /**
937     * Further description of the service as it would be presented to a consumer while searching.
938     */
939    @Child(name = "serviceName", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
940    @Description(shortDefinition="Description of service as presented to a consumer while searching", formalDefinition="Further description of the service as it would be presented to a consumer while searching." )
941    protected StringType serviceName;
942
943    /**
944     * Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName.
945     */
946    @Child(name = "comment", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
947    @Description(shortDefinition="Additional description and/or any specific issues not covered elsewhere", formalDefinition="Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName." )
948    protected StringType comment;
949
950    /**
951     * Extra details about the service that can't be placed in the other fields.
952     */
953    @Child(name = "extraDetails", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
954    @Description(shortDefinition="Extra details about the service that can't be placed in the other fields", formalDefinition="Extra details about the service that can't be placed in the other fields." )
955    protected StringType extraDetails;
956
957    /**
958     * If there is a photo/symbol associated with this HealthcareService, it may be included here to facilitate quick identification of the service in a list.
959     */
960    @Child(name = "photo", type = {Attachment.class}, order=8, min=0, max=1, modifier=false, summary=true)
961    @Description(shortDefinition="Facilitates quick identification of the service", formalDefinition="If there is a photo/symbol associated with this HealthcareService, it may be included here to facilitate quick identification of the service in a list." )
962    protected Attachment photo;
963
964    /**
965     * List of contacts related to this specific healthcare service.
966     */
967    @Child(name = "telecom", type = {ContactPoint.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
968    @Description(shortDefinition="Contacts related to the healthcare service", formalDefinition="List of contacts related to this specific healthcare service." )
969    protected List<ContactPoint> telecom;
970
971    /**
972     * The location(s) that this service is available to (not where the service is provided).
973     */
974    @Child(name = "coverageArea", type = {Location.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
975    @Description(shortDefinition="Location(s) service is inteded for/available to", formalDefinition="The location(s) that this service is available to (not where the service is provided)." )
976    protected List<Reference> coverageArea;
977    /**
978     * The actual objects that are the target of the reference (The location(s) that this service is available to (not where the service is provided).)
979     */
980    protected List<Location> coverageAreaTarget;
981
982
983    /**
984     * The code(s) that detail the conditions under which the healthcare service is available/offered.
985     */
986    @Child(name = "serviceProvisionCode", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
987    @Description(shortDefinition="Conditions under which service is available/offered", formalDefinition="The code(s) that detail the conditions under which the healthcare service is available/offered." )
988    protected List<CodeableConcept> serviceProvisionCode;
989
990    /**
991     * Does this service have specific eligibility requirements that need to be met in order to use the service?
992     */
993    @Child(name = "eligibility", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
994    @Description(shortDefinition="Specific eligibility requirements required to use the service", formalDefinition="Does this service have specific eligibility requirements that need to be met in order to use the service?" )
995    protected CodeableConcept eligibility;
996
997    /**
998     * Describes the eligibility conditions for the service.
999     */
1000    @Child(name = "eligibilityNote", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
1001    @Description(shortDefinition="Describes the eligibility conditions for the service", formalDefinition="Describes the eligibility conditions for the service." )
1002    protected StringType eligibilityNote;
1003
1004    /**
1005     * Program Names that can be used to categorize the service.
1006     */
1007    @Child(name = "programName", type = {StringType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1008    @Description(shortDefinition="Program Names that categorize the service", formalDefinition="Program Names that can be used to categorize the service." )
1009    protected List<StringType> programName;
1010
1011    /**
1012     * Collection of characteristics (attributes).
1013     */
1014    @Child(name = "characteristic", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1015    @Description(shortDefinition="Collection of characteristics (attributes)", formalDefinition="Collection of characteristics (attributes)." )
1016    protected List<CodeableConcept> characteristic;
1017
1018    /**
1019     * Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required.
1020     */
1021    @Child(name = "referralMethod", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1022    @Description(shortDefinition="Ways that the service accepts referrals", formalDefinition="Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required." )
1023    protected List<CodeableConcept> referralMethod;
1024
1025    /**
1026     * The public part of the 'keys' allocated to an Organization by an accredited body to support secure exchange of data over the internet. To be provided by the Organization, where available.
1027     */
1028    @Child(name = "publicKey", type = {StringType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1029    @Description(shortDefinition="PKI Public keys to support secure communications", formalDefinition="The public part of the 'keys' allocated to an Organization by an accredited body to support secure exchange of data over the internet. To be provided by the Organization, where available." )
1030    protected StringType publicKey;
1031
1032    /**
1033     * Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service.
1034     */
1035    @Child(name = "appointmentRequired", type = {BooleanType.class}, order=18, min=0, max=1, modifier=false, summary=false)
1036    @Description(shortDefinition="If an appointment is required for access to this service", formalDefinition="Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service." )
1037    protected BooleanType appointmentRequired;
1038
1039    /**
1040     * A collection of times that the Service Site is available.
1041     */
1042    @Child(name = "availableTime", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1043    @Description(shortDefinition="Times the Service Site is available", formalDefinition="A collection of times that the Service Site is available." )
1044    protected List<HealthcareServiceAvailableTimeComponent> availableTime;
1045
1046    /**
1047     * The HealthcareService is not available during this period of time due to the provided reason.
1048     */
1049    @Child(name = "notAvailable", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1050    @Description(shortDefinition="Not available during this time due to provided reason", formalDefinition="The HealthcareService is not available during this period of time due to the provided reason." )
1051    protected List<HealthcareServiceNotAvailableComponent> notAvailable;
1052
1053    /**
1054     * A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.
1055     */
1056    @Child(name = "availabilityExceptions", type = {StringType.class}, order=21, min=0, max=1, modifier=false, summary=false)
1057    @Description(shortDefinition="Description of availability exceptions", formalDefinition="A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times." )
1058    protected StringType availabilityExceptions;
1059
1060    private static final long serialVersionUID = 683771126L;
1061
1062  /*
1063   * Constructor
1064   */
1065    public HealthcareService() {
1066      super();
1067    }
1068
1069  /*
1070   * Constructor
1071   */
1072    public HealthcareService(Reference location) {
1073      super();
1074      this.location = location;
1075    }
1076
1077    /**
1078     * @return {@link #identifier} (External identifiers for this item.)
1079     */
1080    public List<Identifier> getIdentifier() { 
1081      if (this.identifier == null)
1082        this.identifier = new ArrayList<Identifier>();
1083      return this.identifier;
1084    }
1085
1086    public boolean hasIdentifier() { 
1087      if (this.identifier == null)
1088        return false;
1089      for (Identifier item : this.identifier)
1090        if (!item.isEmpty())
1091          return true;
1092      return false;
1093    }
1094
1095    /**
1096     * @return {@link #identifier} (External identifiers for this item.)
1097     */
1098    // syntactic sugar
1099    public Identifier addIdentifier() { //3
1100      Identifier t = new Identifier();
1101      if (this.identifier == null)
1102        this.identifier = new ArrayList<Identifier>();
1103      this.identifier.add(t);
1104      return t;
1105    }
1106
1107    // syntactic sugar
1108    public HealthcareService addIdentifier(Identifier t) { //3
1109      if (t == null)
1110        return this;
1111      if (this.identifier == null)
1112        this.identifier = new ArrayList<Identifier>();
1113      this.identifier.add(t);
1114      return this;
1115    }
1116
1117    /**
1118     * @return {@link #providedBy} (The organization that provides this healthcare service.)
1119     */
1120    public Reference getProvidedBy() { 
1121      if (this.providedBy == null)
1122        if (Configuration.errorOnAutoCreate())
1123          throw new Error("Attempt to auto-create HealthcareService.providedBy");
1124        else if (Configuration.doAutoCreate())
1125          this.providedBy = new Reference(); // cc
1126      return this.providedBy;
1127    }
1128
1129    public boolean hasProvidedBy() { 
1130      return this.providedBy != null && !this.providedBy.isEmpty();
1131    }
1132
1133    /**
1134     * @param value {@link #providedBy} (The organization that provides this healthcare service.)
1135     */
1136    public HealthcareService setProvidedBy(Reference value) { 
1137      this.providedBy = value;
1138      return this;
1139    }
1140
1141    /**
1142     * @return {@link #providedBy} 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. (The organization that provides this healthcare service.)
1143     */
1144    public Organization getProvidedByTarget() { 
1145      if (this.providedByTarget == null)
1146        if (Configuration.errorOnAutoCreate())
1147          throw new Error("Attempt to auto-create HealthcareService.providedBy");
1148        else if (Configuration.doAutoCreate())
1149          this.providedByTarget = new Organization(); // aa
1150      return this.providedByTarget;
1151    }
1152
1153    /**
1154     * @param value {@link #providedBy} 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. (The organization that provides this healthcare service.)
1155     */
1156    public HealthcareService setProvidedByTarget(Organization value) { 
1157      this.providedByTarget = value;
1158      return this;
1159    }
1160
1161    /**
1162     * @return {@link #serviceCategory} (Identifies the broad category of service being performed or delivered.)
1163     */
1164    public CodeableConcept getServiceCategory() { 
1165      if (this.serviceCategory == null)
1166        if (Configuration.errorOnAutoCreate())
1167          throw new Error("Attempt to auto-create HealthcareService.serviceCategory");
1168        else if (Configuration.doAutoCreate())
1169          this.serviceCategory = new CodeableConcept(); // cc
1170      return this.serviceCategory;
1171    }
1172
1173    public boolean hasServiceCategory() { 
1174      return this.serviceCategory != null && !this.serviceCategory.isEmpty();
1175    }
1176
1177    /**
1178     * @param value {@link #serviceCategory} (Identifies the broad category of service being performed or delivered.)
1179     */
1180    public HealthcareService setServiceCategory(CodeableConcept value) { 
1181      this.serviceCategory = value;
1182      return this;
1183    }
1184
1185    /**
1186     * @return {@link #serviceType} (A specific type of service that may be delivered or performed.)
1187     */
1188    public List<ServiceTypeComponent> getServiceType() { 
1189      if (this.serviceType == null)
1190        this.serviceType = new ArrayList<ServiceTypeComponent>();
1191      return this.serviceType;
1192    }
1193
1194    public boolean hasServiceType() { 
1195      if (this.serviceType == null)
1196        return false;
1197      for (ServiceTypeComponent item : this.serviceType)
1198        if (!item.isEmpty())
1199          return true;
1200      return false;
1201    }
1202
1203    /**
1204     * @return {@link #serviceType} (A specific type of service that may be delivered or performed.)
1205     */
1206    // syntactic sugar
1207    public ServiceTypeComponent addServiceType() { //3
1208      ServiceTypeComponent t = new ServiceTypeComponent();
1209      if (this.serviceType == null)
1210        this.serviceType = new ArrayList<ServiceTypeComponent>();
1211      this.serviceType.add(t);
1212      return t;
1213    }
1214
1215    // syntactic sugar
1216    public HealthcareService addServiceType(ServiceTypeComponent t) { //3
1217      if (t == null)
1218        return this;
1219      if (this.serviceType == null)
1220        this.serviceType = new ArrayList<ServiceTypeComponent>();
1221      this.serviceType.add(t);
1222      return this;
1223    }
1224
1225    /**
1226     * @return {@link #location} (The location where this healthcare service may be provided.)
1227     */
1228    public Reference getLocation() { 
1229      if (this.location == null)
1230        if (Configuration.errorOnAutoCreate())
1231          throw new Error("Attempt to auto-create HealthcareService.location");
1232        else if (Configuration.doAutoCreate())
1233          this.location = new Reference(); // cc
1234      return this.location;
1235    }
1236
1237    public boolean hasLocation() { 
1238      return this.location != null && !this.location.isEmpty();
1239    }
1240
1241    /**
1242     * @param value {@link #location} (The location where this healthcare service may be provided.)
1243     */
1244    public HealthcareService setLocation(Reference value) { 
1245      this.location = value;
1246      return this;
1247    }
1248
1249    /**
1250     * @return {@link #location} 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. (The location where this healthcare service may be provided.)
1251     */
1252    public Location getLocationTarget() { 
1253      if (this.locationTarget == null)
1254        if (Configuration.errorOnAutoCreate())
1255          throw new Error("Attempt to auto-create HealthcareService.location");
1256        else if (Configuration.doAutoCreate())
1257          this.locationTarget = new Location(); // aa
1258      return this.locationTarget;
1259    }
1260
1261    /**
1262     * @param value {@link #location} 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. (The location where this healthcare service may be provided.)
1263     */
1264    public HealthcareService setLocationTarget(Location value) { 
1265      this.locationTarget = value;
1266      return this;
1267    }
1268
1269    /**
1270     * @return {@link #serviceName} (Further description of the service as it would be presented to a consumer while searching.). This is the underlying object with id, value and extensions. The accessor "getServiceName" gives direct access to the value
1271     */
1272    public StringType getServiceNameElement() { 
1273      if (this.serviceName == null)
1274        if (Configuration.errorOnAutoCreate())
1275          throw new Error("Attempt to auto-create HealthcareService.serviceName");
1276        else if (Configuration.doAutoCreate())
1277          this.serviceName = new StringType(); // bb
1278      return this.serviceName;
1279    }
1280
1281    public boolean hasServiceNameElement() { 
1282      return this.serviceName != null && !this.serviceName.isEmpty();
1283    }
1284
1285    public boolean hasServiceName() { 
1286      return this.serviceName != null && !this.serviceName.isEmpty();
1287    }
1288
1289    /**
1290     * @param value {@link #serviceName} (Further description of the service as it would be presented to a consumer while searching.). This is the underlying object with id, value and extensions. The accessor "getServiceName" gives direct access to the value
1291     */
1292    public HealthcareService setServiceNameElement(StringType value) { 
1293      this.serviceName = value;
1294      return this;
1295    }
1296
1297    /**
1298     * @return Further description of the service as it would be presented to a consumer while searching.
1299     */
1300    public String getServiceName() { 
1301      return this.serviceName == null ? null : this.serviceName.getValue();
1302    }
1303
1304    /**
1305     * @param value Further description of the service as it would be presented to a consumer while searching.
1306     */
1307    public HealthcareService setServiceName(String value) { 
1308      if (Utilities.noString(value))
1309        this.serviceName = null;
1310      else {
1311        if (this.serviceName == null)
1312          this.serviceName = new StringType();
1313        this.serviceName.setValue(value);
1314      }
1315      return this;
1316    }
1317
1318    /**
1319     * @return {@link #comment} (Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1320     */
1321    public StringType getCommentElement() { 
1322      if (this.comment == null)
1323        if (Configuration.errorOnAutoCreate())
1324          throw new Error("Attempt to auto-create HealthcareService.comment");
1325        else if (Configuration.doAutoCreate())
1326          this.comment = new StringType(); // bb
1327      return this.comment;
1328    }
1329
1330    public boolean hasCommentElement() { 
1331      return this.comment != null && !this.comment.isEmpty();
1332    }
1333
1334    public boolean hasComment() { 
1335      return this.comment != null && !this.comment.isEmpty();
1336    }
1337
1338    /**
1339     * @param value {@link #comment} (Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1340     */
1341    public HealthcareService setCommentElement(StringType value) { 
1342      this.comment = value;
1343      return this;
1344    }
1345
1346    /**
1347     * @return Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName.
1348     */
1349    public String getComment() { 
1350      return this.comment == null ? null : this.comment.getValue();
1351    }
1352
1353    /**
1354     * @param value Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName.
1355     */
1356    public HealthcareService setComment(String value) { 
1357      if (Utilities.noString(value))
1358        this.comment = null;
1359      else {
1360        if (this.comment == null)
1361          this.comment = new StringType();
1362        this.comment.setValue(value);
1363      }
1364      return this;
1365    }
1366
1367    /**
1368     * @return {@link #extraDetails} (Extra details about the service that can't be placed in the other fields.). This is the underlying object with id, value and extensions. The accessor "getExtraDetails" gives direct access to the value
1369     */
1370    public StringType getExtraDetailsElement() { 
1371      if (this.extraDetails == null)
1372        if (Configuration.errorOnAutoCreate())
1373          throw new Error("Attempt to auto-create HealthcareService.extraDetails");
1374        else if (Configuration.doAutoCreate())
1375          this.extraDetails = new StringType(); // bb
1376      return this.extraDetails;
1377    }
1378
1379    public boolean hasExtraDetailsElement() { 
1380      return this.extraDetails != null && !this.extraDetails.isEmpty();
1381    }
1382
1383    public boolean hasExtraDetails() { 
1384      return this.extraDetails != null && !this.extraDetails.isEmpty();
1385    }
1386
1387    /**
1388     * @param value {@link #extraDetails} (Extra details about the service that can't be placed in the other fields.). This is the underlying object with id, value and extensions. The accessor "getExtraDetails" gives direct access to the value
1389     */
1390    public HealthcareService setExtraDetailsElement(StringType value) { 
1391      this.extraDetails = value;
1392      return this;
1393    }
1394
1395    /**
1396     * @return Extra details about the service that can't be placed in the other fields.
1397     */
1398    public String getExtraDetails() { 
1399      return this.extraDetails == null ? null : this.extraDetails.getValue();
1400    }
1401
1402    /**
1403     * @param value Extra details about the service that can't be placed in the other fields.
1404     */
1405    public HealthcareService setExtraDetails(String value) { 
1406      if (Utilities.noString(value))
1407        this.extraDetails = null;
1408      else {
1409        if (this.extraDetails == null)
1410          this.extraDetails = new StringType();
1411        this.extraDetails.setValue(value);
1412      }
1413      return this;
1414    }
1415
1416    /**
1417     * @return {@link #photo} (If there is a photo/symbol associated with this HealthcareService, it may be included here to facilitate quick identification of the service in a list.)
1418     */
1419    public Attachment getPhoto() { 
1420      if (this.photo == null)
1421        if (Configuration.errorOnAutoCreate())
1422          throw new Error("Attempt to auto-create HealthcareService.photo");
1423        else if (Configuration.doAutoCreate())
1424          this.photo = new Attachment(); // cc
1425      return this.photo;
1426    }
1427
1428    public boolean hasPhoto() { 
1429      return this.photo != null && !this.photo.isEmpty();
1430    }
1431
1432    /**
1433     * @param value {@link #photo} (If there is a photo/symbol associated with this HealthcareService, it may be included here to facilitate quick identification of the service in a list.)
1434     */
1435    public HealthcareService setPhoto(Attachment value) { 
1436      this.photo = value;
1437      return this;
1438    }
1439
1440    /**
1441     * @return {@link #telecom} (List of contacts related to this specific healthcare service.)
1442     */
1443    public List<ContactPoint> getTelecom() { 
1444      if (this.telecom == null)
1445        this.telecom = new ArrayList<ContactPoint>();
1446      return this.telecom;
1447    }
1448
1449    public boolean hasTelecom() { 
1450      if (this.telecom == null)
1451        return false;
1452      for (ContactPoint item : this.telecom)
1453        if (!item.isEmpty())
1454          return true;
1455      return false;
1456    }
1457
1458    /**
1459     * @return {@link #telecom} (List of contacts related to this specific healthcare service.)
1460     */
1461    // syntactic sugar
1462    public ContactPoint addTelecom() { //3
1463      ContactPoint t = new ContactPoint();
1464      if (this.telecom == null)
1465        this.telecom = new ArrayList<ContactPoint>();
1466      this.telecom.add(t);
1467      return t;
1468    }
1469
1470    // syntactic sugar
1471    public HealthcareService addTelecom(ContactPoint t) { //3
1472      if (t == null)
1473        return this;
1474      if (this.telecom == null)
1475        this.telecom = new ArrayList<ContactPoint>();
1476      this.telecom.add(t);
1477      return this;
1478    }
1479
1480    /**
1481     * @return {@link #coverageArea} (The location(s) that this service is available to (not where the service is provided).)
1482     */
1483    public List<Reference> getCoverageArea() { 
1484      if (this.coverageArea == null)
1485        this.coverageArea = new ArrayList<Reference>();
1486      return this.coverageArea;
1487    }
1488
1489    public boolean hasCoverageArea() { 
1490      if (this.coverageArea == null)
1491        return false;
1492      for (Reference item : this.coverageArea)
1493        if (!item.isEmpty())
1494          return true;
1495      return false;
1496    }
1497
1498    /**
1499     * @return {@link #coverageArea} (The location(s) that this service is available to (not where the service is provided).)
1500     */
1501    // syntactic sugar
1502    public Reference addCoverageArea() { //3
1503      Reference t = new Reference();
1504      if (this.coverageArea == null)
1505        this.coverageArea = new ArrayList<Reference>();
1506      this.coverageArea.add(t);
1507      return t;
1508    }
1509
1510    // syntactic sugar
1511    public HealthcareService addCoverageArea(Reference t) { //3
1512      if (t == null)
1513        return this;
1514      if (this.coverageArea == null)
1515        this.coverageArea = new ArrayList<Reference>();
1516      this.coverageArea.add(t);
1517      return this;
1518    }
1519
1520    /**
1521     * @return {@link #coverageArea} (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 location(s) that this service is available to (not where the service is provided).)
1522     */
1523    public List<Location> getCoverageAreaTarget() { 
1524      if (this.coverageAreaTarget == null)
1525        this.coverageAreaTarget = new ArrayList<Location>();
1526      return this.coverageAreaTarget;
1527    }
1528
1529    // syntactic sugar
1530    /**
1531     * @return {@link #coverageArea} (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 location(s) that this service is available to (not where the service is provided).)
1532     */
1533    public Location addCoverageAreaTarget() { 
1534      Location r = new Location();
1535      if (this.coverageAreaTarget == null)
1536        this.coverageAreaTarget = new ArrayList<Location>();
1537      this.coverageAreaTarget.add(r);
1538      return r;
1539    }
1540
1541    /**
1542     * @return {@link #serviceProvisionCode} (The code(s) that detail the conditions under which the healthcare service is available/offered.)
1543     */
1544    public List<CodeableConcept> getServiceProvisionCode() { 
1545      if (this.serviceProvisionCode == null)
1546        this.serviceProvisionCode = new ArrayList<CodeableConcept>();
1547      return this.serviceProvisionCode;
1548    }
1549
1550    public boolean hasServiceProvisionCode() { 
1551      if (this.serviceProvisionCode == null)
1552        return false;
1553      for (CodeableConcept item : this.serviceProvisionCode)
1554        if (!item.isEmpty())
1555          return true;
1556      return false;
1557    }
1558
1559    /**
1560     * @return {@link #serviceProvisionCode} (The code(s) that detail the conditions under which the healthcare service is available/offered.)
1561     */
1562    // syntactic sugar
1563    public CodeableConcept addServiceProvisionCode() { //3
1564      CodeableConcept t = new CodeableConcept();
1565      if (this.serviceProvisionCode == null)
1566        this.serviceProvisionCode = new ArrayList<CodeableConcept>();
1567      this.serviceProvisionCode.add(t);
1568      return t;
1569    }
1570
1571    // syntactic sugar
1572    public HealthcareService addServiceProvisionCode(CodeableConcept t) { //3
1573      if (t == null)
1574        return this;
1575      if (this.serviceProvisionCode == null)
1576        this.serviceProvisionCode = new ArrayList<CodeableConcept>();
1577      this.serviceProvisionCode.add(t);
1578      return this;
1579    }
1580
1581    /**
1582     * @return {@link #eligibility} (Does this service have specific eligibility requirements that need to be met in order to use the service?)
1583     */
1584    public CodeableConcept getEligibility() { 
1585      if (this.eligibility == null)
1586        if (Configuration.errorOnAutoCreate())
1587          throw new Error("Attempt to auto-create HealthcareService.eligibility");
1588        else if (Configuration.doAutoCreate())
1589          this.eligibility = new CodeableConcept(); // cc
1590      return this.eligibility;
1591    }
1592
1593    public boolean hasEligibility() { 
1594      return this.eligibility != null && !this.eligibility.isEmpty();
1595    }
1596
1597    /**
1598     * @param value {@link #eligibility} (Does this service have specific eligibility requirements that need to be met in order to use the service?)
1599     */
1600    public HealthcareService setEligibility(CodeableConcept value) { 
1601      this.eligibility = value;
1602      return this;
1603    }
1604
1605    /**
1606     * @return {@link #eligibilityNote} (Describes the eligibility conditions for the service.). This is the underlying object with id, value and extensions. The accessor "getEligibilityNote" gives direct access to the value
1607     */
1608    public StringType getEligibilityNoteElement() { 
1609      if (this.eligibilityNote == null)
1610        if (Configuration.errorOnAutoCreate())
1611          throw new Error("Attempt to auto-create HealthcareService.eligibilityNote");
1612        else if (Configuration.doAutoCreate())
1613          this.eligibilityNote = new StringType(); // bb
1614      return this.eligibilityNote;
1615    }
1616
1617    public boolean hasEligibilityNoteElement() { 
1618      return this.eligibilityNote != null && !this.eligibilityNote.isEmpty();
1619    }
1620
1621    public boolean hasEligibilityNote() { 
1622      return this.eligibilityNote != null && !this.eligibilityNote.isEmpty();
1623    }
1624
1625    /**
1626     * @param value {@link #eligibilityNote} (Describes the eligibility conditions for the service.). This is the underlying object with id, value and extensions. The accessor "getEligibilityNote" gives direct access to the value
1627     */
1628    public HealthcareService setEligibilityNoteElement(StringType value) { 
1629      this.eligibilityNote = value;
1630      return this;
1631    }
1632
1633    /**
1634     * @return Describes the eligibility conditions for the service.
1635     */
1636    public String getEligibilityNote() { 
1637      return this.eligibilityNote == null ? null : this.eligibilityNote.getValue();
1638    }
1639
1640    /**
1641     * @param value Describes the eligibility conditions for the service.
1642     */
1643    public HealthcareService setEligibilityNote(String value) { 
1644      if (Utilities.noString(value))
1645        this.eligibilityNote = null;
1646      else {
1647        if (this.eligibilityNote == null)
1648          this.eligibilityNote = new StringType();
1649        this.eligibilityNote.setValue(value);
1650      }
1651      return this;
1652    }
1653
1654    /**
1655     * @return {@link #programName} (Program Names that can be used to categorize the service.)
1656     */
1657    public List<StringType> getProgramName() { 
1658      if (this.programName == null)
1659        this.programName = new ArrayList<StringType>();
1660      return this.programName;
1661    }
1662
1663    public boolean hasProgramName() { 
1664      if (this.programName == null)
1665        return false;
1666      for (StringType item : this.programName)
1667        if (!item.isEmpty())
1668          return true;
1669      return false;
1670    }
1671
1672    /**
1673     * @return {@link #programName} (Program Names that can be used to categorize the service.)
1674     */
1675    // syntactic sugar
1676    public StringType addProgramNameElement() {//2 
1677      StringType t = new StringType();
1678      if (this.programName == null)
1679        this.programName = new ArrayList<StringType>();
1680      this.programName.add(t);
1681      return t;
1682    }
1683
1684    /**
1685     * @param value {@link #programName} (Program Names that can be used to categorize the service.)
1686     */
1687    public HealthcareService addProgramName(String value) { //1
1688      StringType t = new StringType();
1689      t.setValue(value);
1690      if (this.programName == null)
1691        this.programName = new ArrayList<StringType>();
1692      this.programName.add(t);
1693      return this;
1694    }
1695
1696    /**
1697     * @param value {@link #programName} (Program Names that can be used to categorize the service.)
1698     */
1699    public boolean hasProgramName(String value) { 
1700      if (this.programName == null)
1701        return false;
1702      for (StringType v : this.programName)
1703        if (v.equals(value)) // string
1704          return true;
1705      return false;
1706    }
1707
1708    /**
1709     * @return {@link #characteristic} (Collection of characteristics (attributes).)
1710     */
1711    public List<CodeableConcept> getCharacteristic() { 
1712      if (this.characteristic == null)
1713        this.characteristic = new ArrayList<CodeableConcept>();
1714      return this.characteristic;
1715    }
1716
1717    public boolean hasCharacteristic() { 
1718      if (this.characteristic == null)
1719        return false;
1720      for (CodeableConcept item : this.characteristic)
1721        if (!item.isEmpty())
1722          return true;
1723      return false;
1724    }
1725
1726    /**
1727     * @return {@link #characteristic} (Collection of characteristics (attributes).)
1728     */
1729    // syntactic sugar
1730    public CodeableConcept addCharacteristic() { //3
1731      CodeableConcept t = new CodeableConcept();
1732      if (this.characteristic == null)
1733        this.characteristic = new ArrayList<CodeableConcept>();
1734      this.characteristic.add(t);
1735      return t;
1736    }
1737
1738    // syntactic sugar
1739    public HealthcareService addCharacteristic(CodeableConcept t) { //3
1740      if (t == null)
1741        return this;
1742      if (this.characteristic == null)
1743        this.characteristic = new ArrayList<CodeableConcept>();
1744      this.characteristic.add(t);
1745      return this;
1746    }
1747
1748    /**
1749     * @return {@link #referralMethod} (Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required.)
1750     */
1751    public List<CodeableConcept> getReferralMethod() { 
1752      if (this.referralMethod == null)
1753        this.referralMethod = new ArrayList<CodeableConcept>();
1754      return this.referralMethod;
1755    }
1756
1757    public boolean hasReferralMethod() { 
1758      if (this.referralMethod == null)
1759        return false;
1760      for (CodeableConcept item : this.referralMethod)
1761        if (!item.isEmpty())
1762          return true;
1763      return false;
1764    }
1765
1766    /**
1767     * @return {@link #referralMethod} (Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required.)
1768     */
1769    // syntactic sugar
1770    public CodeableConcept addReferralMethod() { //3
1771      CodeableConcept t = new CodeableConcept();
1772      if (this.referralMethod == null)
1773        this.referralMethod = new ArrayList<CodeableConcept>();
1774      this.referralMethod.add(t);
1775      return t;
1776    }
1777
1778    // syntactic sugar
1779    public HealthcareService addReferralMethod(CodeableConcept t) { //3
1780      if (t == null)
1781        return this;
1782      if (this.referralMethod == null)
1783        this.referralMethod = new ArrayList<CodeableConcept>();
1784      this.referralMethod.add(t);
1785      return this;
1786    }
1787
1788    /**
1789     * @return {@link #publicKey} (The public part of the 'keys' allocated to an Organization by an accredited body to support secure exchange of data over the internet. To be provided by the Organization, where available.). This is the underlying object with id, value and extensions. The accessor "getPublicKey" gives direct access to the value
1790     */
1791    public StringType getPublicKeyElement() { 
1792      if (this.publicKey == null)
1793        if (Configuration.errorOnAutoCreate())
1794          throw new Error("Attempt to auto-create HealthcareService.publicKey");
1795        else if (Configuration.doAutoCreate())
1796          this.publicKey = new StringType(); // bb
1797      return this.publicKey;
1798    }
1799
1800    public boolean hasPublicKeyElement() { 
1801      return this.publicKey != null && !this.publicKey.isEmpty();
1802    }
1803
1804    public boolean hasPublicKey() { 
1805      return this.publicKey != null && !this.publicKey.isEmpty();
1806    }
1807
1808    /**
1809     * @param value {@link #publicKey} (The public part of the 'keys' allocated to an Organization by an accredited body to support secure exchange of data over the internet. To be provided by the Organization, where available.). This is the underlying object with id, value and extensions. The accessor "getPublicKey" gives direct access to the value
1810     */
1811    public HealthcareService setPublicKeyElement(StringType value) { 
1812      this.publicKey = value;
1813      return this;
1814    }
1815
1816    /**
1817     * @return The public part of the 'keys' allocated to an Organization by an accredited body to support secure exchange of data over the internet. To be provided by the Organization, where available.
1818     */
1819    public String getPublicKey() { 
1820      return this.publicKey == null ? null : this.publicKey.getValue();
1821    }
1822
1823    /**
1824     * @param value The public part of the 'keys' allocated to an Organization by an accredited body to support secure exchange of data over the internet. To be provided by the Organization, where available.
1825     */
1826    public HealthcareService setPublicKey(String value) { 
1827      if (Utilities.noString(value))
1828        this.publicKey = null;
1829      else {
1830        if (this.publicKey == null)
1831          this.publicKey = new StringType();
1832        this.publicKey.setValue(value);
1833      }
1834      return this;
1835    }
1836
1837    /**
1838     * @return {@link #appointmentRequired} (Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service.). This is the underlying object with id, value and extensions. The accessor "getAppointmentRequired" gives direct access to the value
1839     */
1840    public BooleanType getAppointmentRequiredElement() { 
1841      if (this.appointmentRequired == null)
1842        if (Configuration.errorOnAutoCreate())
1843          throw new Error("Attempt to auto-create HealthcareService.appointmentRequired");
1844        else if (Configuration.doAutoCreate())
1845          this.appointmentRequired = new BooleanType(); // bb
1846      return this.appointmentRequired;
1847    }
1848
1849    public boolean hasAppointmentRequiredElement() { 
1850      return this.appointmentRequired != null && !this.appointmentRequired.isEmpty();
1851    }
1852
1853    public boolean hasAppointmentRequired() { 
1854      return this.appointmentRequired != null && !this.appointmentRequired.isEmpty();
1855    }
1856
1857    /**
1858     * @param value {@link #appointmentRequired} (Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service.). This is the underlying object with id, value and extensions. The accessor "getAppointmentRequired" gives direct access to the value
1859     */
1860    public HealthcareService setAppointmentRequiredElement(BooleanType value) { 
1861      this.appointmentRequired = value;
1862      return this;
1863    }
1864
1865    /**
1866     * @return Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service.
1867     */
1868    public boolean getAppointmentRequired() { 
1869      return this.appointmentRequired == null || this.appointmentRequired.isEmpty() ? false : this.appointmentRequired.getValue();
1870    }
1871
1872    /**
1873     * @param value Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service.
1874     */
1875    public HealthcareService setAppointmentRequired(boolean value) { 
1876        if (this.appointmentRequired == null)
1877          this.appointmentRequired = new BooleanType();
1878        this.appointmentRequired.setValue(value);
1879      return this;
1880    }
1881
1882    /**
1883     * @return {@link #availableTime} (A collection of times that the Service Site is available.)
1884     */
1885    public List<HealthcareServiceAvailableTimeComponent> getAvailableTime() { 
1886      if (this.availableTime == null)
1887        this.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
1888      return this.availableTime;
1889    }
1890
1891    public boolean hasAvailableTime() { 
1892      if (this.availableTime == null)
1893        return false;
1894      for (HealthcareServiceAvailableTimeComponent item : this.availableTime)
1895        if (!item.isEmpty())
1896          return true;
1897      return false;
1898    }
1899
1900    /**
1901     * @return {@link #availableTime} (A collection of times that the Service Site is available.)
1902     */
1903    // syntactic sugar
1904    public HealthcareServiceAvailableTimeComponent addAvailableTime() { //3
1905      HealthcareServiceAvailableTimeComponent t = new HealthcareServiceAvailableTimeComponent();
1906      if (this.availableTime == null)
1907        this.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
1908      this.availableTime.add(t);
1909      return t;
1910    }
1911
1912    // syntactic sugar
1913    public HealthcareService addAvailableTime(HealthcareServiceAvailableTimeComponent t) { //3
1914      if (t == null)
1915        return this;
1916      if (this.availableTime == null)
1917        this.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
1918      this.availableTime.add(t);
1919      return this;
1920    }
1921
1922    /**
1923     * @return {@link #notAvailable} (The HealthcareService is not available during this period of time due to the provided reason.)
1924     */
1925    public List<HealthcareServiceNotAvailableComponent> getNotAvailable() { 
1926      if (this.notAvailable == null)
1927        this.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
1928      return this.notAvailable;
1929    }
1930
1931    public boolean hasNotAvailable() { 
1932      if (this.notAvailable == null)
1933        return false;
1934      for (HealthcareServiceNotAvailableComponent item : this.notAvailable)
1935        if (!item.isEmpty())
1936          return true;
1937      return false;
1938    }
1939
1940    /**
1941     * @return {@link #notAvailable} (The HealthcareService is not available during this period of time due to the provided reason.)
1942     */
1943    // syntactic sugar
1944    public HealthcareServiceNotAvailableComponent addNotAvailable() { //3
1945      HealthcareServiceNotAvailableComponent t = new HealthcareServiceNotAvailableComponent();
1946      if (this.notAvailable == null)
1947        this.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
1948      this.notAvailable.add(t);
1949      return t;
1950    }
1951
1952    // syntactic sugar
1953    public HealthcareService addNotAvailable(HealthcareServiceNotAvailableComponent t) { //3
1954      if (t == null)
1955        return this;
1956      if (this.notAvailable == null)
1957        this.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
1958      this.notAvailable.add(t);
1959      return this;
1960    }
1961
1962    /**
1963     * @return {@link #availabilityExceptions} (A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.). This is the underlying object with id, value and extensions. The accessor "getAvailabilityExceptions" gives direct access to the value
1964     */
1965    public StringType getAvailabilityExceptionsElement() { 
1966      if (this.availabilityExceptions == null)
1967        if (Configuration.errorOnAutoCreate())
1968          throw new Error("Attempt to auto-create HealthcareService.availabilityExceptions");
1969        else if (Configuration.doAutoCreate())
1970          this.availabilityExceptions = new StringType(); // bb
1971      return this.availabilityExceptions;
1972    }
1973
1974    public boolean hasAvailabilityExceptionsElement() { 
1975      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
1976    }
1977
1978    public boolean hasAvailabilityExceptions() { 
1979      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
1980    }
1981
1982    /**
1983     * @param value {@link #availabilityExceptions} (A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.). This is the underlying object with id, value and extensions. The accessor "getAvailabilityExceptions" gives direct access to the value
1984     */
1985    public HealthcareService setAvailabilityExceptionsElement(StringType value) { 
1986      this.availabilityExceptions = value;
1987      return this;
1988    }
1989
1990    /**
1991     * @return A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.
1992     */
1993    public String getAvailabilityExceptions() { 
1994      return this.availabilityExceptions == null ? null : this.availabilityExceptions.getValue();
1995    }
1996
1997    /**
1998     * @param value A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.
1999     */
2000    public HealthcareService setAvailabilityExceptions(String value) { 
2001      if (Utilities.noString(value))
2002        this.availabilityExceptions = null;
2003      else {
2004        if (this.availabilityExceptions == null)
2005          this.availabilityExceptions = new StringType();
2006        this.availabilityExceptions.setValue(value);
2007      }
2008      return this;
2009    }
2010
2011      protected void listChildren(List<Property> childrenList) {
2012        super.listChildren(childrenList);
2013        childrenList.add(new Property("identifier", "Identifier", "External identifiers for this item.", 0, java.lang.Integer.MAX_VALUE, identifier));
2014        childrenList.add(new Property("providedBy", "Reference(Organization)", "The organization that provides this healthcare service.", 0, java.lang.Integer.MAX_VALUE, providedBy));
2015        childrenList.add(new Property("serviceCategory", "CodeableConcept", "Identifies the broad category of service being performed or delivered.", 0, java.lang.Integer.MAX_VALUE, serviceCategory));
2016        childrenList.add(new Property("serviceType", "", "A specific type of service that may be delivered or performed.", 0, java.lang.Integer.MAX_VALUE, serviceType));
2017        childrenList.add(new Property("location", "Reference(Location)", "The location where this healthcare service may be provided.", 0, java.lang.Integer.MAX_VALUE, location));
2018        childrenList.add(new Property("serviceName", "string", "Further description of the service as it would be presented to a consumer while searching.", 0, java.lang.Integer.MAX_VALUE, serviceName));
2019        childrenList.add(new Property("comment", "string", "Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName.", 0, java.lang.Integer.MAX_VALUE, comment));
2020        childrenList.add(new Property("extraDetails", "string", "Extra details about the service that can't be placed in the other fields.", 0, java.lang.Integer.MAX_VALUE, extraDetails));
2021        childrenList.add(new Property("photo", "Attachment", "If there is a photo/symbol associated with this HealthcareService, it may be included here to facilitate quick identification of the service in a list.", 0, java.lang.Integer.MAX_VALUE, photo));
2022        childrenList.add(new Property("telecom", "ContactPoint", "List of contacts related to this specific healthcare service.", 0, java.lang.Integer.MAX_VALUE, telecom));
2023        childrenList.add(new Property("coverageArea", "Reference(Location)", "The location(s) that this service is available to (not where the service is provided).", 0, java.lang.Integer.MAX_VALUE, coverageArea));
2024        childrenList.add(new Property("serviceProvisionCode", "CodeableConcept", "The code(s) that detail the conditions under which the healthcare service is available/offered.", 0, java.lang.Integer.MAX_VALUE, serviceProvisionCode));
2025        childrenList.add(new Property("eligibility", "CodeableConcept", "Does this service have specific eligibility requirements that need to be met in order to use the service?", 0, java.lang.Integer.MAX_VALUE, eligibility));
2026        childrenList.add(new Property("eligibilityNote", "string", "Describes the eligibility conditions for the service.", 0, java.lang.Integer.MAX_VALUE, eligibilityNote));
2027        childrenList.add(new Property("programName", "string", "Program Names that can be used to categorize the service.", 0, java.lang.Integer.MAX_VALUE, programName));
2028        childrenList.add(new Property("characteristic", "CodeableConcept", "Collection of characteristics (attributes).", 0, java.lang.Integer.MAX_VALUE, characteristic));
2029        childrenList.add(new Property("referralMethod", "CodeableConcept", "Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required.", 0, java.lang.Integer.MAX_VALUE, referralMethod));
2030        childrenList.add(new Property("publicKey", "string", "The public part of the 'keys' allocated to an Organization by an accredited body to support secure exchange of data over the internet. To be provided by the Organization, where available.", 0, java.lang.Integer.MAX_VALUE, publicKey));
2031        childrenList.add(new Property("appointmentRequired", "boolean", "Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service.", 0, java.lang.Integer.MAX_VALUE, appointmentRequired));
2032        childrenList.add(new Property("availableTime", "", "A collection of times that the Service Site is available.", 0, java.lang.Integer.MAX_VALUE, availableTime));
2033        childrenList.add(new Property("notAvailable", "", "The HealthcareService is not available during this period of time due to the provided reason.", 0, java.lang.Integer.MAX_VALUE, notAvailable));
2034        childrenList.add(new Property("availabilityExceptions", "string", "A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.", 0, java.lang.Integer.MAX_VALUE, availabilityExceptions));
2035      }
2036
2037      @Override
2038      public void setProperty(String name, Base value) throws FHIRException {
2039        if (name.equals("identifier"))
2040          this.getIdentifier().add(castToIdentifier(value));
2041        else if (name.equals("providedBy"))
2042          this.providedBy = castToReference(value); // Reference
2043        else if (name.equals("serviceCategory"))
2044          this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
2045        else if (name.equals("serviceType"))
2046          this.getServiceType().add((ServiceTypeComponent) value);
2047        else if (name.equals("location"))
2048          this.location = castToReference(value); // Reference
2049        else if (name.equals("serviceName"))
2050          this.serviceName = castToString(value); // StringType
2051        else if (name.equals("comment"))
2052          this.comment = castToString(value); // StringType
2053        else if (name.equals("extraDetails"))
2054          this.extraDetails = castToString(value); // StringType
2055        else if (name.equals("photo"))
2056          this.photo = castToAttachment(value); // Attachment
2057        else if (name.equals("telecom"))
2058          this.getTelecom().add(castToContactPoint(value));
2059        else if (name.equals("coverageArea"))
2060          this.getCoverageArea().add(castToReference(value));
2061        else if (name.equals("serviceProvisionCode"))
2062          this.getServiceProvisionCode().add(castToCodeableConcept(value));
2063        else if (name.equals("eligibility"))
2064          this.eligibility = castToCodeableConcept(value); // CodeableConcept
2065        else if (name.equals("eligibilityNote"))
2066          this.eligibilityNote = castToString(value); // StringType
2067        else if (name.equals("programName"))
2068          this.getProgramName().add(castToString(value));
2069        else if (name.equals("characteristic"))
2070          this.getCharacteristic().add(castToCodeableConcept(value));
2071        else if (name.equals("referralMethod"))
2072          this.getReferralMethod().add(castToCodeableConcept(value));
2073        else if (name.equals("publicKey"))
2074          this.publicKey = castToString(value); // StringType
2075        else if (name.equals("appointmentRequired"))
2076          this.appointmentRequired = castToBoolean(value); // BooleanType
2077        else if (name.equals("availableTime"))
2078          this.getAvailableTime().add((HealthcareServiceAvailableTimeComponent) value);
2079        else if (name.equals("notAvailable"))
2080          this.getNotAvailable().add((HealthcareServiceNotAvailableComponent) value);
2081        else if (name.equals("availabilityExceptions"))
2082          this.availabilityExceptions = castToString(value); // StringType
2083        else
2084          super.setProperty(name, value);
2085      }
2086
2087      @Override
2088      public Base addChild(String name) throws FHIRException {
2089        if (name.equals("identifier")) {
2090          return addIdentifier();
2091        }
2092        else if (name.equals("providedBy")) {
2093          this.providedBy = new Reference();
2094          return this.providedBy;
2095        }
2096        else if (name.equals("serviceCategory")) {
2097          this.serviceCategory = new CodeableConcept();
2098          return this.serviceCategory;
2099        }
2100        else if (name.equals("serviceType")) {
2101          return addServiceType();
2102        }
2103        else if (name.equals("location")) {
2104          this.location = new Reference();
2105          return this.location;
2106        }
2107        else if (name.equals("serviceName")) {
2108          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.serviceName");
2109        }
2110        else if (name.equals("comment")) {
2111          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.comment");
2112        }
2113        else if (name.equals("extraDetails")) {
2114          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.extraDetails");
2115        }
2116        else if (name.equals("photo")) {
2117          this.photo = new Attachment();
2118          return this.photo;
2119        }
2120        else if (name.equals("telecom")) {
2121          return addTelecom();
2122        }
2123        else if (name.equals("coverageArea")) {
2124          return addCoverageArea();
2125        }
2126        else if (name.equals("serviceProvisionCode")) {
2127          return addServiceProvisionCode();
2128        }
2129        else if (name.equals("eligibility")) {
2130          this.eligibility = new CodeableConcept();
2131          return this.eligibility;
2132        }
2133        else if (name.equals("eligibilityNote")) {
2134          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.eligibilityNote");
2135        }
2136        else if (name.equals("programName")) {
2137          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.programName");
2138        }
2139        else if (name.equals("characteristic")) {
2140          return addCharacteristic();
2141        }
2142        else if (name.equals("referralMethod")) {
2143          return addReferralMethod();
2144        }
2145        else if (name.equals("publicKey")) {
2146          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.publicKey");
2147        }
2148        else if (name.equals("appointmentRequired")) {
2149          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.appointmentRequired");
2150        }
2151        else if (name.equals("availableTime")) {
2152          return addAvailableTime();
2153        }
2154        else if (name.equals("notAvailable")) {
2155          return addNotAvailable();
2156        }
2157        else if (name.equals("availabilityExceptions")) {
2158          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availabilityExceptions");
2159        }
2160        else
2161          return super.addChild(name);
2162      }
2163
2164  public String fhirType() {
2165    return "HealthcareService";
2166
2167  }
2168
2169      public HealthcareService copy() {
2170        HealthcareService dst = new HealthcareService();
2171        copyValues(dst);
2172        if (identifier != null) {
2173          dst.identifier = new ArrayList<Identifier>();
2174          for (Identifier i : identifier)
2175            dst.identifier.add(i.copy());
2176        };
2177        dst.providedBy = providedBy == null ? null : providedBy.copy();
2178        dst.serviceCategory = serviceCategory == null ? null : serviceCategory.copy();
2179        if (serviceType != null) {
2180          dst.serviceType = new ArrayList<ServiceTypeComponent>();
2181          for (ServiceTypeComponent i : serviceType)
2182            dst.serviceType.add(i.copy());
2183        };
2184        dst.location = location == null ? null : location.copy();
2185        dst.serviceName = serviceName == null ? null : serviceName.copy();
2186        dst.comment = comment == null ? null : comment.copy();
2187        dst.extraDetails = extraDetails == null ? null : extraDetails.copy();
2188        dst.photo = photo == null ? null : photo.copy();
2189        if (telecom != null) {
2190          dst.telecom = new ArrayList<ContactPoint>();
2191          for (ContactPoint i : telecom)
2192            dst.telecom.add(i.copy());
2193        };
2194        if (coverageArea != null) {
2195          dst.coverageArea = new ArrayList<Reference>();
2196          for (Reference i : coverageArea)
2197            dst.coverageArea.add(i.copy());
2198        };
2199        if (serviceProvisionCode != null) {
2200          dst.serviceProvisionCode = new ArrayList<CodeableConcept>();
2201          for (CodeableConcept i : serviceProvisionCode)
2202            dst.serviceProvisionCode.add(i.copy());
2203        };
2204        dst.eligibility = eligibility == null ? null : eligibility.copy();
2205        dst.eligibilityNote = eligibilityNote == null ? null : eligibilityNote.copy();
2206        if (programName != null) {
2207          dst.programName = new ArrayList<StringType>();
2208          for (StringType i : programName)
2209            dst.programName.add(i.copy());
2210        };
2211        if (characteristic != null) {
2212          dst.characteristic = new ArrayList<CodeableConcept>();
2213          for (CodeableConcept i : characteristic)
2214            dst.characteristic.add(i.copy());
2215        };
2216        if (referralMethod != null) {
2217          dst.referralMethod = new ArrayList<CodeableConcept>();
2218          for (CodeableConcept i : referralMethod)
2219            dst.referralMethod.add(i.copy());
2220        };
2221        dst.publicKey = publicKey == null ? null : publicKey.copy();
2222        dst.appointmentRequired = appointmentRequired == null ? null : appointmentRequired.copy();
2223        if (availableTime != null) {
2224          dst.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
2225          for (HealthcareServiceAvailableTimeComponent i : availableTime)
2226            dst.availableTime.add(i.copy());
2227        };
2228        if (notAvailable != null) {
2229          dst.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
2230          for (HealthcareServiceNotAvailableComponent i : notAvailable)
2231            dst.notAvailable.add(i.copy());
2232        };
2233        dst.availabilityExceptions = availabilityExceptions == null ? null : availabilityExceptions.copy();
2234        return dst;
2235      }
2236
2237      protected HealthcareService typedCopy() {
2238        return copy();
2239      }
2240
2241      @Override
2242      public boolean equalsDeep(Base other) {
2243        if (!super.equalsDeep(other))
2244          return false;
2245        if (!(other instanceof HealthcareService))
2246          return false;
2247        HealthcareService o = (HealthcareService) other;
2248        return compareDeep(identifier, o.identifier, true) && compareDeep(providedBy, o.providedBy, true)
2249           && compareDeep(serviceCategory, o.serviceCategory, true) && compareDeep(serviceType, o.serviceType, true)
2250           && compareDeep(location, o.location, true) && compareDeep(serviceName, o.serviceName, true) && compareDeep(comment, o.comment, true)
2251           && compareDeep(extraDetails, o.extraDetails, true) && compareDeep(photo, o.photo, true) && compareDeep(telecom, o.telecom, true)
2252           && compareDeep(coverageArea, o.coverageArea, true) && compareDeep(serviceProvisionCode, o.serviceProvisionCode, true)
2253           && compareDeep(eligibility, o.eligibility, true) && compareDeep(eligibilityNote, o.eligibilityNote, true)
2254           && compareDeep(programName, o.programName, true) && compareDeep(characteristic, o.characteristic, true)
2255           && compareDeep(referralMethod, o.referralMethod, true) && compareDeep(publicKey, o.publicKey, true)
2256           && compareDeep(appointmentRequired, o.appointmentRequired, true) && compareDeep(availableTime, o.availableTime, true)
2257           && compareDeep(notAvailable, o.notAvailable, true) && compareDeep(availabilityExceptions, o.availabilityExceptions, true)
2258          ;
2259      }
2260
2261      @Override
2262      public boolean equalsShallow(Base other) {
2263        if (!super.equalsShallow(other))
2264          return false;
2265        if (!(other instanceof HealthcareService))
2266          return false;
2267        HealthcareService o = (HealthcareService) other;
2268        return compareValues(serviceName, o.serviceName, true) && compareValues(comment, o.comment, true) && compareValues(extraDetails, o.extraDetails, true)
2269           && compareValues(eligibilityNote, o.eligibilityNote, true) && compareValues(programName, o.programName, true)
2270           && compareValues(publicKey, o.publicKey, true) && compareValues(appointmentRequired, o.appointmentRequired, true)
2271           && compareValues(availabilityExceptions, o.availabilityExceptions, true);
2272      }
2273
2274      public boolean isEmpty() {
2275        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (providedBy == null || providedBy.isEmpty())
2276           && (serviceCategory == null || serviceCategory.isEmpty()) && (serviceType == null || serviceType.isEmpty())
2277           && (location == null || location.isEmpty()) && (serviceName == null || serviceName.isEmpty())
2278           && (comment == null || comment.isEmpty()) && (extraDetails == null || extraDetails.isEmpty())
2279           && (photo == null || photo.isEmpty()) && (telecom == null || telecom.isEmpty()) && (coverageArea == null || coverageArea.isEmpty())
2280           && (serviceProvisionCode == null || serviceProvisionCode.isEmpty()) && (eligibility == null || eligibility.isEmpty())
2281           && (eligibilityNote == null || eligibilityNote.isEmpty()) && (programName == null || programName.isEmpty())
2282           && (characteristic == null || characteristic.isEmpty()) && (referralMethod == null || referralMethod.isEmpty())
2283           && (publicKey == null || publicKey.isEmpty()) && (appointmentRequired == null || appointmentRequired.isEmpty())
2284           && (availableTime == null || availableTime.isEmpty()) && (notAvailable == null || notAvailable.isEmpty())
2285           && (availabilityExceptions == null || availabilityExceptions.isEmpty());
2286      }
2287
2288  @Override
2289  public ResourceType getResourceType() {
2290    return ResourceType.HealthcareService;
2291   }
2292
2293  @SearchParamDefinition(name="identifier", path="HealthcareService.identifier", description="External identifiers for this item", type="token" )
2294  public static final String SP_IDENTIFIER = "identifier";
2295  @SearchParamDefinition(name="servicecategory", path="HealthcareService.serviceCategory", description="Service Category of the Healthcare Service", type="token" )
2296  public static final String SP_SERVICECATEGORY = "servicecategory";
2297  @SearchParamDefinition(name="servicetype", path="HealthcareService.serviceType.type", description="The type of service provided by this healthcare service", type="token" )
2298  public static final String SP_SERVICETYPE = "servicetype";
2299  @SearchParamDefinition(name="organization", path="HealthcareService.providedBy", description="The organization that provides this Healthcare Service", type="reference" )
2300  public static final String SP_ORGANIZATION = "organization";
2301  @SearchParamDefinition(name="name", path="HealthcareService.serviceName", description="A portion of the Healthcare service name", type="string" )
2302  public static final String SP_NAME = "name";
2303  @SearchParamDefinition(name="programname", path="HealthcareService.programName", description="One of the Program Names serviced by this HealthcareService", type="string" )
2304  public static final String SP_PROGRAMNAME = "programname";
2305  @SearchParamDefinition(name="location", path="HealthcareService.location", description="The location of the Healthcare Service", type="reference" )
2306  public static final String SP_LOCATION = "location";
2307  @SearchParamDefinition(name="characteristic", path="HealthcareService.characteristic", description="One of the HealthcareService's characteristics", type="token" )
2308  public static final String SP_CHARACTERISTIC = "characteristic";
2309
2310}