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