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