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