001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.ChildOrder;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047import org.hl7.fhir.instance.model.api.*;
048import org.hl7.fhir.exceptions.FHIRException;
049/**
050 * The details of a healthcare service available at a location.
051 */
052@ResourceDef(name="HealthcareService", profile="http://hl7.org/fhir/StructureDefinition/HealthcareService")
053public class HealthcareService extends DomainResource {
054
055    public enum DaysOfWeek {
056        /**
057         * Monday.
058         */
059        MON, 
060        /**
061         * Tuesday.
062         */
063        TUE, 
064        /**
065         * Wednesday.
066         */
067        WED, 
068        /**
069         * Thursday.
070         */
071        THU, 
072        /**
073         * Friday.
074         */
075        FRI, 
076        /**
077         * Saturday.
078         */
079        SAT, 
080        /**
081         * Sunday.
082         */
083        SUN, 
084        /**
085         * added to help the parsers with the generic types
086         */
087        NULL;
088        public static DaysOfWeek fromCode(String codeString) throws FHIRException {
089            if (codeString == null || "".equals(codeString))
090                return null;
091        if ("mon".equals(codeString))
092          return MON;
093        if ("tue".equals(codeString))
094          return TUE;
095        if ("wed".equals(codeString))
096          return WED;
097        if ("thu".equals(codeString))
098          return THU;
099        if ("fri".equals(codeString))
100          return FRI;
101        if ("sat".equals(codeString))
102          return SAT;
103        if ("sun".equals(codeString))
104          return SUN;
105        if (Configuration.isAcceptInvalidEnums())
106          return null;
107        else
108          throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
109        }
110        public String toCode() {
111          switch (this) {
112            case MON: return "mon";
113            case TUE: return "tue";
114            case WED: return "wed";
115            case THU: return "thu";
116            case FRI: return "fri";
117            case SAT: return "sat";
118            case SUN: return "sun";
119            default: return "?";
120          }
121        }
122        public String getSystem() {
123          switch (this) {
124            case MON: return "http://hl7.org/fhir/days-of-week";
125            case TUE: return "http://hl7.org/fhir/days-of-week";
126            case WED: return "http://hl7.org/fhir/days-of-week";
127            case THU: return "http://hl7.org/fhir/days-of-week";
128            case FRI: return "http://hl7.org/fhir/days-of-week";
129            case SAT: return "http://hl7.org/fhir/days-of-week";
130            case SUN: return "http://hl7.org/fhir/days-of-week";
131            default: return "?";
132          }
133        }
134        public String getDefinition() {
135          switch (this) {
136            case MON: return "Monday.";
137            case TUE: return "Tuesday.";
138            case WED: return "Wednesday.";
139            case THU: return "Thursday.";
140            case FRI: return "Friday.";
141            case SAT: return "Saturday.";
142            case SUN: return "Sunday.";
143            default: return "?";
144          }
145        }
146        public String getDisplay() {
147          switch (this) {
148            case MON: return "Monday";
149            case TUE: return "Tuesday";
150            case WED: return "Wednesday";
151            case THU: return "Thursday";
152            case FRI: return "Friday";
153            case SAT: return "Saturday";
154            case SUN: return "Sunday";
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)
183            return null;
184          if (code.isEmpty())
185            return new Enumeration<DaysOfWeek>(this);
186          String codeString = ((PrimitiveType) code).asStringValue();
187          if (codeString == null || "".equals(codeString))
188            return null;
189        if ("mon".equals(codeString))
190          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.MON);
191        if ("tue".equals(codeString))
192          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.TUE);
193        if ("wed".equals(codeString))
194          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.WED);
195        if ("thu".equals(codeString))
196          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.THU);
197        if ("fri".equals(codeString))
198          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.FRI);
199        if ("sat".equals(codeString))
200          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SAT);
201        if ("sun".equals(codeString))
202          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SUN);
203        throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
204        }
205    public String toCode(DaysOfWeek code) {
206      if (code == DaysOfWeek.MON)
207        return "mon";
208      if (code == DaysOfWeek.TUE)
209        return "tue";
210      if (code == DaysOfWeek.WED)
211        return "wed";
212      if (code == DaysOfWeek.THU)
213        return "thu";
214      if (code == DaysOfWeek.FRI)
215        return "fri";
216      if (code == DaysOfWeek.SAT)
217        return "sat";
218      if (code == DaysOfWeek.SUN)
219        return "sun";
220      return "?";
221      }
222    public String toSystem(DaysOfWeek code) {
223      return code.getSystem();
224      }
225    }
226
227    @Block()
228    public static class HealthcareServiceEligibilityComponent extends BackboneElement implements IBaseBackboneElement {
229        /**
230         * Coded value for the eligibility.
231         */
232        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
233        @Description(shortDefinition="Coded value for the eligibility", formalDefinition="Coded value for the eligibility." )
234        protected CodeableConcept code;
235
236        /**
237         * Describes the eligibility conditions for the service.
238         */
239        @Child(name = "comment", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
240        @Description(shortDefinition="Describes the eligibility conditions for the service", formalDefinition="Describes the eligibility conditions for the service." )
241        protected MarkdownType comment;
242
243        private static final long serialVersionUID = 1078065348L;
244
245    /**
246     * Constructor
247     */
248      public HealthcareServiceEligibilityComponent() {
249        super();
250      }
251
252        /**
253         * @return {@link #code} (Coded value for the eligibility.)
254         */
255        public CodeableConcept getCode() { 
256          if (this.code == null)
257            if (Configuration.errorOnAutoCreate())
258              throw new Error("Attempt to auto-create HealthcareServiceEligibilityComponent.code");
259            else if (Configuration.doAutoCreate())
260              this.code = new CodeableConcept(); // cc
261          return this.code;
262        }
263
264        public boolean hasCode() { 
265          return this.code != null && !this.code.isEmpty();
266        }
267
268        /**
269         * @param value {@link #code} (Coded value for the eligibility.)
270         */
271        public HealthcareServiceEligibilityComponent setCode(CodeableConcept value) { 
272          this.code = value;
273          return this;
274        }
275
276        /**
277         * @return {@link #comment} (Describes the eligibility conditions for the service.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
278         */
279        public MarkdownType getCommentElement() { 
280          if (this.comment == null)
281            if (Configuration.errorOnAutoCreate())
282              throw new Error("Attempt to auto-create HealthcareServiceEligibilityComponent.comment");
283            else if (Configuration.doAutoCreate())
284              this.comment = new MarkdownType(); // bb
285          return this.comment;
286        }
287
288        public boolean hasCommentElement() { 
289          return this.comment != null && !this.comment.isEmpty();
290        }
291
292        public boolean hasComment() { 
293          return this.comment != null && !this.comment.isEmpty();
294        }
295
296        /**
297         * @param value {@link #comment} (Describes the eligibility conditions for the service.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
298         */
299        public HealthcareServiceEligibilityComponent setCommentElement(MarkdownType value) { 
300          this.comment = value;
301          return this;
302        }
303
304        /**
305         * @return Describes the eligibility conditions for the service.
306         */
307        public String getComment() { 
308          return this.comment == null ? null : this.comment.getValue();
309        }
310
311        /**
312         * @param value Describes the eligibility conditions for the service.
313         */
314        public HealthcareServiceEligibilityComponent setComment(String value) { 
315          if (value == null)
316            this.comment = null;
317          else {
318            if (this.comment == null)
319              this.comment = new MarkdownType();
320            this.comment.setValue(value);
321          }
322          return this;
323        }
324
325        protected void listChildren(List<Property> children) {
326          super.listChildren(children);
327          children.add(new Property("code", "CodeableConcept", "Coded value for the eligibility.", 0, 1, code));
328          children.add(new Property("comment", "markdown", "Describes the eligibility conditions for the service.", 0, 1, comment));
329        }
330
331        @Override
332        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
333          switch (_hash) {
334          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded value for the eligibility.", 0, 1, code);
335          case 950398559: /*comment*/  return new Property("comment", "markdown", "Describes the eligibility conditions for the service.", 0, 1, comment);
336          default: return super.getNamedProperty(_hash, _name, _checkValid);
337          }
338
339        }
340
341      @Override
342      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
343        switch (hash) {
344        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
345        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // MarkdownType
346        default: return super.getProperty(hash, name, checkValid);
347        }
348
349      }
350
351      @Override
352      public Base setProperty(int hash, String name, Base value) throws FHIRException {
353        switch (hash) {
354        case 3059181: // code
355          this.code = castToCodeableConcept(value); // CodeableConcept
356          return value;
357        case 950398559: // comment
358          this.comment = castToMarkdown(value); // MarkdownType
359          return value;
360        default: return super.setProperty(hash, name, value);
361        }
362
363      }
364
365      @Override
366      public Base setProperty(String name, Base value) throws FHIRException {
367        if (name.equals("code")) {
368          this.code = castToCodeableConcept(value); // CodeableConcept
369        } else if (name.equals("comment")) {
370          this.comment = castToMarkdown(value); // MarkdownType
371        } else
372          return super.setProperty(name, value);
373        return value;
374      }
375
376      @Override
377      public Base makeProperty(int hash, String name) throws FHIRException {
378        switch (hash) {
379        case 3059181:  return getCode(); 
380        case 950398559:  return getCommentElement();
381        default: return super.makeProperty(hash, name);
382        }
383
384      }
385
386      @Override
387      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
388        switch (hash) {
389        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
390        case 950398559: /*comment*/ return new String[] {"markdown"};
391        default: return super.getTypesForProperty(hash, name);
392        }
393
394      }
395
396      @Override
397      public Base addChild(String name) throws FHIRException {
398        if (name.equals("code")) {
399          this.code = new CodeableConcept();
400          return this.code;
401        }
402        else if (name.equals("comment")) {
403          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.comment");
404        }
405        else
406          return super.addChild(name);
407      }
408
409      public HealthcareServiceEligibilityComponent copy() {
410        HealthcareServiceEligibilityComponent dst = new HealthcareServiceEligibilityComponent();
411        copyValues(dst);
412        return dst;
413      }
414
415      public void copyValues(HealthcareServiceEligibilityComponent dst) {
416        super.copyValues(dst);
417        dst.code = code == null ? null : code.copy();
418        dst.comment = comment == null ? null : comment.copy();
419      }
420
421      @Override
422      public boolean equalsDeep(Base other_) {
423        if (!super.equalsDeep(other_))
424          return false;
425        if (!(other_ instanceof HealthcareServiceEligibilityComponent))
426          return false;
427        HealthcareServiceEligibilityComponent o = (HealthcareServiceEligibilityComponent) other_;
428        return compareDeep(code, o.code, true) && compareDeep(comment, o.comment, true);
429      }
430
431      @Override
432      public boolean equalsShallow(Base other_) {
433        if (!super.equalsShallow(other_))
434          return false;
435        if (!(other_ instanceof HealthcareServiceEligibilityComponent))
436          return false;
437        HealthcareServiceEligibilityComponent o = (HealthcareServiceEligibilityComponent) other_;
438        return compareValues(comment, o.comment, true);
439      }
440
441      public boolean isEmpty() {
442        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, comment);
443      }
444
445  public String fhirType() {
446    return "HealthcareService.eligibility";
447
448  }
449
450  }
451
452    @Block()
453    public static class HealthcareServiceAvailableTimeComponent extends BackboneElement implements IBaseBackboneElement {
454        /**
455         * Indicates which days of the week are available between the start and end Times.
456         */
457        @Child(name = "daysOfWeek", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
458        @Description(shortDefinition="mon | tue | wed | thu | fri | sat | sun", formalDefinition="Indicates which days of the week are available between the start and end Times." )
459        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/days-of-week")
460        protected List<Enumeration<DaysOfWeek>> daysOfWeek;
461
462        /**
463         * Is this always available? (hence times are irrelevant) e.g. 24 hour service.
464         */
465        @Child(name = "allDay", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
466        @Description(shortDefinition="Always available? e.g. 24 hour service", formalDefinition="Is this always available? (hence times are irrelevant) e.g. 24 hour service." )
467        protected BooleanType allDay;
468
469        /**
470         * The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
471         */
472        @Child(name = "availableStartTime", type = {TimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
473        @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." )
474        protected TimeType availableStartTime;
475
476        /**
477         * The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
478         */
479        @Child(name = "availableEndTime", type = {TimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
480        @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." )
481        protected TimeType availableEndTime;
482
483        private static final long serialVersionUID = -2139510127L;
484
485    /**
486     * Constructor
487     */
488      public HealthcareServiceAvailableTimeComponent() {
489        super();
490      }
491
492        /**
493         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
494         */
495        public List<Enumeration<DaysOfWeek>> getDaysOfWeek() { 
496          if (this.daysOfWeek == null)
497            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
498          return this.daysOfWeek;
499        }
500
501        /**
502         * @return Returns a reference to <code>this</code> for easy method chaining
503         */
504        public HealthcareServiceAvailableTimeComponent setDaysOfWeek(List<Enumeration<DaysOfWeek>> theDaysOfWeek) { 
505          this.daysOfWeek = theDaysOfWeek;
506          return this;
507        }
508
509        public boolean hasDaysOfWeek() { 
510          if (this.daysOfWeek == null)
511            return false;
512          for (Enumeration<DaysOfWeek> item : this.daysOfWeek)
513            if (!item.isEmpty())
514              return true;
515          return false;
516        }
517
518        /**
519         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
520         */
521        public Enumeration<DaysOfWeek> addDaysOfWeekElement() {//2 
522          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
523          if (this.daysOfWeek == null)
524            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
525          this.daysOfWeek.add(t);
526          return t;
527        }
528
529        /**
530         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
531         */
532        public HealthcareServiceAvailableTimeComponent addDaysOfWeek(DaysOfWeek value) { //1
533          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
534          t.setValue(value);
535          if (this.daysOfWeek == null)
536            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
537          this.daysOfWeek.add(t);
538          return this;
539        }
540
541        /**
542         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
543         */
544        public boolean hasDaysOfWeek(DaysOfWeek value) { 
545          if (this.daysOfWeek == null)
546            return false;
547          for (Enumeration<DaysOfWeek> v : this.daysOfWeek)
548            if (v.getValue().equals(value)) // code
549              return true;
550          return false;
551        }
552
553        /**
554         * @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
555         */
556        public BooleanType getAllDayElement() { 
557          if (this.allDay == null)
558            if (Configuration.errorOnAutoCreate())
559              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.allDay");
560            else if (Configuration.doAutoCreate())
561              this.allDay = new BooleanType(); // bb
562          return this.allDay;
563        }
564
565        public boolean hasAllDayElement() { 
566          return this.allDay != null && !this.allDay.isEmpty();
567        }
568
569        public boolean hasAllDay() { 
570          return this.allDay != null && !this.allDay.isEmpty();
571        }
572
573        /**
574         * @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
575         */
576        public HealthcareServiceAvailableTimeComponent setAllDayElement(BooleanType value) { 
577          this.allDay = value;
578          return this;
579        }
580
581        /**
582         * @return Is this always available? (hence times are irrelevant) e.g. 24 hour service.
583         */
584        public boolean getAllDay() { 
585          return this.allDay == null || this.allDay.isEmpty() ? false : this.allDay.getValue();
586        }
587
588        /**
589         * @param value Is this always available? (hence times are irrelevant) e.g. 24 hour service.
590         */
591        public HealthcareServiceAvailableTimeComponent setAllDay(boolean value) { 
592            if (this.allDay == null)
593              this.allDay = new BooleanType();
594            this.allDay.setValue(value);
595          return this;
596        }
597
598        /**
599         * @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
600         */
601        public TimeType getAvailableStartTimeElement() { 
602          if (this.availableStartTime == null)
603            if (Configuration.errorOnAutoCreate())
604              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.availableStartTime");
605            else if (Configuration.doAutoCreate())
606              this.availableStartTime = new TimeType(); // bb
607          return this.availableStartTime;
608        }
609
610        public boolean hasAvailableStartTimeElement() { 
611          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
612        }
613
614        public boolean hasAvailableStartTime() { 
615          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
616        }
617
618        /**
619         * @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
620         */
621        public HealthcareServiceAvailableTimeComponent setAvailableStartTimeElement(TimeType value) { 
622          this.availableStartTime = value;
623          return this;
624        }
625
626        /**
627         * @return The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
628         */
629        public String getAvailableStartTime() { 
630          return this.availableStartTime == null ? null : this.availableStartTime.getValue();
631        }
632
633        /**
634         * @param value The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
635         */
636        public HealthcareServiceAvailableTimeComponent setAvailableStartTime(String value) { 
637          if (value == null)
638            this.availableStartTime = null;
639          else {
640            if (this.availableStartTime == null)
641              this.availableStartTime = new TimeType();
642            this.availableStartTime.setValue(value);
643          }
644          return this;
645        }
646
647        /**
648         * @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
649         */
650        public TimeType getAvailableEndTimeElement() { 
651          if (this.availableEndTime == null)
652            if (Configuration.errorOnAutoCreate())
653              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.availableEndTime");
654            else if (Configuration.doAutoCreate())
655              this.availableEndTime = new TimeType(); // bb
656          return this.availableEndTime;
657        }
658
659        public boolean hasAvailableEndTimeElement() { 
660          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
661        }
662
663        public boolean hasAvailableEndTime() { 
664          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
665        }
666
667        /**
668         * @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
669         */
670        public HealthcareServiceAvailableTimeComponent setAvailableEndTimeElement(TimeType value) { 
671          this.availableEndTime = value;
672          return this;
673        }
674
675        /**
676         * @return The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
677         */
678        public String getAvailableEndTime() { 
679          return this.availableEndTime == null ? null : this.availableEndTime.getValue();
680        }
681
682        /**
683         * @param value The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
684         */
685        public HealthcareServiceAvailableTimeComponent setAvailableEndTime(String value) { 
686          if (value == null)
687            this.availableEndTime = null;
688          else {
689            if (this.availableEndTime == null)
690              this.availableEndTime = new TimeType();
691            this.availableEndTime.setValue(value);
692          }
693          return this;
694        }
695
696        protected void listChildren(List<Property> children) {
697          super.listChildren(children);
698          children.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));
699          children.add(new Property("allDay", "boolean", "Is this always available? (hence times are irrelevant) e.g. 24 hour service.", 0, 1, allDay));
700          children.add(new Property("availableStartTime", "time", "The opening time of day. Note: If the AllDay flag is set, then this time is ignored.", 0, 1, availableStartTime));
701          children.add(new Property("availableEndTime", "time", "The closing time of day. Note: If the AllDay flag is set, then this time is ignored.", 0, 1, availableEndTime));
702        }
703
704        @Override
705        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
706          switch (_hash) {
707          case 68050338: /*daysOfWeek*/  return 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);
708          case -1414913477: /*allDay*/  return new Property("allDay", "boolean", "Is this always available? (hence times are irrelevant) e.g. 24 hour service.", 0, 1, allDay);
709          case -1039453818: /*availableStartTime*/  return new Property("availableStartTime", "time", "The opening time of day. Note: If the AllDay flag is set, then this time is ignored.", 0, 1, availableStartTime);
710          case 101151551: /*availableEndTime*/  return new Property("availableEndTime", "time", "The closing time of day. Note: If the AllDay flag is set, then this time is ignored.", 0, 1, availableEndTime);
711          default: return super.getNamedProperty(_hash, _name, _checkValid);
712          }
713
714        }
715
716      @Override
717      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
718        switch (hash) {
719        case 68050338: /*daysOfWeek*/ return this.daysOfWeek == null ? new Base[0] : this.daysOfWeek.toArray(new Base[this.daysOfWeek.size()]); // Enumeration<DaysOfWeek>
720        case -1414913477: /*allDay*/ return this.allDay == null ? new Base[0] : new Base[] {this.allDay}; // BooleanType
721        case -1039453818: /*availableStartTime*/ return this.availableStartTime == null ? new Base[0] : new Base[] {this.availableStartTime}; // TimeType
722        case 101151551: /*availableEndTime*/ return this.availableEndTime == null ? new Base[0] : new Base[] {this.availableEndTime}; // TimeType
723        default: return super.getProperty(hash, name, checkValid);
724        }
725
726      }
727
728      @Override
729      public Base setProperty(int hash, String name, Base value) throws FHIRException {
730        switch (hash) {
731        case 68050338: // daysOfWeek
732          value = new DaysOfWeekEnumFactory().fromType(castToCode(value));
733          this.getDaysOfWeek().add((Enumeration) value); // Enumeration<DaysOfWeek>
734          return value;
735        case -1414913477: // allDay
736          this.allDay = castToBoolean(value); // BooleanType
737          return value;
738        case -1039453818: // availableStartTime
739          this.availableStartTime = castToTime(value); // TimeType
740          return value;
741        case 101151551: // availableEndTime
742          this.availableEndTime = castToTime(value); // TimeType
743          return value;
744        default: return super.setProperty(hash, name, value);
745        }
746
747      }
748
749      @Override
750      public Base setProperty(String name, Base value) throws FHIRException {
751        if (name.equals("daysOfWeek")) {
752          value = new DaysOfWeekEnumFactory().fromType(castToCode(value));
753          this.getDaysOfWeek().add((Enumeration) value);
754        } else if (name.equals("allDay")) {
755          this.allDay = castToBoolean(value); // BooleanType
756        } else if (name.equals("availableStartTime")) {
757          this.availableStartTime = castToTime(value); // TimeType
758        } else if (name.equals("availableEndTime")) {
759          this.availableEndTime = castToTime(value); // TimeType
760        } else
761          return super.setProperty(name, value);
762        return value;
763      }
764
765      @Override
766      public Base makeProperty(int hash, String name) throws FHIRException {
767        switch (hash) {
768        case 68050338:  return addDaysOfWeekElement();
769        case -1414913477:  return getAllDayElement();
770        case -1039453818:  return getAvailableStartTimeElement();
771        case 101151551:  return getAvailableEndTimeElement();
772        default: return super.makeProperty(hash, name);
773        }
774
775      }
776
777      @Override
778      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
779        switch (hash) {
780        case 68050338: /*daysOfWeek*/ return new String[] {"code"};
781        case -1414913477: /*allDay*/ return new String[] {"boolean"};
782        case -1039453818: /*availableStartTime*/ return new String[] {"time"};
783        case 101151551: /*availableEndTime*/ return new String[] {"time"};
784        default: return super.getTypesForProperty(hash, name);
785        }
786
787      }
788
789      @Override
790      public Base addChild(String name) throws FHIRException {
791        if (name.equals("daysOfWeek")) {
792          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.daysOfWeek");
793        }
794        else if (name.equals("allDay")) {
795          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.allDay");
796        }
797        else if (name.equals("availableStartTime")) {
798          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availableStartTime");
799        }
800        else if (name.equals("availableEndTime")) {
801          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availableEndTime");
802        }
803        else
804          return super.addChild(name);
805      }
806
807      public HealthcareServiceAvailableTimeComponent copy() {
808        HealthcareServiceAvailableTimeComponent dst = new HealthcareServiceAvailableTimeComponent();
809        copyValues(dst);
810        return dst;
811      }
812
813      public void copyValues(HealthcareServiceAvailableTimeComponent dst) {
814        super.copyValues(dst);
815        if (daysOfWeek != null) {
816          dst.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
817          for (Enumeration<DaysOfWeek> i : daysOfWeek)
818            dst.daysOfWeek.add(i.copy());
819        };
820        dst.allDay = allDay == null ? null : allDay.copy();
821        dst.availableStartTime = availableStartTime == null ? null : availableStartTime.copy();
822        dst.availableEndTime = availableEndTime == null ? null : availableEndTime.copy();
823      }
824
825      @Override
826      public boolean equalsDeep(Base other_) {
827        if (!super.equalsDeep(other_))
828          return false;
829        if (!(other_ instanceof HealthcareServiceAvailableTimeComponent))
830          return false;
831        HealthcareServiceAvailableTimeComponent o = (HealthcareServiceAvailableTimeComponent) other_;
832        return compareDeep(daysOfWeek, o.daysOfWeek, true) && compareDeep(allDay, o.allDay, true) && compareDeep(availableStartTime, o.availableStartTime, true)
833           && compareDeep(availableEndTime, o.availableEndTime, true);
834      }
835
836      @Override
837      public boolean equalsShallow(Base other_) {
838        if (!super.equalsShallow(other_))
839          return false;
840        if (!(other_ instanceof HealthcareServiceAvailableTimeComponent))
841          return false;
842        HealthcareServiceAvailableTimeComponent o = (HealthcareServiceAvailableTimeComponent) other_;
843        return compareValues(daysOfWeek, o.daysOfWeek, true) && compareValues(allDay, o.allDay, true) && compareValues(availableStartTime, o.availableStartTime, true)
844           && compareValues(availableEndTime, o.availableEndTime, true);
845      }
846
847      public boolean isEmpty() {
848        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(daysOfWeek, allDay, availableStartTime
849          , availableEndTime);
850      }
851
852  public String fhirType() {
853    return "HealthcareService.availableTime";
854
855  }
856
857  }
858
859    @Block()
860    public static class HealthcareServiceNotAvailableComponent extends BackboneElement implements IBaseBackboneElement {
861        /**
862         * The reason that can be presented to the user as to why this time is not available.
863         */
864        @Child(name = "description", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
865        @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." )
866        protected StringType description;
867
868        /**
869         * Service is not available (seasonally or for a public holiday) from this date.
870         */
871        @Child(name = "during", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
872        @Description(shortDefinition="Service not available from this date", formalDefinition="Service is not available (seasonally or for a public holiday) from this date." )
873        protected Period during;
874
875        private static final long serialVersionUID = 310849929L;
876
877    /**
878     * Constructor
879     */
880      public HealthcareServiceNotAvailableComponent() {
881        super();
882      }
883
884    /**
885     * Constructor
886     */
887      public HealthcareServiceNotAvailableComponent(StringType description) {
888        super();
889        this.description = description;
890      }
891
892        /**
893         * @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
894         */
895        public StringType getDescriptionElement() { 
896          if (this.description == null)
897            if (Configuration.errorOnAutoCreate())
898              throw new Error("Attempt to auto-create HealthcareServiceNotAvailableComponent.description");
899            else if (Configuration.doAutoCreate())
900              this.description = new StringType(); // bb
901          return this.description;
902        }
903
904        public boolean hasDescriptionElement() { 
905          return this.description != null && !this.description.isEmpty();
906        }
907
908        public boolean hasDescription() { 
909          return this.description != null && !this.description.isEmpty();
910        }
911
912        /**
913         * @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
914         */
915        public HealthcareServiceNotAvailableComponent setDescriptionElement(StringType value) { 
916          this.description = value;
917          return this;
918        }
919
920        /**
921         * @return The reason that can be presented to the user as to why this time is not available.
922         */
923        public String getDescription() { 
924          return this.description == null ? null : this.description.getValue();
925        }
926
927        /**
928         * @param value The reason that can be presented to the user as to why this time is not available.
929         */
930        public HealthcareServiceNotAvailableComponent setDescription(String value) { 
931            if (this.description == null)
932              this.description = new StringType();
933            this.description.setValue(value);
934          return this;
935        }
936
937        /**
938         * @return {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
939         */
940        public Period getDuring() { 
941          if (this.during == null)
942            if (Configuration.errorOnAutoCreate())
943              throw new Error("Attempt to auto-create HealthcareServiceNotAvailableComponent.during");
944            else if (Configuration.doAutoCreate())
945              this.during = new Period(); // cc
946          return this.during;
947        }
948
949        public boolean hasDuring() { 
950          return this.during != null && !this.during.isEmpty();
951        }
952
953        /**
954         * @param value {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
955         */
956        public HealthcareServiceNotAvailableComponent setDuring(Period value) { 
957          this.during = value;
958          return this;
959        }
960
961        protected void listChildren(List<Property> children) {
962          super.listChildren(children);
963          children.add(new Property("description", "string", "The reason that can be presented to the user as to why this time is not available.", 0, 1, description));
964          children.add(new Property("during", "Period", "Service is not available (seasonally or for a public holiday) from this date.", 0, 1, during));
965        }
966
967        @Override
968        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
969          switch (_hash) {
970          case -1724546052: /*description*/  return new Property("description", "string", "The reason that can be presented to the user as to why this time is not available.", 0, 1, description);
971          case -1320499647: /*during*/  return new Property("during", "Period", "Service is not available (seasonally or for a public holiday) from this date.", 0, 1, during);
972          default: return super.getNamedProperty(_hash, _name, _checkValid);
973          }
974
975        }
976
977      @Override
978      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
979        switch (hash) {
980        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
981        case -1320499647: /*during*/ return this.during == null ? new Base[0] : new Base[] {this.during}; // Period
982        default: return super.getProperty(hash, name, checkValid);
983        }
984
985      }
986
987      @Override
988      public Base setProperty(int hash, String name, Base value) throws FHIRException {
989        switch (hash) {
990        case -1724546052: // description
991          this.description = castToString(value); // StringType
992          return value;
993        case -1320499647: // during
994          this.during = castToPeriod(value); // Period
995          return value;
996        default: return super.setProperty(hash, name, value);
997        }
998
999      }
1000
1001      @Override
1002      public Base setProperty(String name, Base value) throws FHIRException {
1003        if (name.equals("description")) {
1004          this.description = castToString(value); // StringType
1005        } else if (name.equals("during")) {
1006          this.during = castToPeriod(value); // Period
1007        } else
1008          return super.setProperty(name, value);
1009        return value;
1010      }
1011
1012      @Override
1013      public Base makeProperty(int hash, String name) throws FHIRException {
1014        switch (hash) {
1015        case -1724546052:  return getDescriptionElement();
1016        case -1320499647:  return getDuring(); 
1017        default: return super.makeProperty(hash, name);
1018        }
1019
1020      }
1021
1022      @Override
1023      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1024        switch (hash) {
1025        case -1724546052: /*description*/ return new String[] {"string"};
1026        case -1320499647: /*during*/ return new String[] {"Period"};
1027        default: return super.getTypesForProperty(hash, name);
1028        }
1029
1030      }
1031
1032      @Override
1033      public Base addChild(String name) throws FHIRException {
1034        if (name.equals("description")) {
1035          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.description");
1036        }
1037        else if (name.equals("during")) {
1038          this.during = new Period();
1039          return this.during;
1040        }
1041        else
1042          return super.addChild(name);
1043      }
1044
1045      public HealthcareServiceNotAvailableComponent copy() {
1046        HealthcareServiceNotAvailableComponent dst = new HealthcareServiceNotAvailableComponent();
1047        copyValues(dst);
1048        return dst;
1049      }
1050
1051      public void copyValues(HealthcareServiceNotAvailableComponent dst) {
1052        super.copyValues(dst);
1053        dst.description = description == null ? null : description.copy();
1054        dst.during = during == null ? null : during.copy();
1055      }
1056
1057      @Override
1058      public boolean equalsDeep(Base other_) {
1059        if (!super.equalsDeep(other_))
1060          return false;
1061        if (!(other_ instanceof HealthcareServiceNotAvailableComponent))
1062          return false;
1063        HealthcareServiceNotAvailableComponent o = (HealthcareServiceNotAvailableComponent) other_;
1064        return compareDeep(description, o.description, true) && compareDeep(during, o.during, true);
1065      }
1066
1067      @Override
1068      public boolean equalsShallow(Base other_) {
1069        if (!super.equalsShallow(other_))
1070          return false;
1071        if (!(other_ instanceof HealthcareServiceNotAvailableComponent))
1072          return false;
1073        HealthcareServiceNotAvailableComponent o = (HealthcareServiceNotAvailableComponent) other_;
1074        return compareValues(description, o.description, true);
1075      }
1076
1077      public boolean isEmpty() {
1078        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, during);
1079      }
1080
1081  public String fhirType() {
1082    return "HealthcareService.notAvailable";
1083
1084  }
1085
1086  }
1087
1088    /**
1089     * External identifiers for this item.
1090     */
1091    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1092    @Description(shortDefinition="External identifiers for this item", formalDefinition="External identifiers for this item." )
1093    protected List<Identifier> identifier;
1094
1095    /**
1096     * This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.
1097     */
1098    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1099    @Description(shortDefinition="Whether this HealthcareService record is in active use", formalDefinition="This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this." )
1100    protected BooleanType active;
1101
1102    /**
1103     * The organization that provides this healthcare service.
1104     */
1105    @Child(name = "providedBy", type = {Organization.class}, order=2, min=0, max=1, modifier=false, summary=true)
1106    @Description(shortDefinition="Organization that provides this service", formalDefinition="The organization that provides this healthcare service." )
1107    protected Reference providedBy;
1108
1109    /**
1110     * The actual object that is the target of the reference (The organization that provides this healthcare service.)
1111     */
1112    protected Organization providedByTarget;
1113
1114    /**
1115     * Identifies the broad category of service being performed or delivered.
1116     */
1117    @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1118    @Description(shortDefinition="Broad category of service being performed or delivered", formalDefinition="Identifies the broad category of service being performed or delivered." )
1119    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
1120    protected List<CodeableConcept> category;
1121
1122    /**
1123     * The specific type of service that may be delivered or performed.
1124     */
1125    @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1126    @Description(shortDefinition="Type of service that may be delivered or performed", formalDefinition="The specific type of service that may be delivered or performed." )
1127    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-type")
1128    protected List<CodeableConcept> type;
1129
1130    /**
1131     * Collection of specialties handled by the service site. This is more of a medical term.
1132     */
1133    @Child(name = "specialty", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1134    @Description(shortDefinition="Specialties handled by the HealthcareService", formalDefinition="Collection of specialties handled by the service site. This is more of a medical term." )
1135    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
1136    protected List<CodeableConcept> specialty;
1137
1138    /**
1139     * The location(s) where this healthcare service may be provided.
1140     */
1141    @Child(name = "location", type = {Location.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1142    @Description(shortDefinition="Location(s) where service may be provided", formalDefinition="The location(s) where this healthcare service may be provided." )
1143    protected List<Reference> location;
1144    /**
1145     * The actual objects that are the target of the reference (The location(s) where this healthcare service may be provided.)
1146     */
1147    protected List<Location> locationTarget;
1148
1149
1150    /**
1151     * Further description of the service as it would be presented to a consumer while searching.
1152     */
1153    @Child(name = "name", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1154    @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." )
1155    protected StringType name;
1156
1157    /**
1158     * 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.
1159     */
1160    @Child(name = "comment", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
1161    @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." )
1162    protected StringType comment;
1163
1164    /**
1165     * Extra details about the service that can't be placed in the other fields.
1166     */
1167    @Child(name = "extraDetails", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=false)
1168    @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." )
1169    protected MarkdownType extraDetails;
1170
1171    /**
1172     * 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.
1173     */
1174    @Child(name = "photo", type = {Attachment.class}, order=10, min=0, max=1, modifier=false, summary=true)
1175    @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." )
1176    protected Attachment photo;
1177
1178    /**
1179     * List of contacts related to this specific healthcare service.
1180     */
1181    @Child(name = "telecom", type = {ContactPoint.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1182    @Description(shortDefinition="Contacts related to the healthcare service", formalDefinition="List of contacts related to this specific healthcare service." )
1183    protected List<ContactPoint> telecom;
1184
1185    /**
1186     * The location(s) that this service is available to (not where the service is provided).
1187     */
1188    @Child(name = "coverageArea", type = {Location.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1189    @Description(shortDefinition="Location(s) service is intended for/available to", formalDefinition="The location(s) that this service is available to (not where the service is provided)." )
1190    protected List<Reference> coverageArea;
1191    /**
1192     * 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).)
1193     */
1194    protected List<Location> coverageAreaTarget;
1195
1196
1197    /**
1198     * The code(s) that detail the conditions under which the healthcare service is available/offered.
1199     */
1200    @Child(name = "serviceProvisionCode", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1201    @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." )
1202    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-provision-conditions")
1203    protected List<CodeableConcept> serviceProvisionCode;
1204
1205    /**
1206     * Does this service have specific eligibility requirements that need to be met in order to use the service?
1207     */
1208    @Child(name = "eligibility", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1209    @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?" )
1210    protected List<HealthcareServiceEligibilityComponent> eligibility;
1211
1212    /**
1213     * Programs that this service is applicable to.
1214     */
1215    @Child(name = "program", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1216    @Description(shortDefinition="Programs that this service is applicable to", formalDefinition="Programs that this service is applicable to." )
1217    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/program")
1218    protected List<CodeableConcept> program;
1219
1220    /**
1221     * Collection of characteristics (attributes).
1222     */
1223    @Child(name = "characteristic", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1224    @Description(shortDefinition="Collection of characteristics (attributes)", formalDefinition="Collection of characteristics (attributes)." )
1225    protected List<CodeableConcept> characteristic;
1226
1227    /**
1228     * Some services are specifically made available in multiple languages, this property permits a directory to declare the languages this is offered in. Typically this is only provided where a service operates in communities with mixed languages used.
1229     */
1230    @Child(name = "communication", type = {CodeableConcept.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1231    @Description(shortDefinition="The language that this service is offered in", formalDefinition="Some services are specifically made available in multiple languages, this property permits a directory to declare the languages this is offered in. Typically this is only provided where a service operates in communities with mixed languages used." )
1232    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
1233    protected List<CodeableConcept> communication;
1234
1235    /**
1236     * Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required.
1237     */
1238    @Child(name = "referralMethod", type = {CodeableConcept.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1239    @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." )
1240    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-referral-method")
1241    protected List<CodeableConcept> referralMethod;
1242
1243    /**
1244     * 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.
1245     */
1246    @Child(name = "appointmentRequired", type = {BooleanType.class}, order=19, min=0, max=1, modifier=false, summary=false)
1247    @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." )
1248    protected BooleanType appointmentRequired;
1249
1250    /**
1251     * A collection of times that the Service Site is available.
1252     */
1253    @Child(name = "availableTime", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1254    @Description(shortDefinition="Times the Service Site is available", formalDefinition="A collection of times that the Service Site is available." )
1255    protected List<HealthcareServiceAvailableTimeComponent> availableTime;
1256
1257    /**
1258     * The HealthcareService is not available during this period of time due to the provided reason.
1259     */
1260    @Child(name = "notAvailable", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1261    @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." )
1262    protected List<HealthcareServiceNotAvailableComponent> notAvailable;
1263
1264    /**
1265     * 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.
1266     */
1267    @Child(name = "availabilityExceptions", type = {StringType.class}, order=22, min=0, max=1, modifier=false, summary=false)
1268    @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." )
1269    protected StringType availabilityExceptions;
1270
1271    /**
1272     * Technical endpoints providing access to services operated for the specific healthcare services defined at this resource.
1273     */
1274    @Child(name = "endpoint", type = {Endpoint.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1275    @Description(shortDefinition="Technical endpoints providing access to electronic services operated for the healthcare service", formalDefinition="Technical endpoints providing access to services operated for the specific healthcare services defined at this resource." )
1276    protected List<Reference> endpoint;
1277    /**
1278     * The actual objects that are the target of the reference (Technical endpoints providing access to services operated for the specific healthcare services defined at this resource.)
1279     */
1280    protected List<Endpoint> endpointTarget;
1281
1282
1283    private static final long serialVersionUID = -2002412666L;
1284
1285  /**
1286   * Constructor
1287   */
1288    public HealthcareService() {
1289      super();
1290    }
1291
1292    /**
1293     * @return {@link #identifier} (External identifiers for this item.)
1294     */
1295    public List<Identifier> getIdentifier() { 
1296      if (this.identifier == null)
1297        this.identifier = new ArrayList<Identifier>();
1298      return this.identifier;
1299    }
1300
1301    /**
1302     * @return Returns a reference to <code>this</code> for easy method chaining
1303     */
1304    public HealthcareService setIdentifier(List<Identifier> theIdentifier) { 
1305      this.identifier = theIdentifier;
1306      return this;
1307    }
1308
1309    public boolean hasIdentifier() { 
1310      if (this.identifier == null)
1311        return false;
1312      for (Identifier item : this.identifier)
1313        if (!item.isEmpty())
1314          return true;
1315      return false;
1316    }
1317
1318    public Identifier addIdentifier() { //3
1319      Identifier t = new Identifier();
1320      if (this.identifier == null)
1321        this.identifier = new ArrayList<Identifier>();
1322      this.identifier.add(t);
1323      return t;
1324    }
1325
1326    public HealthcareService addIdentifier(Identifier t) { //3
1327      if (t == null)
1328        return this;
1329      if (this.identifier == null)
1330        this.identifier = new ArrayList<Identifier>();
1331      this.identifier.add(t);
1332      return this;
1333    }
1334
1335    /**
1336     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1337     */
1338    public Identifier getIdentifierFirstRep() { 
1339      if (getIdentifier().isEmpty()) {
1340        addIdentifier();
1341      }
1342      return getIdentifier().get(0);
1343    }
1344
1345    /**
1346     * @return {@link #active} (This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
1347     */
1348    public BooleanType getActiveElement() { 
1349      if (this.active == null)
1350        if (Configuration.errorOnAutoCreate())
1351          throw new Error("Attempt to auto-create HealthcareService.active");
1352        else if (Configuration.doAutoCreate())
1353          this.active = new BooleanType(); // bb
1354      return this.active;
1355    }
1356
1357    public boolean hasActiveElement() { 
1358      return this.active != null && !this.active.isEmpty();
1359    }
1360
1361    public boolean hasActive() { 
1362      return this.active != null && !this.active.isEmpty();
1363    }
1364
1365    /**
1366     * @param value {@link #active} (This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
1367     */
1368    public HealthcareService setActiveElement(BooleanType value) { 
1369      this.active = value;
1370      return this;
1371    }
1372
1373    /**
1374     * @return This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.
1375     */
1376    public boolean getActive() { 
1377      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
1378    }
1379
1380    /**
1381     * @param value This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.
1382     */
1383    public HealthcareService setActive(boolean value) { 
1384        if (this.active == null)
1385          this.active = new BooleanType();
1386        this.active.setValue(value);
1387      return this;
1388    }
1389
1390    /**
1391     * @return {@link #providedBy} (The organization that provides this healthcare service.)
1392     */
1393    public Reference getProvidedBy() { 
1394      if (this.providedBy == null)
1395        if (Configuration.errorOnAutoCreate())
1396          throw new Error("Attempt to auto-create HealthcareService.providedBy");
1397        else if (Configuration.doAutoCreate())
1398          this.providedBy = new Reference(); // cc
1399      return this.providedBy;
1400    }
1401
1402    public boolean hasProvidedBy() { 
1403      return this.providedBy != null && !this.providedBy.isEmpty();
1404    }
1405
1406    /**
1407     * @param value {@link #providedBy} (The organization that provides this healthcare service.)
1408     */
1409    public HealthcareService setProvidedBy(Reference value) { 
1410      this.providedBy = value;
1411      return this;
1412    }
1413
1414    /**
1415     * @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.)
1416     */
1417    public Organization getProvidedByTarget() { 
1418      if (this.providedByTarget == null)
1419        if (Configuration.errorOnAutoCreate())
1420          throw new Error("Attempt to auto-create HealthcareService.providedBy");
1421        else if (Configuration.doAutoCreate())
1422          this.providedByTarget = new Organization(); // aa
1423      return this.providedByTarget;
1424    }
1425
1426    /**
1427     * @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.)
1428     */
1429    public HealthcareService setProvidedByTarget(Organization value) { 
1430      this.providedByTarget = value;
1431      return this;
1432    }
1433
1434    /**
1435     * @return {@link #category} (Identifies the broad category of service being performed or delivered.)
1436     */
1437    public List<CodeableConcept> getCategory() { 
1438      if (this.category == null)
1439        this.category = new ArrayList<CodeableConcept>();
1440      return this.category;
1441    }
1442
1443    /**
1444     * @return Returns a reference to <code>this</code> for easy method chaining
1445     */
1446    public HealthcareService setCategory(List<CodeableConcept> theCategory) { 
1447      this.category = theCategory;
1448      return this;
1449    }
1450
1451    public boolean hasCategory() { 
1452      if (this.category == null)
1453        return false;
1454      for (CodeableConcept item : this.category)
1455        if (!item.isEmpty())
1456          return true;
1457      return false;
1458    }
1459
1460    public CodeableConcept addCategory() { //3
1461      CodeableConcept t = new CodeableConcept();
1462      if (this.category == null)
1463        this.category = new ArrayList<CodeableConcept>();
1464      this.category.add(t);
1465      return t;
1466    }
1467
1468    public HealthcareService addCategory(CodeableConcept t) { //3
1469      if (t == null)
1470        return this;
1471      if (this.category == null)
1472        this.category = new ArrayList<CodeableConcept>();
1473      this.category.add(t);
1474      return this;
1475    }
1476
1477    /**
1478     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
1479     */
1480    public CodeableConcept getCategoryFirstRep() { 
1481      if (getCategory().isEmpty()) {
1482        addCategory();
1483      }
1484      return getCategory().get(0);
1485    }
1486
1487    /**
1488     * @return {@link #type} (The specific type of service that may be delivered or performed.)
1489     */
1490    public List<CodeableConcept> getType() { 
1491      if (this.type == null)
1492        this.type = new ArrayList<CodeableConcept>();
1493      return this.type;
1494    }
1495
1496    /**
1497     * @return Returns a reference to <code>this</code> for easy method chaining
1498     */
1499    public HealthcareService setType(List<CodeableConcept> theType) { 
1500      this.type = theType;
1501      return this;
1502    }
1503
1504    public boolean hasType() { 
1505      if (this.type == null)
1506        return false;
1507      for (CodeableConcept item : this.type)
1508        if (!item.isEmpty())
1509          return true;
1510      return false;
1511    }
1512
1513    public CodeableConcept addType() { //3
1514      CodeableConcept t = new CodeableConcept();
1515      if (this.type == null)
1516        this.type = new ArrayList<CodeableConcept>();
1517      this.type.add(t);
1518      return t;
1519    }
1520
1521    public HealthcareService addType(CodeableConcept t) { //3
1522      if (t == null)
1523        return this;
1524      if (this.type == null)
1525        this.type = new ArrayList<CodeableConcept>();
1526      this.type.add(t);
1527      return this;
1528    }
1529
1530    /**
1531     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1532     */
1533    public CodeableConcept getTypeFirstRep() { 
1534      if (getType().isEmpty()) {
1535        addType();
1536      }
1537      return getType().get(0);
1538    }
1539
1540    /**
1541     * @return {@link #specialty} (Collection of specialties handled by the service site. This is more of a medical term.)
1542     */
1543    public List<CodeableConcept> getSpecialty() { 
1544      if (this.specialty == null)
1545        this.specialty = new ArrayList<CodeableConcept>();
1546      return this.specialty;
1547    }
1548
1549    /**
1550     * @return Returns a reference to <code>this</code> for easy method chaining
1551     */
1552    public HealthcareService setSpecialty(List<CodeableConcept> theSpecialty) { 
1553      this.specialty = theSpecialty;
1554      return this;
1555    }
1556
1557    public boolean hasSpecialty() { 
1558      if (this.specialty == null)
1559        return false;
1560      for (CodeableConcept item : this.specialty)
1561        if (!item.isEmpty())
1562          return true;
1563      return false;
1564    }
1565
1566    public CodeableConcept addSpecialty() { //3
1567      CodeableConcept t = new CodeableConcept();
1568      if (this.specialty == null)
1569        this.specialty = new ArrayList<CodeableConcept>();
1570      this.specialty.add(t);
1571      return t;
1572    }
1573
1574    public HealthcareService addSpecialty(CodeableConcept t) { //3
1575      if (t == null)
1576        return this;
1577      if (this.specialty == null)
1578        this.specialty = new ArrayList<CodeableConcept>();
1579      this.specialty.add(t);
1580      return this;
1581    }
1582
1583    /**
1584     * @return The first repetition of repeating field {@link #specialty}, creating it if it does not already exist
1585     */
1586    public CodeableConcept getSpecialtyFirstRep() { 
1587      if (getSpecialty().isEmpty()) {
1588        addSpecialty();
1589      }
1590      return getSpecialty().get(0);
1591    }
1592
1593    /**
1594     * @return {@link #location} (The location(s) where this healthcare service may be provided.)
1595     */
1596    public List<Reference> getLocation() { 
1597      if (this.location == null)
1598        this.location = new ArrayList<Reference>();
1599      return this.location;
1600    }
1601
1602    /**
1603     * @return Returns a reference to <code>this</code> for easy method chaining
1604     */
1605    public HealthcareService setLocation(List<Reference> theLocation) { 
1606      this.location = theLocation;
1607      return this;
1608    }
1609
1610    public boolean hasLocation() { 
1611      if (this.location == null)
1612        return false;
1613      for (Reference item : this.location)
1614        if (!item.isEmpty())
1615          return true;
1616      return false;
1617    }
1618
1619    public Reference addLocation() { //3
1620      Reference t = new Reference();
1621      if (this.location == null)
1622        this.location = new ArrayList<Reference>();
1623      this.location.add(t);
1624      return t;
1625    }
1626
1627    public HealthcareService addLocation(Reference t) { //3
1628      if (t == null)
1629        return this;
1630      if (this.location == null)
1631        this.location = new ArrayList<Reference>();
1632      this.location.add(t);
1633      return this;
1634    }
1635
1636    /**
1637     * @return The first repetition of repeating field {@link #location}, creating it if it does not already exist
1638     */
1639    public Reference getLocationFirstRep() { 
1640      if (getLocation().isEmpty()) {
1641        addLocation();
1642      }
1643      return getLocation().get(0);
1644    }
1645
1646    /**
1647     * @deprecated Use Reference#setResource(IBaseResource) instead
1648     */
1649    @Deprecated
1650    public List<Location> getLocationTarget() { 
1651      if (this.locationTarget == null)
1652        this.locationTarget = new ArrayList<Location>();
1653      return this.locationTarget;
1654    }
1655
1656    /**
1657     * @deprecated Use Reference#setResource(IBaseResource) instead
1658     */
1659    @Deprecated
1660    public Location addLocationTarget() { 
1661      Location r = new Location();
1662      if (this.locationTarget == null)
1663        this.locationTarget = new ArrayList<Location>();
1664      this.locationTarget.add(r);
1665      return r;
1666    }
1667
1668    /**
1669     * @return {@link #name} (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 "getName" gives direct access to the value
1670     */
1671    public StringType getNameElement() { 
1672      if (this.name == null)
1673        if (Configuration.errorOnAutoCreate())
1674          throw new Error("Attempt to auto-create HealthcareService.name");
1675        else if (Configuration.doAutoCreate())
1676          this.name = new StringType(); // bb
1677      return this.name;
1678    }
1679
1680    public boolean hasNameElement() { 
1681      return this.name != null && !this.name.isEmpty();
1682    }
1683
1684    public boolean hasName() { 
1685      return this.name != null && !this.name.isEmpty();
1686    }
1687
1688    /**
1689     * @param value {@link #name} (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 "getName" gives direct access to the value
1690     */
1691    public HealthcareService setNameElement(StringType value) { 
1692      this.name = value;
1693      return this;
1694    }
1695
1696    /**
1697     * @return Further description of the service as it would be presented to a consumer while searching.
1698     */
1699    public String getName() { 
1700      return this.name == null ? null : this.name.getValue();
1701    }
1702
1703    /**
1704     * @param value Further description of the service as it would be presented to a consumer while searching.
1705     */
1706    public HealthcareService setName(String value) { 
1707      if (Utilities.noString(value))
1708        this.name = null;
1709      else {
1710        if (this.name == null)
1711          this.name = new StringType();
1712        this.name.setValue(value);
1713      }
1714      return this;
1715    }
1716
1717    /**
1718     * @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
1719     */
1720    public StringType getCommentElement() { 
1721      if (this.comment == null)
1722        if (Configuration.errorOnAutoCreate())
1723          throw new Error("Attempt to auto-create HealthcareService.comment");
1724        else if (Configuration.doAutoCreate())
1725          this.comment = new StringType(); // bb
1726      return this.comment;
1727    }
1728
1729    public boolean hasCommentElement() { 
1730      return this.comment != null && !this.comment.isEmpty();
1731    }
1732
1733    public boolean hasComment() { 
1734      return this.comment != null && !this.comment.isEmpty();
1735    }
1736
1737    /**
1738     * @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
1739     */
1740    public HealthcareService setCommentElement(StringType value) { 
1741      this.comment = value;
1742      return this;
1743    }
1744
1745    /**
1746     * @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.
1747     */
1748    public String getComment() { 
1749      return this.comment == null ? null : this.comment.getValue();
1750    }
1751
1752    /**
1753     * @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.
1754     */
1755    public HealthcareService setComment(String value) { 
1756      if (Utilities.noString(value))
1757        this.comment = null;
1758      else {
1759        if (this.comment == null)
1760          this.comment = new StringType();
1761        this.comment.setValue(value);
1762      }
1763      return this;
1764    }
1765
1766    /**
1767     * @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
1768     */
1769    public MarkdownType getExtraDetailsElement() { 
1770      if (this.extraDetails == null)
1771        if (Configuration.errorOnAutoCreate())
1772          throw new Error("Attempt to auto-create HealthcareService.extraDetails");
1773        else if (Configuration.doAutoCreate())
1774          this.extraDetails = new MarkdownType(); // bb
1775      return this.extraDetails;
1776    }
1777
1778    public boolean hasExtraDetailsElement() { 
1779      return this.extraDetails != null && !this.extraDetails.isEmpty();
1780    }
1781
1782    public boolean hasExtraDetails() { 
1783      return this.extraDetails != null && !this.extraDetails.isEmpty();
1784    }
1785
1786    /**
1787     * @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
1788     */
1789    public HealthcareService setExtraDetailsElement(MarkdownType value) { 
1790      this.extraDetails = value;
1791      return this;
1792    }
1793
1794    /**
1795     * @return Extra details about the service that can't be placed in the other fields.
1796     */
1797    public String getExtraDetails() { 
1798      return this.extraDetails == null ? null : this.extraDetails.getValue();
1799    }
1800
1801    /**
1802     * @param value Extra details about the service that can't be placed in the other fields.
1803     */
1804    public HealthcareService setExtraDetails(String value) { 
1805      if (value == null)
1806        this.extraDetails = null;
1807      else {
1808        if (this.extraDetails == null)
1809          this.extraDetails = new MarkdownType();
1810        this.extraDetails.setValue(value);
1811      }
1812      return this;
1813    }
1814
1815    /**
1816     * @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.)
1817     */
1818    public Attachment getPhoto() { 
1819      if (this.photo == null)
1820        if (Configuration.errorOnAutoCreate())
1821          throw new Error("Attempt to auto-create HealthcareService.photo");
1822        else if (Configuration.doAutoCreate())
1823          this.photo = new Attachment(); // cc
1824      return this.photo;
1825    }
1826
1827    public boolean hasPhoto() { 
1828      return this.photo != null && !this.photo.isEmpty();
1829    }
1830
1831    /**
1832     * @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.)
1833     */
1834    public HealthcareService setPhoto(Attachment value) { 
1835      this.photo = value;
1836      return this;
1837    }
1838
1839    /**
1840     * @return {@link #telecom} (List of contacts related to this specific healthcare service.)
1841     */
1842    public List<ContactPoint> getTelecom() { 
1843      if (this.telecom == null)
1844        this.telecom = new ArrayList<ContactPoint>();
1845      return this.telecom;
1846    }
1847
1848    /**
1849     * @return Returns a reference to <code>this</code> for easy method chaining
1850     */
1851    public HealthcareService setTelecom(List<ContactPoint> theTelecom) { 
1852      this.telecom = theTelecom;
1853      return this;
1854    }
1855
1856    public boolean hasTelecom() { 
1857      if (this.telecom == null)
1858        return false;
1859      for (ContactPoint item : this.telecom)
1860        if (!item.isEmpty())
1861          return true;
1862      return false;
1863    }
1864
1865    public ContactPoint addTelecom() { //3
1866      ContactPoint t = new ContactPoint();
1867      if (this.telecom == null)
1868        this.telecom = new ArrayList<ContactPoint>();
1869      this.telecom.add(t);
1870      return t;
1871    }
1872
1873    public HealthcareService addTelecom(ContactPoint t) { //3
1874      if (t == null)
1875        return this;
1876      if (this.telecom == null)
1877        this.telecom = new ArrayList<ContactPoint>();
1878      this.telecom.add(t);
1879      return this;
1880    }
1881
1882    /**
1883     * @return The first repetition of repeating field {@link #telecom}, creating it if it does not already exist
1884     */
1885    public ContactPoint getTelecomFirstRep() { 
1886      if (getTelecom().isEmpty()) {
1887        addTelecom();
1888      }
1889      return getTelecom().get(0);
1890    }
1891
1892    /**
1893     * @return {@link #coverageArea} (The location(s) that this service is available to (not where the service is provided).)
1894     */
1895    public List<Reference> getCoverageArea() { 
1896      if (this.coverageArea == null)
1897        this.coverageArea = new ArrayList<Reference>();
1898      return this.coverageArea;
1899    }
1900
1901    /**
1902     * @return Returns a reference to <code>this</code> for easy method chaining
1903     */
1904    public HealthcareService setCoverageArea(List<Reference> theCoverageArea) { 
1905      this.coverageArea = theCoverageArea;
1906      return this;
1907    }
1908
1909    public boolean hasCoverageArea() { 
1910      if (this.coverageArea == null)
1911        return false;
1912      for (Reference item : this.coverageArea)
1913        if (!item.isEmpty())
1914          return true;
1915      return false;
1916    }
1917
1918    public Reference addCoverageArea() { //3
1919      Reference t = new Reference();
1920      if (this.coverageArea == null)
1921        this.coverageArea = new ArrayList<Reference>();
1922      this.coverageArea.add(t);
1923      return t;
1924    }
1925
1926    public HealthcareService addCoverageArea(Reference t) { //3
1927      if (t == null)
1928        return this;
1929      if (this.coverageArea == null)
1930        this.coverageArea = new ArrayList<Reference>();
1931      this.coverageArea.add(t);
1932      return this;
1933    }
1934
1935    /**
1936     * @return The first repetition of repeating field {@link #coverageArea}, creating it if it does not already exist
1937     */
1938    public Reference getCoverageAreaFirstRep() { 
1939      if (getCoverageArea().isEmpty()) {
1940        addCoverageArea();
1941      }
1942      return getCoverageArea().get(0);
1943    }
1944
1945    /**
1946     * @deprecated Use Reference#setResource(IBaseResource) instead
1947     */
1948    @Deprecated
1949    public List<Location> getCoverageAreaTarget() { 
1950      if (this.coverageAreaTarget == null)
1951        this.coverageAreaTarget = new ArrayList<Location>();
1952      return this.coverageAreaTarget;
1953    }
1954
1955    /**
1956     * @deprecated Use Reference#setResource(IBaseResource) instead
1957     */
1958    @Deprecated
1959    public Location addCoverageAreaTarget() { 
1960      Location r = new Location();
1961      if (this.coverageAreaTarget == null)
1962        this.coverageAreaTarget = new ArrayList<Location>();
1963      this.coverageAreaTarget.add(r);
1964      return r;
1965    }
1966
1967    /**
1968     * @return {@link #serviceProvisionCode} (The code(s) that detail the conditions under which the healthcare service is available/offered.)
1969     */
1970    public List<CodeableConcept> getServiceProvisionCode() { 
1971      if (this.serviceProvisionCode == null)
1972        this.serviceProvisionCode = new ArrayList<CodeableConcept>();
1973      return this.serviceProvisionCode;
1974    }
1975
1976    /**
1977     * @return Returns a reference to <code>this</code> for easy method chaining
1978     */
1979    public HealthcareService setServiceProvisionCode(List<CodeableConcept> theServiceProvisionCode) { 
1980      this.serviceProvisionCode = theServiceProvisionCode;
1981      return this;
1982    }
1983
1984    public boolean hasServiceProvisionCode() { 
1985      if (this.serviceProvisionCode == null)
1986        return false;
1987      for (CodeableConcept item : this.serviceProvisionCode)
1988        if (!item.isEmpty())
1989          return true;
1990      return false;
1991    }
1992
1993    public CodeableConcept addServiceProvisionCode() { //3
1994      CodeableConcept t = new CodeableConcept();
1995      if (this.serviceProvisionCode == null)
1996        this.serviceProvisionCode = new ArrayList<CodeableConcept>();
1997      this.serviceProvisionCode.add(t);
1998      return t;
1999    }
2000
2001    public HealthcareService addServiceProvisionCode(CodeableConcept t) { //3
2002      if (t == null)
2003        return this;
2004      if (this.serviceProvisionCode == null)
2005        this.serviceProvisionCode = new ArrayList<CodeableConcept>();
2006      this.serviceProvisionCode.add(t);
2007      return this;
2008    }
2009
2010    /**
2011     * @return The first repetition of repeating field {@link #serviceProvisionCode}, creating it if it does not already exist
2012     */
2013    public CodeableConcept getServiceProvisionCodeFirstRep() { 
2014      if (getServiceProvisionCode().isEmpty()) {
2015        addServiceProvisionCode();
2016      }
2017      return getServiceProvisionCode().get(0);
2018    }
2019
2020    /**
2021     * @return {@link #eligibility} (Does this service have specific eligibility requirements that need to be met in order to use the service?)
2022     */
2023    public List<HealthcareServiceEligibilityComponent> getEligibility() { 
2024      if (this.eligibility == null)
2025        this.eligibility = new ArrayList<HealthcareServiceEligibilityComponent>();
2026      return this.eligibility;
2027    }
2028
2029    /**
2030     * @return Returns a reference to <code>this</code> for easy method chaining
2031     */
2032    public HealthcareService setEligibility(List<HealthcareServiceEligibilityComponent> theEligibility) { 
2033      this.eligibility = theEligibility;
2034      return this;
2035    }
2036
2037    public boolean hasEligibility() { 
2038      if (this.eligibility == null)
2039        return false;
2040      for (HealthcareServiceEligibilityComponent item : this.eligibility)
2041        if (!item.isEmpty())
2042          return true;
2043      return false;
2044    }
2045
2046    public HealthcareServiceEligibilityComponent addEligibility() { //3
2047      HealthcareServiceEligibilityComponent t = new HealthcareServiceEligibilityComponent();
2048      if (this.eligibility == null)
2049        this.eligibility = new ArrayList<HealthcareServiceEligibilityComponent>();
2050      this.eligibility.add(t);
2051      return t;
2052    }
2053
2054    public HealthcareService addEligibility(HealthcareServiceEligibilityComponent t) { //3
2055      if (t == null)
2056        return this;
2057      if (this.eligibility == null)
2058        this.eligibility = new ArrayList<HealthcareServiceEligibilityComponent>();
2059      this.eligibility.add(t);
2060      return this;
2061    }
2062
2063    /**
2064     * @return The first repetition of repeating field {@link #eligibility}, creating it if it does not already exist
2065     */
2066    public HealthcareServiceEligibilityComponent getEligibilityFirstRep() { 
2067      if (getEligibility().isEmpty()) {
2068        addEligibility();
2069      }
2070      return getEligibility().get(0);
2071    }
2072
2073    /**
2074     * @return {@link #program} (Programs that this service is applicable to.)
2075     */
2076    public List<CodeableConcept> getProgram() { 
2077      if (this.program == null)
2078        this.program = new ArrayList<CodeableConcept>();
2079      return this.program;
2080    }
2081
2082    /**
2083     * @return Returns a reference to <code>this</code> for easy method chaining
2084     */
2085    public HealthcareService setProgram(List<CodeableConcept> theProgram) { 
2086      this.program = theProgram;
2087      return this;
2088    }
2089
2090    public boolean hasProgram() { 
2091      if (this.program == null)
2092        return false;
2093      for (CodeableConcept item : this.program)
2094        if (!item.isEmpty())
2095          return true;
2096      return false;
2097    }
2098
2099    public CodeableConcept addProgram() { //3
2100      CodeableConcept t = new CodeableConcept();
2101      if (this.program == null)
2102        this.program = new ArrayList<CodeableConcept>();
2103      this.program.add(t);
2104      return t;
2105    }
2106
2107    public HealthcareService addProgram(CodeableConcept t) { //3
2108      if (t == null)
2109        return this;
2110      if (this.program == null)
2111        this.program = new ArrayList<CodeableConcept>();
2112      this.program.add(t);
2113      return this;
2114    }
2115
2116    /**
2117     * @return The first repetition of repeating field {@link #program}, creating it if it does not already exist
2118     */
2119    public CodeableConcept getProgramFirstRep() { 
2120      if (getProgram().isEmpty()) {
2121        addProgram();
2122      }
2123      return getProgram().get(0);
2124    }
2125
2126    /**
2127     * @return {@link #characteristic} (Collection of characteristics (attributes).)
2128     */
2129    public List<CodeableConcept> getCharacteristic() { 
2130      if (this.characteristic == null)
2131        this.characteristic = new ArrayList<CodeableConcept>();
2132      return this.characteristic;
2133    }
2134
2135    /**
2136     * @return Returns a reference to <code>this</code> for easy method chaining
2137     */
2138    public HealthcareService setCharacteristic(List<CodeableConcept> theCharacteristic) { 
2139      this.characteristic = theCharacteristic;
2140      return this;
2141    }
2142
2143    public boolean hasCharacteristic() { 
2144      if (this.characteristic == null)
2145        return false;
2146      for (CodeableConcept item : this.characteristic)
2147        if (!item.isEmpty())
2148          return true;
2149      return false;
2150    }
2151
2152    public CodeableConcept addCharacteristic() { //3
2153      CodeableConcept t = new CodeableConcept();
2154      if (this.characteristic == null)
2155        this.characteristic = new ArrayList<CodeableConcept>();
2156      this.characteristic.add(t);
2157      return t;
2158    }
2159
2160    public HealthcareService addCharacteristic(CodeableConcept t) { //3
2161      if (t == null)
2162        return this;
2163      if (this.characteristic == null)
2164        this.characteristic = new ArrayList<CodeableConcept>();
2165      this.characteristic.add(t);
2166      return this;
2167    }
2168
2169    /**
2170     * @return The first repetition of repeating field {@link #characteristic}, creating it if it does not already exist
2171     */
2172    public CodeableConcept getCharacteristicFirstRep() { 
2173      if (getCharacteristic().isEmpty()) {
2174        addCharacteristic();
2175      }
2176      return getCharacteristic().get(0);
2177    }
2178
2179    /**
2180     * @return {@link #communication} (Some services are specifically made available in multiple languages, this property permits a directory to declare the languages this is offered in. Typically this is only provided where a service operates in communities with mixed languages used.)
2181     */
2182    public List<CodeableConcept> getCommunication() { 
2183      if (this.communication == null)
2184        this.communication = new ArrayList<CodeableConcept>();
2185      return this.communication;
2186    }
2187
2188    /**
2189     * @return Returns a reference to <code>this</code> for easy method chaining
2190     */
2191    public HealthcareService setCommunication(List<CodeableConcept> theCommunication) { 
2192      this.communication = theCommunication;
2193      return this;
2194    }
2195
2196    public boolean hasCommunication() { 
2197      if (this.communication == null)
2198        return false;
2199      for (CodeableConcept item : this.communication)
2200        if (!item.isEmpty())
2201          return true;
2202      return false;
2203    }
2204
2205    public CodeableConcept addCommunication() { //3
2206      CodeableConcept t = new CodeableConcept();
2207      if (this.communication == null)
2208        this.communication = new ArrayList<CodeableConcept>();
2209      this.communication.add(t);
2210      return t;
2211    }
2212
2213    public HealthcareService addCommunication(CodeableConcept t) { //3
2214      if (t == null)
2215        return this;
2216      if (this.communication == null)
2217        this.communication = new ArrayList<CodeableConcept>();
2218      this.communication.add(t);
2219      return this;
2220    }
2221
2222    /**
2223     * @return The first repetition of repeating field {@link #communication}, creating it if it does not already exist
2224     */
2225    public CodeableConcept getCommunicationFirstRep() { 
2226      if (getCommunication().isEmpty()) {
2227        addCommunication();
2228      }
2229      return getCommunication().get(0);
2230    }
2231
2232    /**
2233     * @return {@link #referralMethod} (Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required.)
2234     */
2235    public List<CodeableConcept> getReferralMethod() { 
2236      if (this.referralMethod == null)
2237        this.referralMethod = new ArrayList<CodeableConcept>();
2238      return this.referralMethod;
2239    }
2240
2241    /**
2242     * @return Returns a reference to <code>this</code> for easy method chaining
2243     */
2244    public HealthcareService setReferralMethod(List<CodeableConcept> theReferralMethod) { 
2245      this.referralMethod = theReferralMethod;
2246      return this;
2247    }
2248
2249    public boolean hasReferralMethod() { 
2250      if (this.referralMethod == null)
2251        return false;
2252      for (CodeableConcept item : this.referralMethod)
2253        if (!item.isEmpty())
2254          return true;
2255      return false;
2256    }
2257
2258    public CodeableConcept addReferralMethod() { //3
2259      CodeableConcept t = new CodeableConcept();
2260      if (this.referralMethod == null)
2261        this.referralMethod = new ArrayList<CodeableConcept>();
2262      this.referralMethod.add(t);
2263      return t;
2264    }
2265
2266    public HealthcareService addReferralMethod(CodeableConcept t) { //3
2267      if (t == null)
2268        return this;
2269      if (this.referralMethod == null)
2270        this.referralMethod = new ArrayList<CodeableConcept>();
2271      this.referralMethod.add(t);
2272      return this;
2273    }
2274
2275    /**
2276     * @return The first repetition of repeating field {@link #referralMethod}, creating it if it does not already exist
2277     */
2278    public CodeableConcept getReferralMethodFirstRep() { 
2279      if (getReferralMethod().isEmpty()) {
2280        addReferralMethod();
2281      }
2282      return getReferralMethod().get(0);
2283    }
2284
2285    /**
2286     * @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
2287     */
2288    public BooleanType getAppointmentRequiredElement() { 
2289      if (this.appointmentRequired == null)
2290        if (Configuration.errorOnAutoCreate())
2291          throw new Error("Attempt to auto-create HealthcareService.appointmentRequired");
2292        else if (Configuration.doAutoCreate())
2293          this.appointmentRequired = new BooleanType(); // bb
2294      return this.appointmentRequired;
2295    }
2296
2297    public boolean hasAppointmentRequiredElement() { 
2298      return this.appointmentRequired != null && !this.appointmentRequired.isEmpty();
2299    }
2300
2301    public boolean hasAppointmentRequired() { 
2302      return this.appointmentRequired != null && !this.appointmentRequired.isEmpty();
2303    }
2304
2305    /**
2306     * @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
2307     */
2308    public HealthcareService setAppointmentRequiredElement(BooleanType value) { 
2309      this.appointmentRequired = value;
2310      return this;
2311    }
2312
2313    /**
2314     * @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.
2315     */
2316    public boolean getAppointmentRequired() { 
2317      return this.appointmentRequired == null || this.appointmentRequired.isEmpty() ? false : this.appointmentRequired.getValue();
2318    }
2319
2320    /**
2321     * @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.
2322     */
2323    public HealthcareService setAppointmentRequired(boolean value) { 
2324        if (this.appointmentRequired == null)
2325          this.appointmentRequired = new BooleanType();
2326        this.appointmentRequired.setValue(value);
2327      return this;
2328    }
2329
2330    /**
2331     * @return {@link #availableTime} (A collection of times that the Service Site is available.)
2332     */
2333    public List<HealthcareServiceAvailableTimeComponent> getAvailableTime() { 
2334      if (this.availableTime == null)
2335        this.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
2336      return this.availableTime;
2337    }
2338
2339    /**
2340     * @return Returns a reference to <code>this</code> for easy method chaining
2341     */
2342    public HealthcareService setAvailableTime(List<HealthcareServiceAvailableTimeComponent> theAvailableTime) { 
2343      this.availableTime = theAvailableTime;
2344      return this;
2345    }
2346
2347    public boolean hasAvailableTime() { 
2348      if (this.availableTime == null)
2349        return false;
2350      for (HealthcareServiceAvailableTimeComponent item : this.availableTime)
2351        if (!item.isEmpty())
2352          return true;
2353      return false;
2354    }
2355
2356    public HealthcareServiceAvailableTimeComponent addAvailableTime() { //3
2357      HealthcareServiceAvailableTimeComponent t = new HealthcareServiceAvailableTimeComponent();
2358      if (this.availableTime == null)
2359        this.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
2360      this.availableTime.add(t);
2361      return t;
2362    }
2363
2364    public HealthcareService addAvailableTime(HealthcareServiceAvailableTimeComponent t) { //3
2365      if (t == null)
2366        return this;
2367      if (this.availableTime == null)
2368        this.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
2369      this.availableTime.add(t);
2370      return this;
2371    }
2372
2373    /**
2374     * @return The first repetition of repeating field {@link #availableTime}, creating it if it does not already exist
2375     */
2376    public HealthcareServiceAvailableTimeComponent getAvailableTimeFirstRep() { 
2377      if (getAvailableTime().isEmpty()) {
2378        addAvailableTime();
2379      }
2380      return getAvailableTime().get(0);
2381    }
2382
2383    /**
2384     * @return {@link #notAvailable} (The HealthcareService is not available during this period of time due to the provided reason.)
2385     */
2386    public List<HealthcareServiceNotAvailableComponent> getNotAvailable() { 
2387      if (this.notAvailable == null)
2388        this.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
2389      return this.notAvailable;
2390    }
2391
2392    /**
2393     * @return Returns a reference to <code>this</code> for easy method chaining
2394     */
2395    public HealthcareService setNotAvailable(List<HealthcareServiceNotAvailableComponent> theNotAvailable) { 
2396      this.notAvailable = theNotAvailable;
2397      return this;
2398    }
2399
2400    public boolean hasNotAvailable() { 
2401      if (this.notAvailable == null)
2402        return false;
2403      for (HealthcareServiceNotAvailableComponent item : this.notAvailable)
2404        if (!item.isEmpty())
2405          return true;
2406      return false;
2407    }
2408
2409    public HealthcareServiceNotAvailableComponent addNotAvailable() { //3
2410      HealthcareServiceNotAvailableComponent t = new HealthcareServiceNotAvailableComponent();
2411      if (this.notAvailable == null)
2412        this.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
2413      this.notAvailable.add(t);
2414      return t;
2415    }
2416
2417    public HealthcareService addNotAvailable(HealthcareServiceNotAvailableComponent t) { //3
2418      if (t == null)
2419        return this;
2420      if (this.notAvailable == null)
2421        this.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
2422      this.notAvailable.add(t);
2423      return this;
2424    }
2425
2426    /**
2427     * @return The first repetition of repeating field {@link #notAvailable}, creating it if it does not already exist
2428     */
2429    public HealthcareServiceNotAvailableComponent getNotAvailableFirstRep() { 
2430      if (getNotAvailable().isEmpty()) {
2431        addNotAvailable();
2432      }
2433      return getNotAvailable().get(0);
2434    }
2435
2436    /**
2437     * @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
2438     */
2439    public StringType getAvailabilityExceptionsElement() { 
2440      if (this.availabilityExceptions == null)
2441        if (Configuration.errorOnAutoCreate())
2442          throw new Error("Attempt to auto-create HealthcareService.availabilityExceptions");
2443        else if (Configuration.doAutoCreate())
2444          this.availabilityExceptions = new StringType(); // bb
2445      return this.availabilityExceptions;
2446    }
2447
2448    public boolean hasAvailabilityExceptionsElement() { 
2449      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
2450    }
2451
2452    public boolean hasAvailabilityExceptions() { 
2453      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
2454    }
2455
2456    /**
2457     * @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
2458     */
2459    public HealthcareService setAvailabilityExceptionsElement(StringType value) { 
2460      this.availabilityExceptions = value;
2461      return this;
2462    }
2463
2464    /**
2465     * @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.
2466     */
2467    public String getAvailabilityExceptions() { 
2468      return this.availabilityExceptions == null ? null : this.availabilityExceptions.getValue();
2469    }
2470
2471    /**
2472     * @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.
2473     */
2474    public HealthcareService setAvailabilityExceptions(String value) { 
2475      if (Utilities.noString(value))
2476        this.availabilityExceptions = null;
2477      else {
2478        if (this.availabilityExceptions == null)
2479          this.availabilityExceptions = new StringType();
2480        this.availabilityExceptions.setValue(value);
2481      }
2482      return this;
2483    }
2484
2485    /**
2486     * @return {@link #endpoint} (Technical endpoints providing access to services operated for the specific healthcare services defined at this resource.)
2487     */
2488    public List<Reference> getEndpoint() { 
2489      if (this.endpoint == null)
2490        this.endpoint = new ArrayList<Reference>();
2491      return this.endpoint;
2492    }
2493
2494    /**
2495     * @return Returns a reference to <code>this</code> for easy method chaining
2496     */
2497    public HealthcareService setEndpoint(List<Reference> theEndpoint) { 
2498      this.endpoint = theEndpoint;
2499      return this;
2500    }
2501
2502    public boolean hasEndpoint() { 
2503      if (this.endpoint == null)
2504        return false;
2505      for (Reference item : this.endpoint)
2506        if (!item.isEmpty())
2507          return true;
2508      return false;
2509    }
2510
2511    public Reference addEndpoint() { //3
2512      Reference t = new Reference();
2513      if (this.endpoint == null)
2514        this.endpoint = new ArrayList<Reference>();
2515      this.endpoint.add(t);
2516      return t;
2517    }
2518
2519    public HealthcareService addEndpoint(Reference t) { //3
2520      if (t == null)
2521        return this;
2522      if (this.endpoint == null)
2523        this.endpoint = new ArrayList<Reference>();
2524      this.endpoint.add(t);
2525      return this;
2526    }
2527
2528    /**
2529     * @return The first repetition of repeating field {@link #endpoint}, creating it if it does not already exist
2530     */
2531    public Reference getEndpointFirstRep() { 
2532      if (getEndpoint().isEmpty()) {
2533        addEndpoint();
2534      }
2535      return getEndpoint().get(0);
2536    }
2537
2538    /**
2539     * @deprecated Use Reference#setResource(IBaseResource) instead
2540     */
2541    @Deprecated
2542    public List<Endpoint> getEndpointTarget() { 
2543      if (this.endpointTarget == null)
2544        this.endpointTarget = new ArrayList<Endpoint>();
2545      return this.endpointTarget;
2546    }
2547
2548    /**
2549     * @deprecated Use Reference#setResource(IBaseResource) instead
2550     */
2551    @Deprecated
2552    public Endpoint addEndpointTarget() { 
2553      Endpoint r = new Endpoint();
2554      if (this.endpointTarget == null)
2555        this.endpointTarget = new ArrayList<Endpoint>();
2556      this.endpointTarget.add(r);
2557      return r;
2558    }
2559
2560      protected void listChildren(List<Property> children) {
2561        super.listChildren(children);
2562        children.add(new Property("identifier", "Identifier", "External identifiers for this item.", 0, java.lang.Integer.MAX_VALUE, identifier));
2563        children.add(new Property("active", "boolean", "This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.", 0, 1, active));
2564        children.add(new Property("providedBy", "Reference(Organization)", "The organization that provides this healthcare service.", 0, 1, providedBy));
2565        children.add(new Property("category", "CodeableConcept", "Identifies the broad category of service being performed or delivered.", 0, java.lang.Integer.MAX_VALUE, category));
2566        children.add(new Property("type", "CodeableConcept", "The specific type of service that may be delivered or performed.", 0, java.lang.Integer.MAX_VALUE, type));
2567        children.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));
2568        children.add(new Property("location", "Reference(Location)", "The location(s) where this healthcare service may be provided.", 0, java.lang.Integer.MAX_VALUE, location));
2569        children.add(new Property("name", "string", "Further description of the service as it would be presented to a consumer while searching.", 0, 1, name));
2570        children.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, 1, comment));
2571        children.add(new Property("extraDetails", "markdown", "Extra details about the service that can't be placed in the other fields.", 0, 1, extraDetails));
2572        children.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, 1, photo));
2573        children.add(new Property("telecom", "ContactPoint", "List of contacts related to this specific healthcare service.", 0, java.lang.Integer.MAX_VALUE, telecom));
2574        children.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));
2575        children.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));
2576        children.add(new Property("eligibility", "", "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));
2577        children.add(new Property("program", "CodeableConcept", "Programs that this service is applicable to.", 0, java.lang.Integer.MAX_VALUE, program));
2578        children.add(new Property("characteristic", "CodeableConcept", "Collection of characteristics (attributes).", 0, java.lang.Integer.MAX_VALUE, characteristic));
2579        children.add(new Property("communication", "CodeableConcept", "Some services are specifically made available in multiple languages, this property permits a directory to declare the languages this is offered in. Typically this is only provided where a service operates in communities with mixed languages used.", 0, java.lang.Integer.MAX_VALUE, communication));
2580        children.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));
2581        children.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, 1, appointmentRequired));
2582        children.add(new Property("availableTime", "", "A collection of times that the Service Site is available.", 0, java.lang.Integer.MAX_VALUE, availableTime));
2583        children.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));
2584        children.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, 1, availabilityExceptions));
2585        children.add(new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services operated for the specific healthcare services defined at this resource.", 0, java.lang.Integer.MAX_VALUE, endpoint));
2586      }
2587
2588      @Override
2589      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2590        switch (_hash) {
2591        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "External identifiers for this item.", 0, java.lang.Integer.MAX_VALUE, identifier);
2592        case -1422950650: /*active*/  return new Property("active", "boolean", "This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.", 0, 1, active);
2593        case 205136282: /*providedBy*/  return new Property("providedBy", "Reference(Organization)", "The organization that provides this healthcare service.", 0, 1, providedBy);
2594        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Identifies the broad category of service being performed or delivered.", 0, java.lang.Integer.MAX_VALUE, category);
2595        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The specific type of service that may be delivered or performed.", 0, java.lang.Integer.MAX_VALUE, type);
2596        case -1694759682: /*specialty*/  return 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);
2597        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The location(s) where this healthcare service may be provided.", 0, java.lang.Integer.MAX_VALUE, location);
2598        case 3373707: /*name*/  return new Property("name", "string", "Further description of the service as it would be presented to a consumer while searching.", 0, 1, name);
2599        case 950398559: /*comment*/  return 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, 1, comment);
2600        case -1469168622: /*extraDetails*/  return new Property("extraDetails", "markdown", "Extra details about the service that can't be placed in the other fields.", 0, 1, extraDetails);
2601        case 106642994: /*photo*/  return 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, 1, photo);
2602        case -1429363305: /*telecom*/  return new Property("telecom", "ContactPoint", "List of contacts related to this specific healthcare service.", 0, java.lang.Integer.MAX_VALUE, telecom);
2603        case -1532328299: /*coverageArea*/  return 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);
2604        case 1504575405: /*serviceProvisionCode*/  return 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);
2605        case -930847859: /*eligibility*/  return new Property("eligibility", "", "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);
2606        case -309387644: /*program*/  return new Property("program", "CodeableConcept", "Programs that this service is applicable to.", 0, java.lang.Integer.MAX_VALUE, program);
2607        case 366313883: /*characteristic*/  return new Property("characteristic", "CodeableConcept", "Collection of characteristics (attributes).", 0, java.lang.Integer.MAX_VALUE, characteristic);
2608        case -1035284522: /*communication*/  return new Property("communication", "CodeableConcept", "Some services are specifically made available in multiple languages, this property permits a directory to declare the languages this is offered in. Typically this is only provided where a service operates in communities with mixed languages used.", 0, java.lang.Integer.MAX_VALUE, communication);
2609        case -2092740898: /*referralMethod*/  return 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);
2610        case 427220062: /*appointmentRequired*/  return 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, 1, appointmentRequired);
2611        case 1873069366: /*availableTime*/  return new Property("availableTime", "", "A collection of times that the Service Site is available.", 0, java.lang.Integer.MAX_VALUE, availableTime);
2612        case -629572298: /*notAvailable*/  return 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);
2613        case -1149143617: /*availabilityExceptions*/  return 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, 1, availabilityExceptions);
2614        case 1741102485: /*endpoint*/  return new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services operated for the specific healthcare services defined at this resource.", 0, java.lang.Integer.MAX_VALUE, endpoint);
2615        default: return super.getNamedProperty(_hash, _name, _checkValid);
2616        }
2617
2618      }
2619
2620      @Override
2621      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2622        switch (hash) {
2623        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2624        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
2625        case 205136282: /*providedBy*/ return this.providedBy == null ? new Base[0] : new Base[] {this.providedBy}; // Reference
2626        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2627        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2628        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
2629        case 1901043637: /*location*/ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // Reference
2630        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2631        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
2632        case -1469168622: /*extraDetails*/ return this.extraDetails == null ? new Base[0] : new Base[] {this.extraDetails}; // MarkdownType
2633        case 106642994: /*photo*/ return this.photo == null ? new Base[0] : new Base[] {this.photo}; // Attachment
2634        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
2635        case -1532328299: /*coverageArea*/ return this.coverageArea == null ? new Base[0] : this.coverageArea.toArray(new Base[this.coverageArea.size()]); // Reference
2636        case 1504575405: /*serviceProvisionCode*/ return this.serviceProvisionCode == null ? new Base[0] : this.serviceProvisionCode.toArray(new Base[this.serviceProvisionCode.size()]); // CodeableConcept
2637        case -930847859: /*eligibility*/ return this.eligibility == null ? new Base[0] : this.eligibility.toArray(new Base[this.eligibility.size()]); // HealthcareServiceEligibilityComponent
2638        case -309387644: /*program*/ return this.program == null ? new Base[0] : this.program.toArray(new Base[this.program.size()]); // CodeableConcept
2639        case 366313883: /*characteristic*/ return this.characteristic == null ? new Base[0] : this.characteristic.toArray(new Base[this.characteristic.size()]); // CodeableConcept
2640        case -1035284522: /*communication*/ return this.communication == null ? new Base[0] : this.communication.toArray(new Base[this.communication.size()]); // CodeableConcept
2641        case -2092740898: /*referralMethod*/ return this.referralMethod == null ? new Base[0] : this.referralMethod.toArray(new Base[this.referralMethod.size()]); // CodeableConcept
2642        case 427220062: /*appointmentRequired*/ return this.appointmentRequired == null ? new Base[0] : new Base[] {this.appointmentRequired}; // BooleanType
2643        case 1873069366: /*availableTime*/ return this.availableTime == null ? new Base[0] : this.availableTime.toArray(new Base[this.availableTime.size()]); // HealthcareServiceAvailableTimeComponent
2644        case -629572298: /*notAvailable*/ return this.notAvailable == null ? new Base[0] : this.notAvailable.toArray(new Base[this.notAvailable.size()]); // HealthcareServiceNotAvailableComponent
2645        case -1149143617: /*availabilityExceptions*/ return this.availabilityExceptions == null ? new Base[0] : new Base[] {this.availabilityExceptions}; // StringType
2646        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
2647        default: return super.getProperty(hash, name, checkValid);
2648        }
2649
2650      }
2651
2652      @Override
2653      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2654        switch (hash) {
2655        case -1618432855: // identifier
2656          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2657          return value;
2658        case -1422950650: // active
2659          this.active = castToBoolean(value); // BooleanType
2660          return value;
2661        case 205136282: // providedBy
2662          this.providedBy = castToReference(value); // Reference
2663          return value;
2664        case 50511102: // category
2665          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2666          return value;
2667        case 3575610: // type
2668          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2669          return value;
2670        case -1694759682: // specialty
2671          this.getSpecialty().add(castToCodeableConcept(value)); // CodeableConcept
2672          return value;
2673        case 1901043637: // location
2674          this.getLocation().add(castToReference(value)); // Reference
2675          return value;
2676        case 3373707: // name
2677          this.name = castToString(value); // StringType
2678          return value;
2679        case 950398559: // comment
2680          this.comment = castToString(value); // StringType
2681          return value;
2682        case -1469168622: // extraDetails
2683          this.extraDetails = castToMarkdown(value); // MarkdownType
2684          return value;
2685        case 106642994: // photo
2686          this.photo = castToAttachment(value); // Attachment
2687          return value;
2688        case -1429363305: // telecom
2689          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
2690          return value;
2691        case -1532328299: // coverageArea
2692          this.getCoverageArea().add(castToReference(value)); // Reference
2693          return value;
2694        case 1504575405: // serviceProvisionCode
2695          this.getServiceProvisionCode().add(castToCodeableConcept(value)); // CodeableConcept
2696          return value;
2697        case -930847859: // eligibility
2698          this.getEligibility().add((HealthcareServiceEligibilityComponent) value); // HealthcareServiceEligibilityComponent
2699          return value;
2700        case -309387644: // program
2701          this.getProgram().add(castToCodeableConcept(value)); // CodeableConcept
2702          return value;
2703        case 366313883: // characteristic
2704          this.getCharacteristic().add(castToCodeableConcept(value)); // CodeableConcept
2705          return value;
2706        case -1035284522: // communication
2707          this.getCommunication().add(castToCodeableConcept(value)); // CodeableConcept
2708          return value;
2709        case -2092740898: // referralMethod
2710          this.getReferralMethod().add(castToCodeableConcept(value)); // CodeableConcept
2711          return value;
2712        case 427220062: // appointmentRequired
2713          this.appointmentRequired = castToBoolean(value); // BooleanType
2714          return value;
2715        case 1873069366: // availableTime
2716          this.getAvailableTime().add((HealthcareServiceAvailableTimeComponent) value); // HealthcareServiceAvailableTimeComponent
2717          return value;
2718        case -629572298: // notAvailable
2719          this.getNotAvailable().add((HealthcareServiceNotAvailableComponent) value); // HealthcareServiceNotAvailableComponent
2720          return value;
2721        case -1149143617: // availabilityExceptions
2722          this.availabilityExceptions = castToString(value); // StringType
2723          return value;
2724        case 1741102485: // endpoint
2725          this.getEndpoint().add(castToReference(value)); // Reference
2726          return value;
2727        default: return super.setProperty(hash, name, value);
2728        }
2729
2730      }
2731
2732      @Override
2733      public Base setProperty(String name, Base value) throws FHIRException {
2734        if (name.equals("identifier")) {
2735          this.getIdentifier().add(castToIdentifier(value));
2736        } else if (name.equals("active")) {
2737          this.active = castToBoolean(value); // BooleanType
2738        } else if (name.equals("providedBy")) {
2739          this.providedBy = castToReference(value); // Reference
2740        } else if (name.equals("category")) {
2741          this.getCategory().add(castToCodeableConcept(value));
2742        } else if (name.equals("type")) {
2743          this.getType().add(castToCodeableConcept(value));
2744        } else if (name.equals("specialty")) {
2745          this.getSpecialty().add(castToCodeableConcept(value));
2746        } else if (name.equals("location")) {
2747          this.getLocation().add(castToReference(value));
2748        } else if (name.equals("name")) {
2749          this.name = castToString(value); // StringType
2750        } else if (name.equals("comment")) {
2751          this.comment = castToString(value); // StringType
2752        } else if (name.equals("extraDetails")) {
2753          this.extraDetails = castToMarkdown(value); // MarkdownType
2754        } else if (name.equals("photo")) {
2755          this.photo = castToAttachment(value); // Attachment
2756        } else if (name.equals("telecom")) {
2757          this.getTelecom().add(castToContactPoint(value));
2758        } else if (name.equals("coverageArea")) {
2759          this.getCoverageArea().add(castToReference(value));
2760        } else if (name.equals("serviceProvisionCode")) {
2761          this.getServiceProvisionCode().add(castToCodeableConcept(value));
2762        } else if (name.equals("eligibility")) {
2763          this.getEligibility().add((HealthcareServiceEligibilityComponent) value);
2764        } else if (name.equals("program")) {
2765          this.getProgram().add(castToCodeableConcept(value));
2766        } else if (name.equals("characteristic")) {
2767          this.getCharacteristic().add(castToCodeableConcept(value));
2768        } else if (name.equals("communication")) {
2769          this.getCommunication().add(castToCodeableConcept(value));
2770        } else if (name.equals("referralMethod")) {
2771          this.getReferralMethod().add(castToCodeableConcept(value));
2772        } else if (name.equals("appointmentRequired")) {
2773          this.appointmentRequired = castToBoolean(value); // BooleanType
2774        } else if (name.equals("availableTime")) {
2775          this.getAvailableTime().add((HealthcareServiceAvailableTimeComponent) value);
2776        } else if (name.equals("notAvailable")) {
2777          this.getNotAvailable().add((HealthcareServiceNotAvailableComponent) value);
2778        } else if (name.equals("availabilityExceptions")) {
2779          this.availabilityExceptions = castToString(value); // StringType
2780        } else if (name.equals("endpoint")) {
2781          this.getEndpoint().add(castToReference(value));
2782        } else
2783          return super.setProperty(name, value);
2784        return value;
2785      }
2786
2787      @Override
2788      public Base makeProperty(int hash, String name) throws FHIRException {
2789        switch (hash) {
2790        case -1618432855:  return addIdentifier(); 
2791        case -1422950650:  return getActiveElement();
2792        case 205136282:  return getProvidedBy(); 
2793        case 50511102:  return addCategory(); 
2794        case 3575610:  return addType(); 
2795        case -1694759682:  return addSpecialty(); 
2796        case 1901043637:  return addLocation(); 
2797        case 3373707:  return getNameElement();
2798        case 950398559:  return getCommentElement();
2799        case -1469168622:  return getExtraDetailsElement();
2800        case 106642994:  return getPhoto(); 
2801        case -1429363305:  return addTelecom(); 
2802        case -1532328299:  return addCoverageArea(); 
2803        case 1504575405:  return addServiceProvisionCode(); 
2804        case -930847859:  return addEligibility(); 
2805        case -309387644:  return addProgram(); 
2806        case 366313883:  return addCharacteristic(); 
2807        case -1035284522:  return addCommunication(); 
2808        case -2092740898:  return addReferralMethod(); 
2809        case 427220062:  return getAppointmentRequiredElement();
2810        case 1873069366:  return addAvailableTime(); 
2811        case -629572298:  return addNotAvailable(); 
2812        case -1149143617:  return getAvailabilityExceptionsElement();
2813        case 1741102485:  return addEndpoint(); 
2814        default: return super.makeProperty(hash, name);
2815        }
2816
2817      }
2818
2819      @Override
2820      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2821        switch (hash) {
2822        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2823        case -1422950650: /*active*/ return new String[] {"boolean"};
2824        case 205136282: /*providedBy*/ return new String[] {"Reference"};
2825        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2826        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2827        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
2828        case 1901043637: /*location*/ return new String[] {"Reference"};
2829        case 3373707: /*name*/ return new String[] {"string"};
2830        case 950398559: /*comment*/ return new String[] {"string"};
2831        case -1469168622: /*extraDetails*/ return new String[] {"markdown"};
2832        case 106642994: /*photo*/ return new String[] {"Attachment"};
2833        case -1429363305: /*telecom*/ return new String[] {"ContactPoint"};
2834        case -1532328299: /*coverageArea*/ return new String[] {"Reference"};
2835        case 1504575405: /*serviceProvisionCode*/ return new String[] {"CodeableConcept"};
2836        case -930847859: /*eligibility*/ return new String[] {};
2837        case -309387644: /*program*/ return new String[] {"CodeableConcept"};
2838        case 366313883: /*characteristic*/ return new String[] {"CodeableConcept"};
2839        case -1035284522: /*communication*/ return new String[] {"CodeableConcept"};
2840        case -2092740898: /*referralMethod*/ return new String[] {"CodeableConcept"};
2841        case 427220062: /*appointmentRequired*/ return new String[] {"boolean"};
2842        case 1873069366: /*availableTime*/ return new String[] {};
2843        case -629572298: /*notAvailable*/ return new String[] {};
2844        case -1149143617: /*availabilityExceptions*/ return new String[] {"string"};
2845        case 1741102485: /*endpoint*/ return new String[] {"Reference"};
2846        default: return super.getTypesForProperty(hash, name);
2847        }
2848
2849      }
2850
2851      @Override
2852      public Base addChild(String name) throws FHIRException {
2853        if (name.equals("identifier")) {
2854          return addIdentifier();
2855        }
2856        else if (name.equals("active")) {
2857          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.active");
2858        }
2859        else if (name.equals("providedBy")) {
2860          this.providedBy = new Reference();
2861          return this.providedBy;
2862        }
2863        else if (name.equals("category")) {
2864          return addCategory();
2865        }
2866        else if (name.equals("type")) {
2867          return addType();
2868        }
2869        else if (name.equals("specialty")) {
2870          return addSpecialty();
2871        }
2872        else if (name.equals("location")) {
2873          return addLocation();
2874        }
2875        else if (name.equals("name")) {
2876          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.name");
2877        }
2878        else if (name.equals("comment")) {
2879          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.comment");
2880        }
2881        else if (name.equals("extraDetails")) {
2882          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.extraDetails");
2883        }
2884        else if (name.equals("photo")) {
2885          this.photo = new Attachment();
2886          return this.photo;
2887        }
2888        else if (name.equals("telecom")) {
2889          return addTelecom();
2890        }
2891        else if (name.equals("coverageArea")) {
2892          return addCoverageArea();
2893        }
2894        else if (name.equals("serviceProvisionCode")) {
2895          return addServiceProvisionCode();
2896        }
2897        else if (name.equals("eligibility")) {
2898          return addEligibility();
2899        }
2900        else if (name.equals("program")) {
2901          return addProgram();
2902        }
2903        else if (name.equals("characteristic")) {
2904          return addCharacteristic();
2905        }
2906        else if (name.equals("communication")) {
2907          return addCommunication();
2908        }
2909        else if (name.equals("referralMethod")) {
2910          return addReferralMethod();
2911        }
2912        else if (name.equals("appointmentRequired")) {
2913          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.appointmentRequired");
2914        }
2915        else if (name.equals("availableTime")) {
2916          return addAvailableTime();
2917        }
2918        else if (name.equals("notAvailable")) {
2919          return addNotAvailable();
2920        }
2921        else if (name.equals("availabilityExceptions")) {
2922          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availabilityExceptions");
2923        }
2924        else if (name.equals("endpoint")) {
2925          return addEndpoint();
2926        }
2927        else
2928          return super.addChild(name);
2929      }
2930
2931  public String fhirType() {
2932    return "HealthcareService";
2933
2934  }
2935
2936      public HealthcareService copy() {
2937        HealthcareService dst = new HealthcareService();
2938        copyValues(dst);
2939        return dst;
2940      }
2941
2942      public void copyValues(HealthcareService dst) {
2943        super.copyValues(dst);
2944        if (identifier != null) {
2945          dst.identifier = new ArrayList<Identifier>();
2946          for (Identifier i : identifier)
2947            dst.identifier.add(i.copy());
2948        };
2949        dst.active = active == null ? null : active.copy();
2950        dst.providedBy = providedBy == null ? null : providedBy.copy();
2951        if (category != null) {
2952          dst.category = new ArrayList<CodeableConcept>();
2953          for (CodeableConcept i : category)
2954            dst.category.add(i.copy());
2955        };
2956        if (type != null) {
2957          dst.type = new ArrayList<CodeableConcept>();
2958          for (CodeableConcept i : type)
2959            dst.type.add(i.copy());
2960        };
2961        if (specialty != null) {
2962          dst.specialty = new ArrayList<CodeableConcept>();
2963          for (CodeableConcept i : specialty)
2964            dst.specialty.add(i.copy());
2965        };
2966        if (location != null) {
2967          dst.location = new ArrayList<Reference>();
2968          for (Reference i : location)
2969            dst.location.add(i.copy());
2970        };
2971        dst.name = name == null ? null : name.copy();
2972        dst.comment = comment == null ? null : comment.copy();
2973        dst.extraDetails = extraDetails == null ? null : extraDetails.copy();
2974        dst.photo = photo == null ? null : photo.copy();
2975        if (telecom != null) {
2976          dst.telecom = new ArrayList<ContactPoint>();
2977          for (ContactPoint i : telecom)
2978            dst.telecom.add(i.copy());
2979        };
2980        if (coverageArea != null) {
2981          dst.coverageArea = new ArrayList<Reference>();
2982          for (Reference i : coverageArea)
2983            dst.coverageArea.add(i.copy());
2984        };
2985        if (serviceProvisionCode != null) {
2986          dst.serviceProvisionCode = new ArrayList<CodeableConcept>();
2987          for (CodeableConcept i : serviceProvisionCode)
2988            dst.serviceProvisionCode.add(i.copy());
2989        };
2990        if (eligibility != null) {
2991          dst.eligibility = new ArrayList<HealthcareServiceEligibilityComponent>();
2992          for (HealthcareServiceEligibilityComponent i : eligibility)
2993            dst.eligibility.add(i.copy());
2994        };
2995        if (program != null) {
2996          dst.program = new ArrayList<CodeableConcept>();
2997          for (CodeableConcept i : program)
2998            dst.program.add(i.copy());
2999        };
3000        if (characteristic != null) {
3001          dst.characteristic = new ArrayList<CodeableConcept>();
3002          for (CodeableConcept i : characteristic)
3003            dst.characteristic.add(i.copy());
3004        };
3005        if (communication != null) {
3006          dst.communication = new ArrayList<CodeableConcept>();
3007          for (CodeableConcept i : communication)
3008            dst.communication.add(i.copy());
3009        };
3010        if (referralMethod != null) {
3011          dst.referralMethod = new ArrayList<CodeableConcept>();
3012          for (CodeableConcept i : referralMethod)
3013            dst.referralMethod.add(i.copy());
3014        };
3015        dst.appointmentRequired = appointmentRequired == null ? null : appointmentRequired.copy();
3016        if (availableTime != null) {
3017          dst.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
3018          for (HealthcareServiceAvailableTimeComponent i : availableTime)
3019            dst.availableTime.add(i.copy());
3020        };
3021        if (notAvailable != null) {
3022          dst.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
3023          for (HealthcareServiceNotAvailableComponent i : notAvailable)
3024            dst.notAvailable.add(i.copy());
3025        };
3026        dst.availabilityExceptions = availabilityExceptions == null ? null : availabilityExceptions.copy();
3027        if (endpoint != null) {
3028          dst.endpoint = new ArrayList<Reference>();
3029          for (Reference i : endpoint)
3030            dst.endpoint.add(i.copy());
3031        };
3032      }
3033
3034      protected HealthcareService typedCopy() {
3035        return copy();
3036      }
3037
3038      @Override
3039      public boolean equalsDeep(Base other_) {
3040        if (!super.equalsDeep(other_))
3041          return false;
3042        if (!(other_ instanceof HealthcareService))
3043          return false;
3044        HealthcareService o = (HealthcareService) other_;
3045        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(providedBy, o.providedBy, true)
3046           && compareDeep(category, o.category, true) && compareDeep(type, o.type, true) && compareDeep(specialty, o.specialty, true)
3047           && compareDeep(location, o.location, true) && compareDeep(name, o.name, true) && compareDeep(comment, o.comment, true)
3048           && compareDeep(extraDetails, o.extraDetails, true) && compareDeep(photo, o.photo, true) && compareDeep(telecom, o.telecom, true)
3049           && compareDeep(coverageArea, o.coverageArea, true) && compareDeep(serviceProvisionCode, o.serviceProvisionCode, true)
3050           && compareDeep(eligibility, o.eligibility, true) && compareDeep(program, o.program, true) && compareDeep(characteristic, o.characteristic, true)
3051           && compareDeep(communication, o.communication, true) && compareDeep(referralMethod, o.referralMethod, true)
3052           && compareDeep(appointmentRequired, o.appointmentRequired, true) && compareDeep(availableTime, o.availableTime, true)
3053           && compareDeep(notAvailable, o.notAvailable, true) && compareDeep(availabilityExceptions, o.availabilityExceptions, true)
3054           && compareDeep(endpoint, o.endpoint, true);
3055      }
3056
3057      @Override
3058      public boolean equalsShallow(Base other_) {
3059        if (!super.equalsShallow(other_))
3060          return false;
3061        if (!(other_ instanceof HealthcareService))
3062          return false;
3063        HealthcareService o = (HealthcareService) other_;
3064        return compareValues(active, o.active, true) && compareValues(name, o.name, true) && compareValues(comment, o.comment, true)
3065           && compareValues(extraDetails, o.extraDetails, true) && compareValues(appointmentRequired, o.appointmentRequired, true)
3066           && compareValues(availabilityExceptions, o.availabilityExceptions, true);
3067      }
3068
3069      public boolean isEmpty() {
3070        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, providedBy
3071          , category, type, specialty, location, name, comment, extraDetails, photo, telecom
3072          , coverageArea, serviceProvisionCode, eligibility, program, characteristic, communication
3073          , referralMethod, appointmentRequired, availableTime, notAvailable, availabilityExceptions
3074          , endpoint);
3075      }
3076
3077  @Override
3078  public ResourceType getResourceType() {
3079    return ResourceType.HealthcareService;
3080   }
3081
3082 /**
3083   * Search parameter: <b>identifier</b>
3084   * <p>
3085   * Description: <b>External identifiers for this item</b><br>
3086   * Type: <b>token</b><br>
3087   * Path: <b>HealthcareService.identifier</b><br>
3088   * </p>
3089   */
3090  @SearchParamDefinition(name="identifier", path="HealthcareService.identifier", description="External identifiers for this item", type="token" )
3091  public static final String SP_IDENTIFIER = "identifier";
3092 /**
3093   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3094   * <p>
3095   * Description: <b>External identifiers for this item</b><br>
3096   * Type: <b>token</b><br>
3097   * Path: <b>HealthcareService.identifier</b><br>
3098   * </p>
3099   */
3100  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3101
3102 /**
3103   * Search parameter: <b>specialty</b>
3104   * <p>
3105   * Description: <b>The specialty of the service provided by this healthcare service</b><br>
3106   * Type: <b>token</b><br>
3107   * Path: <b>HealthcareService.specialty</b><br>
3108   * </p>
3109   */
3110  @SearchParamDefinition(name="specialty", path="HealthcareService.specialty", description="The specialty of the service provided by this healthcare service", type="token" )
3111  public static final String SP_SPECIALTY = "specialty";
3112 /**
3113   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
3114   * <p>
3115   * Description: <b>The specialty of the service provided by this healthcare service</b><br>
3116   * Type: <b>token</b><br>
3117   * Path: <b>HealthcareService.specialty</b><br>
3118   * </p>
3119   */
3120  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIALTY);
3121
3122 /**
3123   * Search parameter: <b>endpoint</b>
3124   * <p>
3125   * Description: <b>Technical endpoints providing access to electronic services operated for the healthcare service</b><br>
3126   * Type: <b>reference</b><br>
3127   * Path: <b>HealthcareService.endpoint</b><br>
3128   * </p>
3129   */
3130  @SearchParamDefinition(name="endpoint", path="HealthcareService.endpoint", description="Technical endpoints providing access to electronic services operated for the healthcare service", type="reference", target={Endpoint.class } )
3131  public static final String SP_ENDPOINT = "endpoint";
3132 /**
3133   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
3134   * <p>
3135   * Description: <b>Technical endpoints providing access to electronic services operated for the healthcare service</b><br>
3136   * Type: <b>reference</b><br>
3137   * Path: <b>HealthcareService.endpoint</b><br>
3138   * </p>
3139   */
3140  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENDPOINT);
3141
3142/**
3143   * Constant for fluent queries to be used to add include statements. Specifies
3144   * the path value of "<b>HealthcareService:endpoint</b>".
3145   */
3146  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include("HealthcareService:endpoint").toLocked();
3147
3148 /**
3149   * Search parameter: <b>service-category</b>
3150   * <p>
3151   * Description: <b>Service Category of the Healthcare Service</b><br>
3152   * Type: <b>token</b><br>
3153   * Path: <b>HealthcareService.category</b><br>
3154   * </p>
3155   */
3156  @SearchParamDefinition(name="service-category", path="HealthcareService.category", description="Service Category of the Healthcare Service", type="token" )
3157  public static final String SP_SERVICE_CATEGORY = "service-category";
3158 /**
3159   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
3160   * <p>
3161   * Description: <b>Service Category of the Healthcare Service</b><br>
3162   * Type: <b>token</b><br>
3163   * Path: <b>HealthcareService.category</b><br>
3164   * </p>
3165   */
3166  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_CATEGORY);
3167
3168 /**
3169   * Search parameter: <b>coverage-area</b>
3170   * <p>
3171   * Description: <b>Location(s) service is intended for/available to</b><br>
3172   * Type: <b>reference</b><br>
3173   * Path: <b>HealthcareService.coverageArea</b><br>
3174   * </p>
3175   */
3176  @SearchParamDefinition(name="coverage-area", path="HealthcareService.coverageArea", description="Location(s) service is intended for/available to", type="reference", target={Location.class } )
3177  public static final String SP_COVERAGE_AREA = "coverage-area";
3178 /**
3179   * <b>Fluent Client</b> search parameter constant for <b>coverage-area</b>
3180   * <p>
3181   * Description: <b>Location(s) service is intended for/available to</b><br>
3182   * Type: <b>reference</b><br>
3183   * Path: <b>HealthcareService.coverageArea</b><br>
3184   * </p>
3185   */
3186  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE_AREA = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE_AREA);
3187
3188/**
3189   * Constant for fluent queries to be used to add include statements. Specifies
3190   * the path value of "<b>HealthcareService:coverage-area</b>".
3191   */
3192  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE_AREA = new ca.uhn.fhir.model.api.Include("HealthcareService:coverage-area").toLocked();
3193
3194 /**
3195   * Search parameter: <b>service-type</b>
3196   * <p>
3197   * Description: <b>The type of service provided by this healthcare service</b><br>
3198   * Type: <b>token</b><br>
3199   * Path: <b>HealthcareService.type</b><br>
3200   * </p>
3201   */
3202  @SearchParamDefinition(name="service-type", path="HealthcareService.type", description="The type of service provided by this healthcare service", type="token" )
3203  public static final String SP_SERVICE_TYPE = "service-type";
3204 /**
3205   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
3206   * <p>
3207   * Description: <b>The type of service provided by this healthcare service</b><br>
3208   * Type: <b>token</b><br>
3209   * Path: <b>HealthcareService.type</b><br>
3210   * </p>
3211   */
3212  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_TYPE);
3213
3214 /**
3215   * Search parameter: <b>organization</b>
3216   * <p>
3217   * Description: <b>The organization that provides this Healthcare Service</b><br>
3218   * Type: <b>reference</b><br>
3219   * Path: <b>HealthcareService.providedBy</b><br>
3220   * </p>
3221   */
3222  @SearchParamDefinition(name="organization", path="HealthcareService.providedBy", description="The organization that provides this Healthcare Service", type="reference", target={Organization.class } )
3223  public static final String SP_ORGANIZATION = "organization";
3224 /**
3225   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
3226   * <p>
3227   * Description: <b>The organization that provides this Healthcare Service</b><br>
3228   * Type: <b>reference</b><br>
3229   * Path: <b>HealthcareService.providedBy</b><br>
3230   * </p>
3231   */
3232  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
3233
3234/**
3235   * Constant for fluent queries to be used to add include statements. Specifies
3236   * the path value of "<b>HealthcareService:organization</b>".
3237   */
3238  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("HealthcareService:organization").toLocked();
3239
3240 /**
3241   * Search parameter: <b>name</b>
3242   * <p>
3243   * Description: <b>A portion of the Healthcare service name</b><br>
3244   * Type: <b>string</b><br>
3245   * Path: <b>HealthcareService.name</b><br>
3246   * </p>
3247   */
3248  @SearchParamDefinition(name="name", path="HealthcareService.name", description="A portion of the Healthcare service name", type="string" )
3249  public static final String SP_NAME = "name";
3250 /**
3251   * <b>Fluent Client</b> search parameter constant for <b>name</b>
3252   * <p>
3253   * Description: <b>A portion of the Healthcare service name</b><br>
3254   * Type: <b>string</b><br>
3255   * Path: <b>HealthcareService.name</b><br>
3256   * </p>
3257   */
3258  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
3259
3260 /**
3261   * Search parameter: <b>active</b>
3262   * <p>
3263   * Description: <b>The Healthcare Service is currently marked as active</b><br>
3264   * Type: <b>token</b><br>
3265   * Path: <b>HealthcareService.active</b><br>
3266   * </p>
3267   */
3268  @SearchParamDefinition(name="active", path="HealthcareService.active", description="The Healthcare Service is currently marked as active", type="token" )
3269  public static final String SP_ACTIVE = "active";
3270 /**
3271   * <b>Fluent Client</b> search parameter constant for <b>active</b>
3272   * <p>
3273   * Description: <b>The Healthcare Service is currently marked as active</b><br>
3274   * Type: <b>token</b><br>
3275   * Path: <b>HealthcareService.active</b><br>
3276   * </p>
3277   */
3278  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
3279
3280 /**
3281   * Search parameter: <b>location</b>
3282   * <p>
3283   * Description: <b>The location of the Healthcare Service</b><br>
3284   * Type: <b>reference</b><br>
3285   * Path: <b>HealthcareService.location</b><br>
3286   * </p>
3287   */
3288  @SearchParamDefinition(name="location", path="HealthcareService.location", description="The location of the Healthcare Service", type="reference", target={Location.class } )
3289  public static final String SP_LOCATION = "location";
3290 /**
3291   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3292   * <p>
3293   * Description: <b>The location of the Healthcare Service</b><br>
3294   * Type: <b>reference</b><br>
3295   * Path: <b>HealthcareService.location</b><br>
3296   * </p>
3297   */
3298  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3299
3300/**
3301   * Constant for fluent queries to be used to add include statements. Specifies
3302   * the path value of "<b>HealthcareService:location</b>".
3303   */
3304  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("HealthcareService:location").toLocked();
3305
3306 /**
3307   * Search parameter: <b>program</b>
3308   * <p>
3309   * Description: <b>One of the Programs supported by this HealthcareService</b><br>
3310   * Type: <b>token</b><br>
3311   * Path: <b>HealthcareService.program</b><br>
3312   * </p>
3313   */
3314  @SearchParamDefinition(name="program", path="HealthcareService.program", description="One of the Programs supported by this HealthcareService", type="token" )
3315  public static final String SP_PROGRAM = "program";
3316 /**
3317   * <b>Fluent Client</b> search parameter constant for <b>program</b>
3318   * <p>
3319   * Description: <b>One of the Programs supported by this HealthcareService</b><br>
3320   * Type: <b>token</b><br>
3321   * Path: <b>HealthcareService.program</b><br>
3322   * </p>
3323   */
3324  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PROGRAM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PROGRAM);
3325
3326 /**
3327   * Search parameter: <b>characteristic</b>
3328   * <p>
3329   * Description: <b>One of the HealthcareService's characteristics</b><br>
3330   * Type: <b>token</b><br>
3331   * Path: <b>HealthcareService.characteristic</b><br>
3332   * </p>
3333   */
3334  @SearchParamDefinition(name="characteristic", path="HealthcareService.characteristic", description="One of the HealthcareService's characteristics", type="token" )
3335  public static final String SP_CHARACTERISTIC = "characteristic";
3336 /**
3337   * <b>Fluent Client</b> search parameter constant for <b>characteristic</b>
3338   * <p>
3339   * Description: <b>One of the HealthcareService's characteristics</b><br>
3340   * Type: <b>token</b><br>
3341   * Path: <b>HealthcareService.characteristic</b><br>
3342   * </p>
3343   */
3344  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CHARACTERISTIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CHARACTERISTIC);
3345
3346
3347}