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