001package org.hl7.fhir.r4.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.List;
055
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
058import org.hl7.fhir.utilities.Utilities;
059
060import ca.uhn.fhir.model.api.annotation.Block;
061import ca.uhn.fhir.model.api.annotation.Child;
062import ca.uhn.fhir.model.api.annotation.Description;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065/**
066 * The details of a healthcare service available at a location.
067 */
068@ResourceDef(name="HealthcareService", profile="http://hl7.org/fhir/StructureDefinition/HealthcareService")
069public class HealthcareService extends DomainResource {
070
071    public enum DaysOfWeek {
072        /**
073         * Monday.
074         */
075        MON, 
076        /**
077         * Tuesday.
078         */
079        TUE, 
080        /**
081         * Wednesday.
082         */
083        WED, 
084        /**
085         * Thursday.
086         */
087        THU, 
088        /**
089         * Friday.
090         */
091        FRI, 
092        /**
093         * Saturday.
094         */
095        SAT, 
096        /**
097         * Sunday.
098         */
099        SUN, 
100        /**
101         * added to help the parsers with the generic types
102         */
103        NULL;
104        public static DaysOfWeek fromCode(String codeString) throws FHIRException {
105            if (codeString == null || "".equals(codeString))
106                return null;
107        if ("mon".equals(codeString))
108          return MON;
109        if ("tue".equals(codeString))
110          return TUE;
111        if ("wed".equals(codeString))
112          return WED;
113        if ("thu".equals(codeString))
114          return THU;
115        if ("fri".equals(codeString))
116          return FRI;
117        if ("sat".equals(codeString))
118          return SAT;
119        if ("sun".equals(codeString))
120          return SUN;
121        if (Configuration.isAcceptInvalidEnums())
122          return null;
123        else
124          throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
125        }
126        public String toCode() {
127          switch (this) {
128            case MON: return "mon";
129            case TUE: return "tue";
130            case WED: return "wed";
131            case THU: return "thu";
132            case FRI: return "fri";
133            case SAT: return "sat";
134            case SUN: return "sun";
135            default: return "?";
136          }
137        }
138        public String getSystem() {
139          switch (this) {
140            case MON: return "http://hl7.org/fhir/days-of-week";
141            case TUE: return "http://hl7.org/fhir/days-of-week";
142            case WED: return "http://hl7.org/fhir/days-of-week";
143            case THU: return "http://hl7.org/fhir/days-of-week";
144            case FRI: return "http://hl7.org/fhir/days-of-week";
145            case SAT: return "http://hl7.org/fhir/days-of-week";
146            case SUN: return "http://hl7.org/fhir/days-of-week";
147            default: return "?";
148          }
149        }
150        public String getDefinition() {
151          switch (this) {
152            case MON: return "Monday.";
153            case TUE: return "Tuesday.";
154            case WED: return "Wednesday.";
155            case THU: return "Thursday.";
156            case FRI: return "Friday.";
157            case SAT: return "Saturday.";
158            case SUN: return "Sunday.";
159            default: return "?";
160          }
161        }
162        public String getDisplay() {
163          switch (this) {
164            case MON: return "Monday";
165            case TUE: return "Tuesday";
166            case WED: return "Wednesday";
167            case THU: return "Thursday";
168            case FRI: return "Friday";
169            case SAT: return "Saturday";
170            case SUN: return "Sunday";
171            default: return "?";
172          }
173        }
174    }
175
176  public static class DaysOfWeekEnumFactory implements EnumFactory<DaysOfWeek> {
177    public DaysOfWeek fromCode(String codeString) throws IllegalArgumentException {
178      if (codeString == null || "".equals(codeString))
179            if (codeString == null || "".equals(codeString))
180                return null;
181        if ("mon".equals(codeString))
182          return DaysOfWeek.MON;
183        if ("tue".equals(codeString))
184          return DaysOfWeek.TUE;
185        if ("wed".equals(codeString))
186          return DaysOfWeek.WED;
187        if ("thu".equals(codeString))
188          return DaysOfWeek.THU;
189        if ("fri".equals(codeString))
190          return DaysOfWeek.FRI;
191        if ("sat".equals(codeString))
192          return DaysOfWeek.SAT;
193        if ("sun".equals(codeString))
194          return DaysOfWeek.SUN;
195        throw new IllegalArgumentException("Unknown DaysOfWeek code '"+codeString+"'");
196        }
197        public Enumeration<DaysOfWeek> fromType(Base code) throws FHIRException {
198          if (code == null)
199            return null;
200          if (code.isEmpty())
201            return new Enumeration<DaysOfWeek>(this);
202          String codeString = ((PrimitiveType) code).asStringValue();
203          if (codeString == null || "".equals(codeString))
204            return null;
205        if ("mon".equals(codeString))
206          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.MON);
207        if ("tue".equals(codeString))
208          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.TUE);
209        if ("wed".equals(codeString))
210          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.WED);
211        if ("thu".equals(codeString))
212          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.THU);
213        if ("fri".equals(codeString))
214          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.FRI);
215        if ("sat".equals(codeString))
216          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SAT);
217        if ("sun".equals(codeString))
218          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SUN);
219        throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
220        }
221    public String toCode(DaysOfWeek code) {
222      if (code == DaysOfWeek.MON)
223        return "mon";
224      if (code == DaysOfWeek.TUE)
225        return "tue";
226      if (code == DaysOfWeek.WED)
227        return "wed";
228      if (code == DaysOfWeek.THU)
229        return "thu";
230      if (code == DaysOfWeek.FRI)
231        return "fri";
232      if (code == DaysOfWeek.SAT)
233        return "sat";
234      if (code == DaysOfWeek.SUN)
235        return "sun";
236      return "?";
237      }
238    public String toSystem(DaysOfWeek code) {
239      return code.getSystem();
240      }
241    }
242
243    @Block()
244    public static class HealthcareServiceEligibilityComponent extends BackboneElement implements IBaseBackboneElement {
245        /**
246         * Coded value for the eligibility.
247         */
248        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
249        @Description(shortDefinition="Coded value for the eligibility", formalDefinition="Coded value for the eligibility." )
250        protected CodeableConcept code;
251
252        /**
253         * Describes the eligibility conditions for the service.
254         */
255        @Child(name = "comment", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
256        @Description(shortDefinition="Describes the eligibility conditions for the service", formalDefinition="Describes the eligibility conditions for the service." )
257        protected MarkdownType comment;
258
259        private static final long serialVersionUID = 1078065348L;
260
261    /**
262     * Constructor
263     */
264      public HealthcareServiceEligibilityComponent() {
265        super();
266      }
267
268        /**
269         * @return {@link #code} (Coded value for the eligibility.)
270         */
271        public CodeableConcept getCode() { 
272          if (this.code == null)
273            if (Configuration.errorOnAutoCreate())
274              throw new Error("Attempt to auto-create HealthcareServiceEligibilityComponent.code");
275            else if (Configuration.doAutoCreate())
276              this.code = new CodeableConcept(); // cc
277          return this.code;
278        }
279
280        public boolean hasCode() { 
281          return this.code != null && !this.code.isEmpty();
282        }
283
284        /**
285         * @param value {@link #code} (Coded value for the eligibility.)
286         */
287        public HealthcareServiceEligibilityComponent setCode(CodeableConcept value) { 
288          this.code = value;
289          return this;
290        }
291
292        /**
293         * @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
294         */
295        public MarkdownType getCommentElement() { 
296          if (this.comment == null)
297            if (Configuration.errorOnAutoCreate())
298              throw new Error("Attempt to auto-create HealthcareServiceEligibilityComponent.comment");
299            else if (Configuration.doAutoCreate())
300              this.comment = new MarkdownType(); // bb
301          return this.comment;
302        }
303
304        public boolean hasCommentElement() { 
305          return this.comment != null && !this.comment.isEmpty();
306        }
307
308        public boolean hasComment() { 
309          return this.comment != null && !this.comment.isEmpty();
310        }
311
312        /**
313         * @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
314         */
315        public HealthcareServiceEligibilityComponent setCommentElement(MarkdownType value) { 
316          this.comment = value;
317          return this;
318        }
319
320        /**
321         * @return Describes the eligibility conditions for the service.
322         */
323        public String getComment() { 
324          return this.comment == null ? null : this.comment.getValue();
325        }
326
327        /**
328         * @param value Describes the eligibility conditions for the service.
329         */
330        public HealthcareServiceEligibilityComponent setComment(String value) { 
331          if (value == null)
332            this.comment = null;
333          else {
334            if (this.comment == null)
335              this.comment = new MarkdownType();
336            this.comment.setValue(value);
337          }
338          return this;
339        }
340
341        protected void listChildren(List<Property> children) {
342          super.listChildren(children);
343          children.add(new Property("code", "CodeableConcept", "Coded value for the eligibility.", 0, 1, code));
344          children.add(new Property("comment", "markdown", "Describes the eligibility conditions for the service.", 0, 1, comment));
345        }
346
347        @Override
348        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
349          switch (_hash) {
350          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded value for the eligibility.", 0, 1, code);
351          case 950398559: /*comment*/  return new Property("comment", "markdown", "Describes the eligibility conditions for the service.", 0, 1, comment);
352          default: return super.getNamedProperty(_hash, _name, _checkValid);
353          }
354
355        }
356
357      @Override
358      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
359        switch (hash) {
360        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
361        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // MarkdownType
362        default: return super.getProperty(hash, name, checkValid);
363        }
364
365      }
366
367      @Override
368      public Base setProperty(int hash, String name, Base value) throws FHIRException {
369        switch (hash) {
370        case 3059181: // code
371          this.code = castToCodeableConcept(value); // CodeableConcept
372          return value;
373        case 950398559: // comment
374          this.comment = castToMarkdown(value); // MarkdownType
375          return value;
376        default: return super.setProperty(hash, name, value);
377        }
378
379      }
380
381      @Override
382      public Base setProperty(String name, Base value) throws FHIRException {
383        if (name.equals("code")) {
384          this.code = castToCodeableConcept(value); // CodeableConcept
385        } else if (name.equals("comment")) {
386          this.comment = castToMarkdown(value); // MarkdownType
387        } else
388          return super.setProperty(name, value);
389        return value;
390      }
391
392      @Override
393      public Base makeProperty(int hash, String name) throws FHIRException {
394        switch (hash) {
395        case 3059181:  return getCode(); 
396        case 950398559:  return getCommentElement();
397        default: return super.makeProperty(hash, name);
398        }
399
400      }
401
402      @Override
403      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
404        switch (hash) {
405        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
406        case 950398559: /*comment*/ return new String[] {"markdown"};
407        default: return super.getTypesForProperty(hash, name);
408        }
409
410      }
411
412      @Override
413      public Base addChild(String name) throws FHIRException {
414        if (name.equals("code")) {
415          this.code = new CodeableConcept();
416          return this.code;
417        }
418        else if (name.equals("comment")) {
419          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.comment");
420        }
421        else
422          return super.addChild(name);
423      }
424
425      public HealthcareServiceEligibilityComponent copy() {
426        HealthcareServiceEligibilityComponent dst = new HealthcareServiceEligibilityComponent();
427        copyValues(dst);
428        dst.code = code == null ? null : code.copy();
429        dst.comment = comment == null ? null : comment.copy();
430        return dst;
431      }
432
433      @Override
434      public boolean equalsDeep(Base other_) {
435        if (!super.equalsDeep(other_))
436          return false;
437        if (!(other_ instanceof HealthcareServiceEligibilityComponent))
438          return false;
439        HealthcareServiceEligibilityComponent o = (HealthcareServiceEligibilityComponent) other_;
440        return compareDeep(code, o.code, true) && compareDeep(comment, o.comment, true);
441      }
442
443      @Override
444      public boolean equalsShallow(Base other_) {
445        if (!super.equalsShallow(other_))
446          return false;
447        if (!(other_ instanceof HealthcareServiceEligibilityComponent))
448          return false;
449        HealthcareServiceEligibilityComponent o = (HealthcareServiceEligibilityComponent) other_;
450        return compareValues(comment, o.comment, true);
451      }
452
453      public boolean isEmpty() {
454        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, comment);
455      }
456
457  public String fhirType() {
458    return "HealthcareService.eligibility";
459
460  }
461
462  }
463
464    @Block()
465    public static class HealthcareServiceAvailableTimeComponent extends BackboneElement implements IBaseBackboneElement {
466        /**
467         * Indicates which days of the week are available between the start and end Times.
468         */
469        @Child(name = "daysOfWeek", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
470        @Description(shortDefinition="mon | tue | wed | thu | fri | sat | sun", formalDefinition="Indicates which days of the week are available between the start and end Times." )
471        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/days-of-week")
472        protected List<Enumeration<DaysOfWeek>> daysOfWeek;
473
474        /**
475         * Is this always available? (hence times are irrelevant) e.g. 24 hour service.
476         */
477        @Child(name = "allDay", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
478        @Description(shortDefinition="Always available? e.g. 24 hour service", formalDefinition="Is this always available? (hence times are irrelevant) e.g. 24 hour service." )
479        protected BooleanType allDay;
480
481        /**
482         * The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
483         */
484        @Child(name = "availableStartTime", type = {TimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
485        @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." )
486        protected TimeType availableStartTime;
487
488        /**
489         * The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
490         */
491        @Child(name = "availableEndTime", type = {TimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
492        @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." )
493        protected TimeType availableEndTime;
494
495        private static final long serialVersionUID = -2139510127L;
496
497    /**
498     * Constructor
499     */
500      public HealthcareServiceAvailableTimeComponent() {
501        super();
502      }
503
504        /**
505         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
506         */
507        public List<Enumeration<DaysOfWeek>> getDaysOfWeek() { 
508          if (this.daysOfWeek == null)
509            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
510          return this.daysOfWeek;
511        }
512
513        /**
514         * @return Returns a reference to <code>this</code> for easy method chaining
515         */
516        public HealthcareServiceAvailableTimeComponent setDaysOfWeek(List<Enumeration<DaysOfWeek>> theDaysOfWeek) { 
517          this.daysOfWeek = theDaysOfWeek;
518          return this;
519        }
520
521        public boolean hasDaysOfWeek() { 
522          if (this.daysOfWeek == null)
523            return false;
524          for (Enumeration<DaysOfWeek> item : this.daysOfWeek)
525            if (!item.isEmpty())
526              return true;
527          return false;
528        }
529
530        /**
531         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
532         */
533        public Enumeration<DaysOfWeek> addDaysOfWeekElement() {//2 
534          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
535          if (this.daysOfWeek == null)
536            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
537          this.daysOfWeek.add(t);
538          return t;
539        }
540
541        /**
542         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
543         */
544        public HealthcareServiceAvailableTimeComponent addDaysOfWeek(DaysOfWeek value) { //1
545          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
546          t.setValue(value);
547          if (this.daysOfWeek == null)
548            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
549          this.daysOfWeek.add(t);
550          return this;
551        }
552
553        /**
554         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
555         */
556        public boolean hasDaysOfWeek(DaysOfWeek value) { 
557          if (this.daysOfWeek == null)
558            return false;
559          for (Enumeration<DaysOfWeek> v : this.daysOfWeek)
560            if (v.getValue().equals(value)) // code
561              return true;
562          return false;
563        }
564
565        /**
566         * @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
567         */
568        public BooleanType getAllDayElement() { 
569          if (this.allDay == null)
570            if (Configuration.errorOnAutoCreate())
571              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.allDay");
572            else if (Configuration.doAutoCreate())
573              this.allDay = new BooleanType(); // bb
574          return this.allDay;
575        }
576
577        public boolean hasAllDayElement() { 
578          return this.allDay != null && !this.allDay.isEmpty();
579        }
580
581        public boolean hasAllDay() { 
582          return this.allDay != null && !this.allDay.isEmpty();
583        }
584
585        /**
586         * @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
587         */
588        public HealthcareServiceAvailableTimeComponent setAllDayElement(BooleanType value) { 
589          this.allDay = value;
590          return this;
591        }
592
593        /**
594         * @return Is this always available? (hence times are irrelevant) e.g. 24 hour service.
595         */
596        public boolean getAllDay() { 
597          return this.allDay == null || this.allDay.isEmpty() ? false : this.allDay.getValue();
598        }
599
600        /**
601         * @param value Is this always available? (hence times are irrelevant) e.g. 24 hour service.
602         */
603        public HealthcareServiceAvailableTimeComponent setAllDay(boolean value) { 
604            if (this.allDay == null)
605              this.allDay = new BooleanType();
606            this.allDay.setValue(value);
607          return this;
608        }
609
610        /**
611         * @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
612         */
613        public TimeType getAvailableStartTimeElement() { 
614          if (this.availableStartTime == null)
615            if (Configuration.errorOnAutoCreate())
616              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.availableStartTime");
617            else if (Configuration.doAutoCreate())
618              this.availableStartTime = new TimeType(); // bb
619          return this.availableStartTime;
620        }
621
622        public boolean hasAvailableStartTimeElement() { 
623          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
624        }
625
626        public boolean hasAvailableStartTime() { 
627          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
628        }
629
630        /**
631         * @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
632         */
633        public HealthcareServiceAvailableTimeComponent setAvailableStartTimeElement(TimeType value) { 
634          this.availableStartTime = value;
635          return this;
636        }
637
638        /**
639         * @return The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
640         */
641        public String getAvailableStartTime() { 
642          return this.availableStartTime == null ? null : this.availableStartTime.getValue();
643        }
644
645        /**
646         * @param value The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
647         */
648        public HealthcareServiceAvailableTimeComponent setAvailableStartTime(String value) { 
649          if (value == null)
650            this.availableStartTime = null;
651          else {
652            if (this.availableStartTime == null)
653              this.availableStartTime = new TimeType();
654            this.availableStartTime.setValue(value);
655          }
656          return this;
657        }
658
659        /**
660         * @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
661         */
662        public TimeType getAvailableEndTimeElement() { 
663          if (this.availableEndTime == null)
664            if (Configuration.errorOnAutoCreate())
665              throw new Error("Attempt to auto-create HealthcareServiceAvailableTimeComponent.availableEndTime");
666            else if (Configuration.doAutoCreate())
667              this.availableEndTime = new TimeType(); // bb
668          return this.availableEndTime;
669        }
670
671        public boolean hasAvailableEndTimeElement() { 
672          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
673        }
674
675        public boolean hasAvailableEndTime() { 
676          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
677        }
678
679        /**
680         * @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
681         */
682        public HealthcareServiceAvailableTimeComponent setAvailableEndTimeElement(TimeType value) { 
683          this.availableEndTime = value;
684          return this;
685        }
686
687        /**
688         * @return The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
689         */
690        public String getAvailableEndTime() { 
691          return this.availableEndTime == null ? null : this.availableEndTime.getValue();
692        }
693
694        /**
695         * @param value The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
696         */
697        public HealthcareServiceAvailableTimeComponent setAvailableEndTime(String value) { 
698          if (value == null)
699            this.availableEndTime = null;
700          else {
701            if (this.availableEndTime == null)
702              this.availableEndTime = new TimeType();
703            this.availableEndTime.setValue(value);
704          }
705          return this;
706        }
707
708        protected void listChildren(List<Property> children) {
709          super.listChildren(children);
710          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));
711          children.add(new Property("allDay", "boolean", "Is this always available? (hence times are irrelevant) e.g. 24 hour service.", 0, 1, allDay));
712          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));
713          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));
714        }
715
716        @Override
717        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
718          switch (_hash) {
719          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);
720          case -1414913477: /*allDay*/  return new Property("allDay", "boolean", "Is this always available? (hence times are irrelevant) e.g. 24 hour service.", 0, 1, allDay);
721          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);
722          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);
723          default: return super.getNamedProperty(_hash, _name, _checkValid);
724          }
725
726        }
727
728      @Override
729      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
730        switch (hash) {
731        case 68050338: /*daysOfWeek*/ return this.daysOfWeek == null ? new Base[0] : this.daysOfWeek.toArray(new Base[this.daysOfWeek.size()]); // Enumeration<DaysOfWeek>
732        case -1414913477: /*allDay*/ return this.allDay == null ? new Base[0] : new Base[] {this.allDay}; // BooleanType
733        case -1039453818: /*availableStartTime*/ return this.availableStartTime == null ? new Base[0] : new Base[] {this.availableStartTime}; // TimeType
734        case 101151551: /*availableEndTime*/ return this.availableEndTime == null ? new Base[0] : new Base[] {this.availableEndTime}; // TimeType
735        default: return super.getProperty(hash, name, checkValid);
736        }
737
738      }
739
740      @Override
741      public Base setProperty(int hash, String name, Base value) throws FHIRException {
742        switch (hash) {
743        case 68050338: // daysOfWeek
744          value = new DaysOfWeekEnumFactory().fromType(castToCode(value));
745          this.getDaysOfWeek().add((Enumeration) value); // Enumeration<DaysOfWeek>
746          return value;
747        case -1414913477: // allDay
748          this.allDay = castToBoolean(value); // BooleanType
749          return value;
750        case -1039453818: // availableStartTime
751          this.availableStartTime = castToTime(value); // TimeType
752          return value;
753        case 101151551: // availableEndTime
754          this.availableEndTime = castToTime(value); // TimeType
755          return value;
756        default: return super.setProperty(hash, name, value);
757        }
758
759      }
760
761      @Override
762      public Base setProperty(String name, Base value) throws FHIRException {
763        if (name.equals("daysOfWeek")) {
764          value = new DaysOfWeekEnumFactory().fromType(castToCode(value));
765          this.getDaysOfWeek().add((Enumeration) value);
766        } else if (name.equals("allDay")) {
767          this.allDay = castToBoolean(value); // BooleanType
768        } else if (name.equals("availableStartTime")) {
769          this.availableStartTime = castToTime(value); // TimeType
770        } else if (name.equals("availableEndTime")) {
771          this.availableEndTime = castToTime(value); // TimeType
772        } else
773          return super.setProperty(name, value);
774        return value;
775      }
776
777      @Override
778      public Base makeProperty(int hash, String name) throws FHIRException {
779        switch (hash) {
780        case 68050338:  return addDaysOfWeekElement();
781        case -1414913477:  return getAllDayElement();
782        case -1039453818:  return getAvailableStartTimeElement();
783        case 101151551:  return getAvailableEndTimeElement();
784        default: return super.makeProperty(hash, name);
785        }
786
787      }
788
789      @Override
790      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
791        switch (hash) {
792        case 68050338: /*daysOfWeek*/ return new String[] {"code"};
793        case -1414913477: /*allDay*/ return new String[] {"boolean"};
794        case -1039453818: /*availableStartTime*/ return new String[] {"time"};
795        case 101151551: /*availableEndTime*/ return new String[] {"time"};
796        default: return super.getTypesForProperty(hash, name);
797        }
798
799      }
800
801      @Override
802      public Base addChild(String name) throws FHIRException {
803        if (name.equals("daysOfWeek")) {
804          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.daysOfWeek");
805        }
806        else if (name.equals("allDay")) {
807          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.allDay");
808        }
809        else if (name.equals("availableStartTime")) {
810          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availableStartTime");
811        }
812        else if (name.equals("availableEndTime")) {
813          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.availableEndTime");
814        }
815        else
816          return super.addChild(name);
817      }
818
819      public HealthcareServiceAvailableTimeComponent copy() {
820        HealthcareServiceAvailableTimeComponent dst = new HealthcareServiceAvailableTimeComponent();
821        copyValues(dst);
822        if (daysOfWeek != null) {
823          dst.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
824          for (Enumeration<DaysOfWeek> i : daysOfWeek)
825            dst.daysOfWeek.add(i.copy());
826        };
827        dst.allDay = allDay == null ? null : allDay.copy();
828        dst.availableStartTime = availableStartTime == null ? null : availableStartTime.copy();
829        dst.availableEndTime = availableEndTime == null ? null : availableEndTime.copy();
830        return dst;
831      }
832
833      @Override
834      public boolean equalsDeep(Base other_) {
835        if (!super.equalsDeep(other_))
836          return false;
837        if (!(other_ instanceof HealthcareServiceAvailableTimeComponent))
838          return false;
839        HealthcareServiceAvailableTimeComponent o = (HealthcareServiceAvailableTimeComponent) other_;
840        return compareDeep(daysOfWeek, o.daysOfWeek, true) && compareDeep(allDay, o.allDay, true) && compareDeep(availableStartTime, o.availableStartTime, true)
841           && compareDeep(availableEndTime, o.availableEndTime, true);
842      }
843
844      @Override
845      public boolean equalsShallow(Base other_) {
846        if (!super.equalsShallow(other_))
847          return false;
848        if (!(other_ instanceof HealthcareServiceAvailableTimeComponent))
849          return false;
850        HealthcareServiceAvailableTimeComponent o = (HealthcareServiceAvailableTimeComponent) other_;
851        return compareValues(daysOfWeek, o.daysOfWeek, true) && compareValues(allDay, o.allDay, true) && compareValues(availableStartTime, o.availableStartTime, true)
852           && compareValues(availableEndTime, o.availableEndTime, true);
853      }
854
855      public boolean isEmpty() {
856        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(daysOfWeek, allDay, availableStartTime
857          , availableEndTime);
858      }
859
860  public String fhirType() {
861    return "HealthcareService.availableTime";
862
863  }
864
865  }
866
867    @Block()
868    public static class HealthcareServiceNotAvailableComponent extends BackboneElement implements IBaseBackboneElement {
869        /**
870         * The reason that can be presented to the user as to why this time is not available.
871         */
872        @Child(name = "description", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
873        @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." )
874        protected StringType description;
875
876        /**
877         * Service is not available (seasonally or for a public holiday) from this date.
878         */
879        @Child(name = "during", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
880        @Description(shortDefinition="Service not available from this date", formalDefinition="Service is not available (seasonally or for a public holiday) from this date." )
881        protected Period during;
882
883        private static final long serialVersionUID = 310849929L;
884
885    /**
886     * Constructor
887     */
888      public HealthcareServiceNotAvailableComponent() {
889        super();
890      }
891
892    /**
893     * Constructor
894     */
895      public HealthcareServiceNotAvailableComponent(StringType description) {
896        super();
897        this.description = description;
898      }
899
900        /**
901         * @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
902         */
903        public StringType getDescriptionElement() { 
904          if (this.description == null)
905            if (Configuration.errorOnAutoCreate())
906              throw new Error("Attempt to auto-create HealthcareServiceNotAvailableComponent.description");
907            else if (Configuration.doAutoCreate())
908              this.description = new StringType(); // bb
909          return this.description;
910        }
911
912        public boolean hasDescriptionElement() { 
913          return this.description != null && !this.description.isEmpty();
914        }
915
916        public boolean hasDescription() { 
917          return this.description != null && !this.description.isEmpty();
918        }
919
920        /**
921         * @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
922         */
923        public HealthcareServiceNotAvailableComponent setDescriptionElement(StringType value) { 
924          this.description = value;
925          return this;
926        }
927
928        /**
929         * @return The reason that can be presented to the user as to why this time is not available.
930         */
931        public String getDescription() { 
932          return this.description == null ? null : this.description.getValue();
933        }
934
935        /**
936         * @param value The reason that can be presented to the user as to why this time is not available.
937         */
938        public HealthcareServiceNotAvailableComponent setDescription(String value) { 
939            if (this.description == null)
940              this.description = new StringType();
941            this.description.setValue(value);
942          return this;
943        }
944
945        /**
946         * @return {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
947         */
948        public Period getDuring() { 
949          if (this.during == null)
950            if (Configuration.errorOnAutoCreate())
951              throw new Error("Attempt to auto-create HealthcareServiceNotAvailableComponent.during");
952            else if (Configuration.doAutoCreate())
953              this.during = new Period(); // cc
954          return this.during;
955        }
956
957        public boolean hasDuring() { 
958          return this.during != null && !this.during.isEmpty();
959        }
960
961        /**
962         * @param value {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
963         */
964        public HealthcareServiceNotAvailableComponent setDuring(Period value) { 
965          this.during = value;
966          return this;
967        }
968
969        protected void listChildren(List<Property> children) {
970          super.listChildren(children);
971          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));
972          children.add(new Property("during", "Period", "Service is not available (seasonally or for a public holiday) from this date.", 0, 1, during));
973        }
974
975        @Override
976        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
977          switch (_hash) {
978          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);
979          case -1320499647: /*during*/  return new Property("during", "Period", "Service is not available (seasonally or for a public holiday) from this date.", 0, 1, during);
980          default: return super.getNamedProperty(_hash, _name, _checkValid);
981          }
982
983        }
984
985      @Override
986      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
987        switch (hash) {
988        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
989        case -1320499647: /*during*/ return this.during == null ? new Base[0] : new Base[] {this.during}; // Period
990        default: return super.getProperty(hash, name, checkValid);
991        }
992
993      }
994
995      @Override
996      public Base setProperty(int hash, String name, Base value) throws FHIRException {
997        switch (hash) {
998        case -1724546052: // description
999          this.description = castToString(value); // StringType
1000          return value;
1001        case -1320499647: // during
1002          this.during = castToPeriod(value); // Period
1003          return value;
1004        default: return super.setProperty(hash, name, value);
1005        }
1006
1007      }
1008
1009      @Override
1010      public Base setProperty(String name, Base value) throws FHIRException {
1011        if (name.equals("description")) {
1012          this.description = castToString(value); // StringType
1013        } else if (name.equals("during")) {
1014          this.during = castToPeriod(value); // Period
1015        } else
1016          return super.setProperty(name, value);
1017        return value;
1018      }
1019
1020      @Override
1021      public Base makeProperty(int hash, String name) throws FHIRException {
1022        switch (hash) {
1023        case -1724546052:  return getDescriptionElement();
1024        case -1320499647:  return getDuring(); 
1025        default: return super.makeProperty(hash, name);
1026        }
1027
1028      }
1029
1030      @Override
1031      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1032        switch (hash) {
1033        case -1724546052: /*description*/ return new String[] {"string"};
1034        case -1320499647: /*during*/ return new String[] {"Period"};
1035        default: return super.getTypesForProperty(hash, name);
1036        }
1037
1038      }
1039
1040      @Override
1041      public Base addChild(String name) throws FHIRException {
1042        if (name.equals("description")) {
1043          throw new FHIRException("Cannot call addChild on a primitive type HealthcareService.description");
1044        }
1045        else if (name.equals("during")) {
1046          this.during = new Period();
1047          return this.during;
1048        }
1049        else
1050          return super.addChild(name);
1051      }
1052
1053      public HealthcareServiceNotAvailableComponent copy() {
1054        HealthcareServiceNotAvailableComponent dst = new HealthcareServiceNotAvailableComponent();
1055        copyValues(dst);
1056        dst.description = description == null ? null : description.copy();
1057        dst.during = during == null ? null : during.copy();
1058        return dst;
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        if (identifier != null) {
2944          dst.identifier = new ArrayList<Identifier>();
2945          for (Identifier i : identifier)
2946            dst.identifier.add(i.copy());
2947        };
2948        dst.active = active == null ? null : active.copy();
2949        dst.providedBy = providedBy == null ? null : providedBy.copy();
2950        if (category != null) {
2951          dst.category = new ArrayList<CodeableConcept>();
2952          for (CodeableConcept i : category)
2953            dst.category.add(i.copy());
2954        };
2955        if (type != null) {
2956          dst.type = new ArrayList<CodeableConcept>();
2957          for (CodeableConcept i : type)
2958            dst.type.add(i.copy());
2959        };
2960        if (specialty != null) {
2961          dst.specialty = new ArrayList<CodeableConcept>();
2962          for (CodeableConcept i : specialty)
2963            dst.specialty.add(i.copy());
2964        };
2965        if (location != null) {
2966          dst.location = new ArrayList<Reference>();
2967          for (Reference i : location)
2968            dst.location.add(i.copy());
2969        };
2970        dst.name = name == null ? null : name.copy();
2971        dst.comment = comment == null ? null : comment.copy();
2972        dst.extraDetails = extraDetails == null ? null : extraDetails.copy();
2973        dst.photo = photo == null ? null : photo.copy();
2974        if (telecom != null) {
2975          dst.telecom = new ArrayList<ContactPoint>();
2976          for (ContactPoint i : telecom)
2977            dst.telecom.add(i.copy());
2978        };
2979        if (coverageArea != null) {
2980          dst.coverageArea = new ArrayList<Reference>();
2981          for (Reference i : coverageArea)
2982            dst.coverageArea.add(i.copy());
2983        };
2984        if (serviceProvisionCode != null) {
2985          dst.serviceProvisionCode = new ArrayList<CodeableConcept>();
2986          for (CodeableConcept i : serviceProvisionCode)
2987            dst.serviceProvisionCode.add(i.copy());
2988        };
2989        if (eligibility != null) {
2990          dst.eligibility = new ArrayList<HealthcareServiceEligibilityComponent>();
2991          for (HealthcareServiceEligibilityComponent i : eligibility)
2992            dst.eligibility.add(i.copy());
2993        };
2994        if (program != null) {
2995          dst.program = new ArrayList<CodeableConcept>();
2996          for (CodeableConcept i : program)
2997            dst.program.add(i.copy());
2998        };
2999        if (characteristic != null) {
3000          dst.characteristic = new ArrayList<CodeableConcept>();
3001          for (CodeableConcept i : characteristic)
3002            dst.characteristic.add(i.copy());
3003        };
3004        if (communication != null) {
3005          dst.communication = new ArrayList<CodeableConcept>();
3006          for (CodeableConcept i : communication)
3007            dst.communication.add(i.copy());
3008        };
3009        if (referralMethod != null) {
3010          dst.referralMethod = new ArrayList<CodeableConcept>();
3011          for (CodeableConcept i : referralMethod)
3012            dst.referralMethod.add(i.copy());
3013        };
3014        dst.appointmentRequired = appointmentRequired == null ? null : appointmentRequired.copy();
3015        if (availableTime != null) {
3016          dst.availableTime = new ArrayList<HealthcareServiceAvailableTimeComponent>();
3017          for (HealthcareServiceAvailableTimeComponent i : availableTime)
3018            dst.availableTime.add(i.copy());
3019        };
3020        if (notAvailable != null) {
3021          dst.notAvailable = new ArrayList<HealthcareServiceNotAvailableComponent>();
3022          for (HealthcareServiceNotAvailableComponent i : notAvailable)
3023            dst.notAvailable.add(i.copy());
3024        };
3025        dst.availabilityExceptions = availabilityExceptions == null ? null : availabilityExceptions.copy();
3026        if (endpoint != null) {
3027          dst.endpoint = new ArrayList<Reference>();
3028          for (Reference i : endpoint)
3029            dst.endpoint.add(i.copy());
3030        };
3031        return dst;
3032      }
3033
3034      protected HealthcareService typedCopy() {
3035        return copy();
3036      }
3037
3038      @Override
3039      public boolean equalsDeep(Base other_) {
3040        if (!super.equalsDeep(other_))
3041          return false;
3042        if (!(other_ instanceof HealthcareService))
3043          return false;
3044        HealthcareService o = (HealthcareService) other_;
3045        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(providedBy, o.providedBy, true)
3046           && compareDeep(category, o.category, true) && compareDeep(type, o.type, true) && compareDeep(specialty, o.specialty, true)
3047           && compareDeep(location, o.location, true) && compareDeep(name, o.name, true) && compareDeep(comment, o.comment, true)
3048           && compareDeep(extraDetails, o.extraDetails, true) && compareDeep(photo, o.photo, true) && compareDeep(telecom, o.telecom, true)
3049           && compareDeep(coverageArea, o.coverageArea, true) && compareDeep(serviceProvisionCode, o.serviceProvisionCode, true)
3050           && compareDeep(eligibility, o.eligibility, true) && compareDeep(program, o.program, true) && compareDeep(characteristic, o.characteristic, true)
3051           && compareDeep(communication, o.communication, true) && compareDeep(referralMethod, o.referralMethod, true)
3052           && compareDeep(appointmentRequired, o.appointmentRequired, true) && compareDeep(availableTime, o.availableTime, true)
3053           && compareDeep(notAvailable, o.notAvailable, true) && compareDeep(availabilityExceptions, o.availabilityExceptions, true)
3054           && compareDeep(endpoint, o.endpoint, true);
3055      }
3056
3057      @Override
3058      public boolean equalsShallow(Base other_) {
3059        if (!super.equalsShallow(other_))
3060          return false;
3061        if (!(other_ instanceof HealthcareService))
3062          return false;
3063        HealthcareService o = (HealthcareService) other_;
3064        return compareValues(active, o.active, true) && compareValues(name, o.name, true) && compareValues(comment, o.comment, true)
3065           && compareValues(extraDetails, o.extraDetails, true) && compareValues(appointmentRequired, o.appointmentRequired, true)
3066           && compareValues(availabilityExceptions, o.availabilityExceptions, true);
3067      }
3068
3069      public boolean isEmpty() {
3070        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, providedBy
3071          , category, type, specialty, location, name, comment, extraDetails, photo, telecom
3072          , coverageArea, serviceProvisionCode, eligibility, program, characteristic, communication
3073          , referralMethod, appointmentRequired, availableTime, notAvailable, availabilityExceptions
3074          , endpoint);
3075      }
3076
3077  @Override
3078  public ResourceType getResourceType() {
3079    return ResourceType.HealthcareService;
3080   }
3081
3082 /**
3083   * Search parameter: <b>identifier</b>
3084   * <p>
3085   * Description: <b>External identifiers for this item</b><br>
3086   * Type: <b>token</b><br>
3087   * Path: <b>HealthcareService.identifier</b><br>
3088   * </p>
3089   */
3090  @SearchParamDefinition(name="identifier", path="HealthcareService.identifier", description="External identifiers for this item", type="token" )
3091  public static final String SP_IDENTIFIER = "identifier";
3092 /**
3093   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3094   * <p>
3095   * Description: <b>External identifiers for this item</b><br>
3096   * Type: <b>token</b><br>
3097   * Path: <b>HealthcareService.identifier</b><br>
3098   * </p>
3099   */
3100  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3101
3102 /**
3103   * Search parameter: <b>specialty</b>
3104   * <p>
3105   * Description: <b>The specialty of the service provided by this healthcare service</b><br>
3106   * Type: <b>token</b><br>
3107   * Path: <b>HealthcareService.specialty</b><br>
3108   * </p>
3109   */
3110  @SearchParamDefinition(name="specialty", path="HealthcareService.specialty", description="The specialty of the service provided by this healthcare service", type="token" )
3111  public static final String SP_SPECIALTY = "specialty";
3112 /**
3113   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
3114   * <p>
3115   * Description: <b>The specialty of the service provided by this healthcare service</b><br>
3116   * Type: <b>token</b><br>
3117   * Path: <b>HealthcareService.specialty</b><br>
3118   * </p>
3119   */
3120  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIALTY);
3121
3122 /**
3123   * Search parameter: <b>endpoint</b>
3124   * <p>
3125   * Description: <b>Technical endpoints providing access to electronic services operated for the healthcare service</b><br>
3126   * Type: <b>reference</b><br>
3127   * Path: <b>HealthcareService.endpoint</b><br>
3128   * </p>
3129   */
3130  @SearchParamDefinition(name="endpoint", path="HealthcareService.endpoint", description="Technical endpoints providing access to electronic services operated for the healthcare service", type="reference", target={Endpoint.class } )
3131  public static final String SP_ENDPOINT = "endpoint";
3132 /**
3133   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
3134   * <p>
3135   * Description: <b>Technical endpoints providing access to electronic services operated for the healthcare service</b><br>
3136   * Type: <b>reference</b><br>
3137   * Path: <b>HealthcareService.endpoint</b><br>
3138   * </p>
3139   */
3140  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENDPOINT);
3141
3142/**
3143   * Constant for fluent queries to be used to add include statements. Specifies
3144   * the path value of "<b>HealthcareService:endpoint</b>".
3145   */
3146  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include("HealthcareService:endpoint").toLocked();
3147
3148 /**
3149   * Search parameter: <b>service-category</b>
3150   * <p>
3151   * Description: <b>Service Category of the Healthcare Service</b><br>
3152   * Type: <b>token</b><br>
3153   * Path: <b>HealthcareService.category</b><br>
3154   * </p>
3155   */
3156  @SearchParamDefinition(name="service-category", path="HealthcareService.category", description="Service Category of the Healthcare Service", type="token" )
3157  public static final String SP_SERVICE_CATEGORY = "service-category";
3158 /**
3159   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
3160   * <p>
3161   * Description: <b>Service Category of the Healthcare Service</b><br>
3162   * Type: <b>token</b><br>
3163   * Path: <b>HealthcareService.category</b><br>
3164   * </p>
3165   */
3166  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_CATEGORY);
3167
3168 /**
3169   * Search parameter: <b>coverage-area</b>
3170   * <p>
3171   * Description: <b>Location(s) service is intended for/available to</b><br>
3172   * Type: <b>reference</b><br>
3173   * Path: <b>HealthcareService.coverageArea</b><br>
3174   * </p>
3175   */
3176  @SearchParamDefinition(name="coverage-area", path="HealthcareService.coverageArea", description="Location(s) service is intended for/available to", type="reference", target={Location.class } )
3177  public static final String SP_COVERAGE_AREA = "coverage-area";
3178 /**
3179   * <b>Fluent Client</b> search parameter constant for <b>coverage-area</b>
3180   * <p>
3181   * Description: <b>Location(s) service is intended for/available to</b><br>
3182   * Type: <b>reference</b><br>
3183   * Path: <b>HealthcareService.coverageArea</b><br>
3184   * </p>
3185   */
3186  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE_AREA = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE_AREA);
3187
3188/**
3189   * Constant for fluent queries to be used to add include statements. Specifies
3190   * the path value of "<b>HealthcareService:coverage-area</b>".
3191   */
3192  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE_AREA = new ca.uhn.fhir.model.api.Include("HealthcareService:coverage-area").toLocked();
3193
3194 /**
3195   * Search parameter: <b>service-type</b>
3196   * <p>
3197   * Description: <b>The type of service provided by this healthcare service</b><br>
3198   * Type: <b>token</b><br>
3199   * Path: <b>HealthcareService.type</b><br>
3200   * </p>
3201   */
3202  @SearchParamDefinition(name="service-type", path="HealthcareService.type", description="The type of service provided by this healthcare service", type="token" )
3203  public static final String SP_SERVICE_TYPE = "service-type";
3204 /**
3205   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
3206   * <p>
3207   * Description: <b>The type of service provided by this healthcare service</b><br>
3208   * Type: <b>token</b><br>
3209   * Path: <b>HealthcareService.type</b><br>
3210   * </p>
3211   */
3212  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_TYPE);
3213
3214 /**
3215   * Search parameter: <b>organization</b>
3216   * <p>
3217   * Description: <b>The organization that provides this Healthcare Service</b><br>
3218   * Type: <b>reference</b><br>
3219   * Path: <b>HealthcareService.providedBy</b><br>
3220   * </p>
3221   */
3222  @SearchParamDefinition(name="organization", path="HealthcareService.providedBy", description="The organization that provides this Healthcare Service", type="reference", target={Organization.class } )
3223  public static final String SP_ORGANIZATION = "organization";
3224 /**
3225   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
3226   * <p>
3227   * Description: <b>The organization that provides this Healthcare Service</b><br>
3228   * Type: <b>reference</b><br>
3229   * Path: <b>HealthcareService.providedBy</b><br>
3230   * </p>
3231   */
3232  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
3233
3234/**
3235   * Constant for fluent queries to be used to add include statements. Specifies
3236   * the path value of "<b>HealthcareService:organization</b>".
3237   */
3238  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("HealthcareService:organization").toLocked();
3239
3240 /**
3241   * Search parameter: <b>name</b>
3242   * <p>
3243   * Description: <b>A portion of the Healthcare service name</b><br>
3244   * Type: <b>string</b><br>
3245   * Path: <b>HealthcareService.name</b><br>
3246   * </p>
3247   */
3248  @SearchParamDefinition(name="name", path="HealthcareService.name", description="A portion of the Healthcare service name", type="string" )
3249  public static final String SP_NAME = "name";
3250 /**
3251   * <b>Fluent Client</b> search parameter constant for <b>name</b>
3252   * <p>
3253   * Description: <b>A portion of the Healthcare service name</b><br>
3254   * Type: <b>string</b><br>
3255   * Path: <b>HealthcareService.name</b><br>
3256   * </p>
3257   */
3258  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
3259
3260 /**
3261   * Search parameter: <b>active</b>
3262   * <p>
3263   * Description: <b>The Healthcare Service is currently marked as active</b><br>
3264   * Type: <b>token</b><br>
3265   * Path: <b>HealthcareService.active</b><br>
3266   * </p>
3267   */
3268  @SearchParamDefinition(name="active", path="HealthcareService.active", description="The Healthcare Service is currently marked as active", type="token" )
3269  public static final String SP_ACTIVE = "active";
3270 /**
3271   * <b>Fluent Client</b> search parameter constant for <b>active</b>
3272   * <p>
3273   * Description: <b>The Healthcare Service is currently marked as active</b><br>
3274   * Type: <b>token</b><br>
3275   * Path: <b>HealthcareService.active</b><br>
3276   * </p>
3277   */
3278  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
3279
3280 /**
3281   * Search parameter: <b>location</b>
3282   * <p>
3283   * Description: <b>The location of the Healthcare Service</b><br>
3284   * Type: <b>reference</b><br>
3285   * Path: <b>HealthcareService.location</b><br>
3286   * </p>
3287   */
3288  @SearchParamDefinition(name="location", path="HealthcareService.location", description="The location of the Healthcare Service", type="reference", target={Location.class } )
3289  public static final String SP_LOCATION = "location";
3290 /**
3291   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3292   * <p>
3293   * Description: <b>The location of the Healthcare Service</b><br>
3294   * Type: <b>reference</b><br>
3295   * Path: <b>HealthcareService.location</b><br>
3296   * </p>
3297   */
3298  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3299
3300/**
3301   * Constant for fluent queries to be used to add include statements. Specifies
3302   * the path value of "<b>HealthcareService:location</b>".
3303   */
3304  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("HealthcareService:location").toLocked();
3305
3306 /**
3307   * Search parameter: <b>program</b>
3308   * <p>
3309   * Description: <b>One of the Programs supported by this HealthcareService</b><br>
3310   * Type: <b>token</b><br>
3311   * Path: <b>HealthcareService.program</b><br>
3312   * </p>
3313   */
3314  @SearchParamDefinition(name="program", path="HealthcareService.program", description="One of the Programs supported by this HealthcareService", type="token" )
3315  public static final String SP_PROGRAM = "program";
3316 /**
3317   * <b>Fluent Client</b> search parameter constant for <b>program</b>
3318   * <p>
3319   * Description: <b>One of the Programs supported by this HealthcareService</b><br>
3320   * Type: <b>token</b><br>
3321   * Path: <b>HealthcareService.program</b><br>
3322   * </p>
3323   */
3324  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PROGRAM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PROGRAM);
3325
3326 /**
3327   * Search parameter: <b>characteristic</b>
3328   * <p>
3329   * Description: <b>One of the HealthcareService's characteristics</b><br>
3330   * Type: <b>token</b><br>
3331   * Path: <b>HealthcareService.characteristic</b><br>
3332   * </p>
3333   */
3334  @SearchParamDefinition(name="characteristic", path="HealthcareService.characteristic", description="One of the HealthcareService's characteristics", type="token" )
3335  public static final String SP_CHARACTERISTIC = "characteristic";
3336 /**
3337   * <b>Fluent Client</b> search parameter constant for <b>characteristic</b>
3338   * <p>
3339   * Description: <b>One of the HealthcareService's characteristics</b><br>
3340   * Type: <b>token</b><br>
3341   * Path: <b>HealthcareService.characteristic</b><br>
3342   * </p>
3343   */
3344  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CHARACTERISTIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CHARACTERISTIC);
3345
3346
3347}
3348