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