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