001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a period of time.
052 */
053@ResourceDef(name="PractitionerRole", profile="http://hl7.org/fhir/StructureDefinition/PractitionerRole")
054public class PractitionerRole extends DomainResource {
055
056    @Block()
057    public static class PractitionerRoleAvailableTimeComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * Indicates which days of the week are available between the start and end times.
060         */
061        @Child(name = "daysOfWeek", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
062        @Description(shortDefinition="mon | tue | wed | thu | fri | sat | sun", formalDefinition="Indicates which days of the week are available between the start and end times." )
063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/days-of-week")
064        protected List<Enumeration<DaysOfWeek>> daysOfWeek;
065
066        /**
067         * Indicates always available, hence times are irrelevant.  (e.g. 24-hour service).
068         */
069        @Child(name = "allDay", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
070        @Description(shortDefinition="Always available? e.g. 24 hour service", formalDefinition="Indicates always available, hence times are irrelevant.  (e.g. 24-hour service)." )
071        protected BooleanType allDay;
072
073        /**
074         * The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
075         */
076        @Child(name = "availableStartTime", type = {TimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
077        @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." )
078        protected TimeType availableStartTime;
079
080        /**
081         * The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
082         */
083        @Child(name = "availableEndTime", type = {TimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
084        @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." )
085        protected TimeType availableEndTime;
086
087        private static final long serialVersionUID = -2139510127L;
088
089    /**
090     * Constructor
091     */
092      public PractitionerRoleAvailableTimeComponent() {
093        super();
094      }
095
096        /**
097         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end times.)
098         */
099        public List<Enumeration<DaysOfWeek>> getDaysOfWeek() { 
100          if (this.daysOfWeek == null)
101            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
102          return this.daysOfWeek;
103        }
104
105        /**
106         * @return Returns a reference to <code>this</code> for easy method chaining
107         */
108        public PractitionerRoleAvailableTimeComponent setDaysOfWeek(List<Enumeration<DaysOfWeek>> theDaysOfWeek) { 
109          this.daysOfWeek = theDaysOfWeek;
110          return this;
111        }
112
113        public boolean hasDaysOfWeek() { 
114          if (this.daysOfWeek == null)
115            return false;
116          for (Enumeration<DaysOfWeek> item : this.daysOfWeek)
117            if (!item.isEmpty())
118              return true;
119          return false;
120        }
121
122        /**
123         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end times.)
124         */
125        public Enumeration<DaysOfWeek> addDaysOfWeekElement() {//2 
126          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
127          if (this.daysOfWeek == null)
128            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
129          this.daysOfWeek.add(t);
130          return t;
131        }
132
133        /**
134         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end times.)
135         */
136        public PractitionerRoleAvailableTimeComponent addDaysOfWeek(DaysOfWeek value) { //1
137          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
138          t.setValue(value);
139          if (this.daysOfWeek == null)
140            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
141          this.daysOfWeek.add(t);
142          return this;
143        }
144
145        /**
146         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end times.)
147         */
148        public boolean hasDaysOfWeek(DaysOfWeek value) { 
149          if (this.daysOfWeek == null)
150            return false;
151          for (Enumeration<DaysOfWeek> v : this.daysOfWeek)
152            if (v.getValue().equals(value)) // code
153              return true;
154          return false;
155        }
156
157        /**
158         * @return {@link #allDay} (Indicates 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
159         */
160        public BooleanType getAllDayElement() { 
161          if (this.allDay == null)
162            if (Configuration.errorOnAutoCreate())
163              throw new Error("Attempt to auto-create PractitionerRoleAvailableTimeComponent.allDay");
164            else if (Configuration.doAutoCreate())
165              this.allDay = new BooleanType(); // bb
166          return this.allDay;
167        }
168
169        public boolean hasAllDayElement() { 
170          return this.allDay != null && !this.allDay.isEmpty();
171        }
172
173        public boolean hasAllDay() { 
174          return this.allDay != null && !this.allDay.isEmpty();
175        }
176
177        /**
178         * @param value {@link #allDay} (Indicates 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
179         */
180        public PractitionerRoleAvailableTimeComponent setAllDayElement(BooleanType value) { 
181          this.allDay = value;
182          return this;
183        }
184
185        /**
186         * @return Indicates always available, hence times are irrelevant.  (e.g. 24-hour service).
187         */
188        public boolean getAllDay() { 
189          return this.allDay == null || this.allDay.isEmpty() ? false : this.allDay.getValue();
190        }
191
192        /**
193         * @param value Indicates always available, hence times are irrelevant.  (e.g. 24-hour service).
194         */
195        public PractitionerRoleAvailableTimeComponent setAllDay(boolean value) { 
196            if (this.allDay == null)
197              this.allDay = new BooleanType();
198            this.allDay.setValue(value);
199          return this;
200        }
201
202        /**
203         * @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
204         */
205        public TimeType getAvailableStartTimeElement() { 
206          if (this.availableStartTime == null)
207            if (Configuration.errorOnAutoCreate())
208              throw new Error("Attempt to auto-create PractitionerRoleAvailableTimeComponent.availableStartTime");
209            else if (Configuration.doAutoCreate())
210              this.availableStartTime = new TimeType(); // bb
211          return this.availableStartTime;
212        }
213
214        public boolean hasAvailableStartTimeElement() { 
215          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
216        }
217
218        public boolean hasAvailableStartTime() { 
219          return this.availableStartTime != null && !this.availableStartTime.isEmpty();
220        }
221
222        /**
223         * @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
224         */
225        public PractitionerRoleAvailableTimeComponent setAvailableStartTimeElement(TimeType value) { 
226          this.availableStartTime = value;
227          return this;
228        }
229
230        /**
231         * @return The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
232         */
233        public String getAvailableStartTime() { 
234          return this.availableStartTime == null ? null : this.availableStartTime.getValue();
235        }
236
237        /**
238         * @param value The opening time of day. Note: If the AllDay flag is set, then this time is ignored.
239         */
240        public PractitionerRoleAvailableTimeComponent setAvailableStartTime(String value) { 
241          if (value == null)
242            this.availableStartTime = null;
243          else {
244            if (this.availableStartTime == null)
245              this.availableStartTime = new TimeType();
246            this.availableStartTime.setValue(value);
247          }
248          return this;
249        }
250
251        /**
252         * @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
253         */
254        public TimeType getAvailableEndTimeElement() { 
255          if (this.availableEndTime == null)
256            if (Configuration.errorOnAutoCreate())
257              throw new Error("Attempt to auto-create PractitionerRoleAvailableTimeComponent.availableEndTime");
258            else if (Configuration.doAutoCreate())
259              this.availableEndTime = new TimeType(); // bb
260          return this.availableEndTime;
261        }
262
263        public boolean hasAvailableEndTimeElement() { 
264          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
265        }
266
267        public boolean hasAvailableEndTime() { 
268          return this.availableEndTime != null && !this.availableEndTime.isEmpty();
269        }
270
271        /**
272         * @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
273         */
274        public PractitionerRoleAvailableTimeComponent setAvailableEndTimeElement(TimeType value) { 
275          this.availableEndTime = value;
276          return this;
277        }
278
279        /**
280         * @return The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
281         */
282        public String getAvailableEndTime() { 
283          return this.availableEndTime == null ? null : this.availableEndTime.getValue();
284        }
285
286        /**
287         * @param value The closing time of day. Note: If the AllDay flag is set, then this time is ignored.
288         */
289        public PractitionerRoleAvailableTimeComponent setAvailableEndTime(String value) { 
290          if (value == null)
291            this.availableEndTime = null;
292          else {
293            if (this.availableEndTime == null)
294              this.availableEndTime = new TimeType();
295            this.availableEndTime.setValue(value);
296          }
297          return this;
298        }
299
300        protected void listChildren(List<Property> children) {
301          super.listChildren(children);
302          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));
303          children.add(new Property("allDay", "boolean", "Indicates always available, hence times are irrelevant.  (e.g. 24-hour service).", 0, 1, allDay));
304          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));
305          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));
306        }
307
308        @Override
309        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
310          switch (_hash) {
311          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);
312          case -1414913477: /*allDay*/  return new Property("allDay", "boolean", "Indicates always available, hence times are irrelevant.  (e.g. 24-hour service).", 0, 1, allDay);
313          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);
314          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);
315          default: return super.getNamedProperty(_hash, _name, _checkValid);
316          }
317
318        }
319
320      @Override
321      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
322        switch (hash) {
323        case 68050338: /*daysOfWeek*/ return this.daysOfWeek == null ? new Base[0] : this.daysOfWeek.toArray(new Base[this.daysOfWeek.size()]); // Enumeration<DaysOfWeek>
324        case -1414913477: /*allDay*/ return this.allDay == null ? new Base[0] : new Base[] {this.allDay}; // BooleanType
325        case -1039453818: /*availableStartTime*/ return this.availableStartTime == null ? new Base[0] : new Base[] {this.availableStartTime}; // TimeType
326        case 101151551: /*availableEndTime*/ return this.availableEndTime == null ? new Base[0] : new Base[] {this.availableEndTime}; // TimeType
327        default: return super.getProperty(hash, name, checkValid);
328        }
329
330      }
331
332      @Override
333      public Base setProperty(int hash, String name, Base value) throws FHIRException {
334        switch (hash) {
335        case 68050338: // daysOfWeek
336          value = new DaysOfWeekEnumFactory().fromType(TypeConvertor.castToCode(value));
337          this.getDaysOfWeek().add((Enumeration) value); // Enumeration<DaysOfWeek>
338          return value;
339        case -1414913477: // allDay
340          this.allDay = TypeConvertor.castToBoolean(value); // BooleanType
341          return value;
342        case -1039453818: // availableStartTime
343          this.availableStartTime = TypeConvertor.castToTime(value); // TimeType
344          return value;
345        case 101151551: // availableEndTime
346          this.availableEndTime = TypeConvertor.castToTime(value); // TimeType
347          return value;
348        default: return super.setProperty(hash, name, value);
349        }
350
351      }
352
353      @Override
354      public Base setProperty(String name, Base value) throws FHIRException {
355        if (name.equals("daysOfWeek")) {
356          value = new DaysOfWeekEnumFactory().fromType(TypeConvertor.castToCode(value));
357          this.getDaysOfWeek().add((Enumeration) value);
358        } else if (name.equals("allDay")) {
359          this.allDay = TypeConvertor.castToBoolean(value); // BooleanType
360        } else if (name.equals("availableStartTime")) {
361          this.availableStartTime = TypeConvertor.castToTime(value); // TimeType
362        } else if (name.equals("availableEndTime")) {
363          this.availableEndTime = TypeConvertor.castToTime(value); // TimeType
364        } else
365          return super.setProperty(name, value);
366        return value;
367      }
368
369      @Override
370      public Base makeProperty(int hash, String name) throws FHIRException {
371        switch (hash) {
372        case 68050338:  return addDaysOfWeekElement();
373        case -1414913477:  return getAllDayElement();
374        case -1039453818:  return getAvailableStartTimeElement();
375        case 101151551:  return getAvailableEndTimeElement();
376        default: return super.makeProperty(hash, name);
377        }
378
379      }
380
381      @Override
382      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
383        switch (hash) {
384        case 68050338: /*daysOfWeek*/ return new String[] {"code"};
385        case -1414913477: /*allDay*/ return new String[] {"boolean"};
386        case -1039453818: /*availableStartTime*/ return new String[] {"time"};
387        case 101151551: /*availableEndTime*/ return new String[] {"time"};
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("daysOfWeek")) {
396          throw new FHIRException("Cannot call addChild on a primitive type PractitionerRole.availableTime.daysOfWeek");
397        }
398        else if (name.equals("allDay")) {
399          throw new FHIRException("Cannot call addChild on a primitive type PractitionerRole.availableTime.allDay");
400        }
401        else if (name.equals("availableStartTime")) {
402          throw new FHIRException("Cannot call addChild on a primitive type PractitionerRole.availableTime.availableStartTime");
403        }
404        else if (name.equals("availableEndTime")) {
405          throw new FHIRException("Cannot call addChild on a primitive type PractitionerRole.availableTime.availableEndTime");
406        }
407        else
408          return super.addChild(name);
409      }
410
411      public PractitionerRoleAvailableTimeComponent copy() {
412        PractitionerRoleAvailableTimeComponent dst = new PractitionerRoleAvailableTimeComponent();
413        copyValues(dst);
414        return dst;
415      }
416
417      public void copyValues(PractitionerRoleAvailableTimeComponent dst) {
418        super.copyValues(dst);
419        if (daysOfWeek != null) {
420          dst.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
421          for (Enumeration<DaysOfWeek> i : daysOfWeek)
422            dst.daysOfWeek.add(i.copy());
423        };
424        dst.allDay = allDay == null ? null : allDay.copy();
425        dst.availableStartTime = availableStartTime == null ? null : availableStartTime.copy();
426        dst.availableEndTime = availableEndTime == null ? null : availableEndTime.copy();
427      }
428
429      @Override
430      public boolean equalsDeep(Base other_) {
431        if (!super.equalsDeep(other_))
432          return false;
433        if (!(other_ instanceof PractitionerRoleAvailableTimeComponent))
434          return false;
435        PractitionerRoleAvailableTimeComponent o = (PractitionerRoleAvailableTimeComponent) other_;
436        return compareDeep(daysOfWeek, o.daysOfWeek, true) && compareDeep(allDay, o.allDay, true) && compareDeep(availableStartTime, o.availableStartTime, true)
437           && compareDeep(availableEndTime, o.availableEndTime, true);
438      }
439
440      @Override
441      public boolean equalsShallow(Base other_) {
442        if (!super.equalsShallow(other_))
443          return false;
444        if (!(other_ instanceof PractitionerRoleAvailableTimeComponent))
445          return false;
446        PractitionerRoleAvailableTimeComponent o = (PractitionerRoleAvailableTimeComponent) other_;
447        return compareValues(daysOfWeek, o.daysOfWeek, true) && compareValues(allDay, o.allDay, true) && compareValues(availableStartTime, o.availableStartTime, true)
448           && compareValues(availableEndTime, o.availableEndTime, true);
449      }
450
451      public boolean isEmpty() {
452        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(daysOfWeek, allDay, availableStartTime
453          , availableEndTime);
454      }
455
456  public String fhirType() {
457    return "PractitionerRole.availableTime";
458
459  }
460
461  }
462
463    @Block()
464    public static class PractitionerRoleNotAvailableComponent extends BackboneElement implements IBaseBackboneElement {
465        /**
466         * The reason that can be presented to the user as to why this time is not available.
467         */
468        @Child(name = "description", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
469        @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." )
470        protected StringType description;
471
472        /**
473         * Service is not available (seasonally or for a public holiday) from this date.
474         */
475        @Child(name = "during", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
476        @Description(shortDefinition="Service not available from this date", formalDefinition="Service is not available (seasonally or for a public holiday) from this date." )
477        protected Period during;
478
479        private static final long serialVersionUID = 310849929L;
480
481    /**
482     * Constructor
483     */
484      public PractitionerRoleNotAvailableComponent() {
485        super();
486      }
487
488    /**
489     * Constructor
490     */
491      public PractitionerRoleNotAvailableComponent(String description) {
492        super();
493        this.setDescription(description);
494      }
495
496        /**
497         * @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
498         */
499        public StringType getDescriptionElement() { 
500          if (this.description == null)
501            if (Configuration.errorOnAutoCreate())
502              throw new Error("Attempt to auto-create PractitionerRoleNotAvailableComponent.description");
503            else if (Configuration.doAutoCreate())
504              this.description = new StringType(); // bb
505          return this.description;
506        }
507
508        public boolean hasDescriptionElement() { 
509          return this.description != null && !this.description.isEmpty();
510        }
511
512        public boolean hasDescription() { 
513          return this.description != null && !this.description.isEmpty();
514        }
515
516        /**
517         * @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
518         */
519        public PractitionerRoleNotAvailableComponent setDescriptionElement(StringType value) { 
520          this.description = value;
521          return this;
522        }
523
524        /**
525         * @return The reason that can be presented to the user as to why this time is not available.
526         */
527        public String getDescription() { 
528          return this.description == null ? null : this.description.getValue();
529        }
530
531        /**
532         * @param value The reason that can be presented to the user as to why this time is not available.
533         */
534        public PractitionerRoleNotAvailableComponent setDescription(String value) { 
535            if (this.description == null)
536              this.description = new StringType();
537            this.description.setValue(value);
538          return this;
539        }
540
541        /**
542         * @return {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
543         */
544        public Period getDuring() { 
545          if (this.during == null)
546            if (Configuration.errorOnAutoCreate())
547              throw new Error("Attempt to auto-create PractitionerRoleNotAvailableComponent.during");
548            else if (Configuration.doAutoCreate())
549              this.during = new Period(); // cc
550          return this.during;
551        }
552
553        public boolean hasDuring() { 
554          return this.during != null && !this.during.isEmpty();
555        }
556
557        /**
558         * @param value {@link #during} (Service is not available (seasonally or for a public holiday) from this date.)
559         */
560        public PractitionerRoleNotAvailableComponent setDuring(Period value) { 
561          this.during = value;
562          return this;
563        }
564
565        protected void listChildren(List<Property> children) {
566          super.listChildren(children);
567          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));
568          children.add(new Property("during", "Period", "Service is not available (seasonally or for a public holiday) from this date.", 0, 1, during));
569        }
570
571        @Override
572        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
573          switch (_hash) {
574          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);
575          case -1320499647: /*during*/  return new Property("during", "Period", "Service is not available (seasonally or for a public holiday) from this date.", 0, 1, during);
576          default: return super.getNamedProperty(_hash, _name, _checkValid);
577          }
578
579        }
580
581      @Override
582      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
583        switch (hash) {
584        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
585        case -1320499647: /*during*/ return this.during == null ? new Base[0] : new Base[] {this.during}; // Period
586        default: return super.getProperty(hash, name, checkValid);
587        }
588
589      }
590
591      @Override
592      public Base setProperty(int hash, String name, Base value) throws FHIRException {
593        switch (hash) {
594        case -1724546052: // description
595          this.description = TypeConvertor.castToString(value); // StringType
596          return value;
597        case -1320499647: // during
598          this.during = TypeConvertor.castToPeriod(value); // Period
599          return value;
600        default: return super.setProperty(hash, name, value);
601        }
602
603      }
604
605      @Override
606      public Base setProperty(String name, Base value) throws FHIRException {
607        if (name.equals("description")) {
608          this.description = TypeConvertor.castToString(value); // StringType
609        } else if (name.equals("during")) {
610          this.during = TypeConvertor.castToPeriod(value); // Period
611        } else
612          return super.setProperty(name, value);
613        return value;
614      }
615
616      @Override
617      public Base makeProperty(int hash, String name) throws FHIRException {
618        switch (hash) {
619        case -1724546052:  return getDescriptionElement();
620        case -1320499647:  return getDuring();
621        default: return super.makeProperty(hash, name);
622        }
623
624      }
625
626      @Override
627      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
628        switch (hash) {
629        case -1724546052: /*description*/ return new String[] {"string"};
630        case -1320499647: /*during*/ return new String[] {"Period"};
631        default: return super.getTypesForProperty(hash, name);
632        }
633
634      }
635
636      @Override
637      public Base addChild(String name) throws FHIRException {
638        if (name.equals("description")) {
639          throw new FHIRException("Cannot call addChild on a primitive type PractitionerRole.notAvailable.description");
640        }
641        else if (name.equals("during")) {
642          this.during = new Period();
643          return this.during;
644        }
645        else
646          return super.addChild(name);
647      }
648
649      public PractitionerRoleNotAvailableComponent copy() {
650        PractitionerRoleNotAvailableComponent dst = new PractitionerRoleNotAvailableComponent();
651        copyValues(dst);
652        return dst;
653      }
654
655      public void copyValues(PractitionerRoleNotAvailableComponent dst) {
656        super.copyValues(dst);
657        dst.description = description == null ? null : description.copy();
658        dst.during = during == null ? null : during.copy();
659      }
660
661      @Override
662      public boolean equalsDeep(Base other_) {
663        if (!super.equalsDeep(other_))
664          return false;
665        if (!(other_ instanceof PractitionerRoleNotAvailableComponent))
666          return false;
667        PractitionerRoleNotAvailableComponent o = (PractitionerRoleNotAvailableComponent) other_;
668        return compareDeep(description, o.description, true) && compareDeep(during, o.during, true);
669      }
670
671      @Override
672      public boolean equalsShallow(Base other_) {
673        if (!super.equalsShallow(other_))
674          return false;
675        if (!(other_ instanceof PractitionerRoleNotAvailableComponent))
676          return false;
677        PractitionerRoleNotAvailableComponent o = (PractitionerRoleNotAvailableComponent) other_;
678        return compareValues(description, o.description, true);
679      }
680
681      public boolean isEmpty() {
682        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, during);
683      }
684
685  public String fhirType() {
686    return "PractitionerRole.notAvailable";
687
688  }
689
690  }
691
692    /**
693     * Business Identifiers that are specific to a role/location.
694     */
695    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
696    @Description(shortDefinition="Business Identifiers that are specific to a role/location", formalDefinition="Business Identifiers that are specific to a role/location." )
697    protected List<Identifier> identifier;
698
699    /**
700     * Whether this practitioner role record is in active use.
701     */
702    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=true)
703    @Description(shortDefinition="Whether this practitioner role record is in active use", formalDefinition="Whether this practitioner role record is in active use." )
704    protected BooleanType active;
705
706    /**
707     * The period during which the person is authorized to act as a practitioner in these role(s) for the organization.
708     */
709    @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
710    @Description(shortDefinition="The period during which the practitioner is authorized to perform in these role(s)", formalDefinition="The period during which the person is authorized to act as a practitioner in these role(s) for the organization." )
711    protected Period period;
712
713    /**
714     * Practitioner that is able to provide the defined services for the organization.
715     */
716    @Child(name = "practitioner", type = {Practitioner.class}, order=3, min=0, max=1, modifier=false, summary=true)
717    @Description(shortDefinition="Practitioner that is able to provide the defined services for the organization", formalDefinition="Practitioner that is able to provide the defined services for the organization." )
718    protected Reference practitioner;
719
720    /**
721     * The organization where the Practitioner performs the roles associated.
722     */
723    @Child(name = "organization", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=true)
724    @Description(shortDefinition="Organization where the roles are available", formalDefinition="The organization where the Practitioner performs the roles associated." )
725    protected Reference organization;
726
727    /**
728     * Roles which this practitioner is authorized to perform for the organization.
729     */
730    @Child(name = "code", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
731    @Description(shortDefinition="Roles which this practitioner may perform", formalDefinition="Roles which this practitioner is authorized to perform for the organization." )
732    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/practitioner-role")
733    protected List<CodeableConcept> code;
734
735    /**
736     * Specific specialty of the practitioner.
737     */
738    @Child(name = "specialty", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
739    @Description(shortDefinition="Specific specialty of the practitioner", formalDefinition="Specific specialty of the practitioner." )
740    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
741    protected List<CodeableConcept> specialty;
742
743    /**
744     * The location(s) at which this practitioner provides care.
745     */
746    @Child(name = "location", type = {Location.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
747    @Description(shortDefinition="The location(s) at which this practitioner provides care", formalDefinition="The location(s) at which this practitioner provides care." )
748    protected List<Reference> location;
749
750    /**
751     * The list of healthcare services that this worker provides for this role's Organization/Location(s).
752     */
753    @Child(name = "healthcareService", type = {HealthcareService.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
754    @Description(shortDefinition="The list of healthcare services that this worker provides for this role's Organization/Location(s)", formalDefinition="The list of healthcare services that this worker provides for this role's Organization/Location(s)." )
755    protected List<Reference> healthcareService;
756
757    /**
758     * Contact details that are specific to the role/location/service.
759     */
760    @Child(name = "telecom", type = {ContactPoint.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
761    @Description(shortDefinition="Contact details that are specific to the role/location/service", formalDefinition="Contact details that are specific to the role/location/service." )
762    protected List<ContactPoint> telecom;
763
764    /**
765     * A collection of times the practitioner is available or performing this role at the location and/or healthcareservice.
766     */
767    @Child(name = "availableTime", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
768    @Description(shortDefinition="Times the Service Site is available", formalDefinition="A collection of times the practitioner is available or performing this role at the location and/or healthcareservice." )
769    protected List<PractitionerRoleAvailableTimeComponent> availableTime;
770
771    /**
772     * The practitioner is not available or performing this role during this period of time due to the provided reason.
773     */
774    @Child(name = "notAvailable", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
775    @Description(shortDefinition="Not available during this time due to provided reason", formalDefinition="The practitioner is not available or performing this role during this period of time due to the provided reason." )
776    protected List<PractitionerRoleNotAvailableComponent> notAvailable;
777
778    /**
779     * 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.
780     */
781    @Child(name = "availabilityExceptions", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
782    @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." )
783    protected StringType availabilityExceptions;
784
785    /**
786     * Technical endpoints providing access to services operated for the practitioner with this role.
787     */
788    @Child(name = "endpoint", type = {Endpoint.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
789    @Description(shortDefinition="Technical endpoints providing access to services operated for the practitioner with this role", formalDefinition="Technical endpoints providing access to services operated for the practitioner with this role." )
790    protected List<Reference> endpoint;
791
792    private static final long serialVersionUID = 293775464L;
793
794  /**
795   * Constructor
796   */
797    public PractitionerRole() {
798      super();
799    }
800
801    /**
802     * @return {@link #identifier} (Business Identifiers that are specific to a role/location.)
803     */
804    public List<Identifier> getIdentifier() { 
805      if (this.identifier == null)
806        this.identifier = new ArrayList<Identifier>();
807      return this.identifier;
808    }
809
810    /**
811     * @return Returns a reference to <code>this</code> for easy method chaining
812     */
813    public PractitionerRole setIdentifier(List<Identifier> theIdentifier) { 
814      this.identifier = theIdentifier;
815      return this;
816    }
817
818    public boolean hasIdentifier() { 
819      if (this.identifier == null)
820        return false;
821      for (Identifier item : this.identifier)
822        if (!item.isEmpty())
823          return true;
824      return false;
825    }
826
827    public Identifier addIdentifier() { //3
828      Identifier t = new Identifier();
829      if (this.identifier == null)
830        this.identifier = new ArrayList<Identifier>();
831      this.identifier.add(t);
832      return t;
833    }
834
835    public PractitionerRole addIdentifier(Identifier t) { //3
836      if (t == null)
837        return this;
838      if (this.identifier == null)
839        this.identifier = new ArrayList<Identifier>();
840      this.identifier.add(t);
841      return this;
842    }
843
844    /**
845     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
846     */
847    public Identifier getIdentifierFirstRep() { 
848      if (getIdentifier().isEmpty()) {
849        addIdentifier();
850      }
851      return getIdentifier().get(0);
852    }
853
854    /**
855     * @return {@link #active} (Whether this practitioner role record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
856     */
857    public BooleanType getActiveElement() { 
858      if (this.active == null)
859        if (Configuration.errorOnAutoCreate())
860          throw new Error("Attempt to auto-create PractitionerRole.active");
861        else if (Configuration.doAutoCreate())
862          this.active = new BooleanType(); // bb
863      return this.active;
864    }
865
866    public boolean hasActiveElement() { 
867      return this.active != null && !this.active.isEmpty();
868    }
869
870    public boolean hasActive() { 
871      return this.active != null && !this.active.isEmpty();
872    }
873
874    /**
875     * @param value {@link #active} (Whether this practitioner role record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
876     */
877    public PractitionerRole setActiveElement(BooleanType value) { 
878      this.active = value;
879      return this;
880    }
881
882    /**
883     * @return Whether this practitioner role record is in active use.
884     */
885    public boolean getActive() { 
886      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
887    }
888
889    /**
890     * @param value Whether this practitioner role record is in active use.
891     */
892    public PractitionerRole setActive(boolean value) { 
893        if (this.active == null)
894          this.active = new BooleanType();
895        this.active.setValue(value);
896      return this;
897    }
898
899    /**
900     * @return {@link #period} (The period during which the person is authorized to act as a practitioner in these role(s) for the organization.)
901     */
902    public Period getPeriod() { 
903      if (this.period == null)
904        if (Configuration.errorOnAutoCreate())
905          throw new Error("Attempt to auto-create PractitionerRole.period");
906        else if (Configuration.doAutoCreate())
907          this.period = new Period(); // cc
908      return this.period;
909    }
910
911    public boolean hasPeriod() { 
912      return this.period != null && !this.period.isEmpty();
913    }
914
915    /**
916     * @param value {@link #period} (The period during which the person is authorized to act as a practitioner in these role(s) for the organization.)
917     */
918    public PractitionerRole setPeriod(Period value) { 
919      this.period = value;
920      return this;
921    }
922
923    /**
924     * @return {@link #practitioner} (Practitioner that is able to provide the defined services for the organization.)
925     */
926    public Reference getPractitioner() { 
927      if (this.practitioner == null)
928        if (Configuration.errorOnAutoCreate())
929          throw new Error("Attempt to auto-create PractitionerRole.practitioner");
930        else if (Configuration.doAutoCreate())
931          this.practitioner = new Reference(); // cc
932      return this.practitioner;
933    }
934
935    public boolean hasPractitioner() { 
936      return this.practitioner != null && !this.practitioner.isEmpty();
937    }
938
939    /**
940     * @param value {@link #practitioner} (Practitioner that is able to provide the defined services for the organization.)
941     */
942    public PractitionerRole setPractitioner(Reference value) { 
943      this.practitioner = value;
944      return this;
945    }
946
947    /**
948     * @return {@link #organization} (The organization where the Practitioner performs the roles associated.)
949     */
950    public Reference getOrganization() { 
951      if (this.organization == null)
952        if (Configuration.errorOnAutoCreate())
953          throw new Error("Attempt to auto-create PractitionerRole.organization");
954        else if (Configuration.doAutoCreate())
955          this.organization = new Reference(); // cc
956      return this.organization;
957    }
958
959    public boolean hasOrganization() { 
960      return this.organization != null && !this.organization.isEmpty();
961    }
962
963    /**
964     * @param value {@link #organization} (The organization where the Practitioner performs the roles associated.)
965     */
966    public PractitionerRole setOrganization(Reference value) { 
967      this.organization = value;
968      return this;
969    }
970
971    /**
972     * @return {@link #code} (Roles which this practitioner is authorized to perform for the organization.)
973     */
974    public List<CodeableConcept> getCode() { 
975      if (this.code == null)
976        this.code = new ArrayList<CodeableConcept>();
977      return this.code;
978    }
979
980    /**
981     * @return Returns a reference to <code>this</code> for easy method chaining
982     */
983    public PractitionerRole setCode(List<CodeableConcept> theCode) { 
984      this.code = theCode;
985      return this;
986    }
987
988    public boolean hasCode() { 
989      if (this.code == null)
990        return false;
991      for (CodeableConcept item : this.code)
992        if (!item.isEmpty())
993          return true;
994      return false;
995    }
996
997    public CodeableConcept addCode() { //3
998      CodeableConcept t = new CodeableConcept();
999      if (this.code == null)
1000        this.code = new ArrayList<CodeableConcept>();
1001      this.code.add(t);
1002      return t;
1003    }
1004
1005    public PractitionerRole addCode(CodeableConcept t) { //3
1006      if (t == null)
1007        return this;
1008      if (this.code == null)
1009        this.code = new ArrayList<CodeableConcept>();
1010      this.code.add(t);
1011      return this;
1012    }
1013
1014    /**
1015     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
1016     */
1017    public CodeableConcept getCodeFirstRep() { 
1018      if (getCode().isEmpty()) {
1019        addCode();
1020      }
1021      return getCode().get(0);
1022    }
1023
1024    /**
1025     * @return {@link #specialty} (Specific specialty of the practitioner.)
1026     */
1027    public List<CodeableConcept> getSpecialty() { 
1028      if (this.specialty == null)
1029        this.specialty = new ArrayList<CodeableConcept>();
1030      return this.specialty;
1031    }
1032
1033    /**
1034     * @return Returns a reference to <code>this</code> for easy method chaining
1035     */
1036    public PractitionerRole setSpecialty(List<CodeableConcept> theSpecialty) { 
1037      this.specialty = theSpecialty;
1038      return this;
1039    }
1040
1041    public boolean hasSpecialty() { 
1042      if (this.specialty == null)
1043        return false;
1044      for (CodeableConcept item : this.specialty)
1045        if (!item.isEmpty())
1046          return true;
1047      return false;
1048    }
1049
1050    public CodeableConcept addSpecialty() { //3
1051      CodeableConcept t = new CodeableConcept();
1052      if (this.specialty == null)
1053        this.specialty = new ArrayList<CodeableConcept>();
1054      this.specialty.add(t);
1055      return t;
1056    }
1057
1058    public PractitionerRole addSpecialty(CodeableConcept t) { //3
1059      if (t == null)
1060        return this;
1061      if (this.specialty == null)
1062        this.specialty = new ArrayList<CodeableConcept>();
1063      this.specialty.add(t);
1064      return this;
1065    }
1066
1067    /**
1068     * @return The first repetition of repeating field {@link #specialty}, creating it if it does not already exist {3}
1069     */
1070    public CodeableConcept getSpecialtyFirstRep() { 
1071      if (getSpecialty().isEmpty()) {
1072        addSpecialty();
1073      }
1074      return getSpecialty().get(0);
1075    }
1076
1077    /**
1078     * @return {@link #location} (The location(s) at which this practitioner provides care.)
1079     */
1080    public List<Reference> getLocation() { 
1081      if (this.location == null)
1082        this.location = new ArrayList<Reference>();
1083      return this.location;
1084    }
1085
1086    /**
1087     * @return Returns a reference to <code>this</code> for easy method chaining
1088     */
1089    public PractitionerRole setLocation(List<Reference> theLocation) { 
1090      this.location = theLocation;
1091      return this;
1092    }
1093
1094    public boolean hasLocation() { 
1095      if (this.location == null)
1096        return false;
1097      for (Reference item : this.location)
1098        if (!item.isEmpty())
1099          return true;
1100      return false;
1101    }
1102
1103    public Reference addLocation() { //3
1104      Reference t = new Reference();
1105      if (this.location == null)
1106        this.location = new ArrayList<Reference>();
1107      this.location.add(t);
1108      return t;
1109    }
1110
1111    public PractitionerRole addLocation(Reference t) { //3
1112      if (t == null)
1113        return this;
1114      if (this.location == null)
1115        this.location = new ArrayList<Reference>();
1116      this.location.add(t);
1117      return this;
1118    }
1119
1120    /**
1121     * @return The first repetition of repeating field {@link #location}, creating it if it does not already exist {3}
1122     */
1123    public Reference getLocationFirstRep() { 
1124      if (getLocation().isEmpty()) {
1125        addLocation();
1126      }
1127      return getLocation().get(0);
1128    }
1129
1130    /**
1131     * @return {@link #healthcareService} (The list of healthcare services that this worker provides for this role's Organization/Location(s).)
1132     */
1133    public List<Reference> getHealthcareService() { 
1134      if (this.healthcareService == null)
1135        this.healthcareService = new ArrayList<Reference>();
1136      return this.healthcareService;
1137    }
1138
1139    /**
1140     * @return Returns a reference to <code>this</code> for easy method chaining
1141     */
1142    public PractitionerRole setHealthcareService(List<Reference> theHealthcareService) { 
1143      this.healthcareService = theHealthcareService;
1144      return this;
1145    }
1146
1147    public boolean hasHealthcareService() { 
1148      if (this.healthcareService == null)
1149        return false;
1150      for (Reference item : this.healthcareService)
1151        if (!item.isEmpty())
1152          return true;
1153      return false;
1154    }
1155
1156    public Reference addHealthcareService() { //3
1157      Reference t = new Reference();
1158      if (this.healthcareService == null)
1159        this.healthcareService = new ArrayList<Reference>();
1160      this.healthcareService.add(t);
1161      return t;
1162    }
1163
1164    public PractitionerRole addHealthcareService(Reference t) { //3
1165      if (t == null)
1166        return this;
1167      if (this.healthcareService == null)
1168        this.healthcareService = new ArrayList<Reference>();
1169      this.healthcareService.add(t);
1170      return this;
1171    }
1172
1173    /**
1174     * @return The first repetition of repeating field {@link #healthcareService}, creating it if it does not already exist {3}
1175     */
1176    public Reference getHealthcareServiceFirstRep() { 
1177      if (getHealthcareService().isEmpty()) {
1178        addHealthcareService();
1179      }
1180      return getHealthcareService().get(0);
1181    }
1182
1183    /**
1184     * @return {@link #telecom} (Contact details that are specific to the role/location/service.)
1185     */
1186    public List<ContactPoint> getTelecom() { 
1187      if (this.telecom == null)
1188        this.telecom = new ArrayList<ContactPoint>();
1189      return this.telecom;
1190    }
1191
1192    /**
1193     * @return Returns a reference to <code>this</code> for easy method chaining
1194     */
1195    public PractitionerRole setTelecom(List<ContactPoint> theTelecom) { 
1196      this.telecom = theTelecom;
1197      return this;
1198    }
1199
1200    public boolean hasTelecom() { 
1201      if (this.telecom == null)
1202        return false;
1203      for (ContactPoint item : this.telecom)
1204        if (!item.isEmpty())
1205          return true;
1206      return false;
1207    }
1208
1209    public ContactPoint addTelecom() { //3
1210      ContactPoint t = new ContactPoint();
1211      if (this.telecom == null)
1212        this.telecom = new ArrayList<ContactPoint>();
1213      this.telecom.add(t);
1214      return t;
1215    }
1216
1217    public PractitionerRole addTelecom(ContactPoint t) { //3
1218      if (t == null)
1219        return this;
1220      if (this.telecom == null)
1221        this.telecom = new ArrayList<ContactPoint>();
1222      this.telecom.add(t);
1223      return this;
1224    }
1225
1226    /**
1227     * @return The first repetition of repeating field {@link #telecom}, creating it if it does not already exist {3}
1228     */
1229    public ContactPoint getTelecomFirstRep() { 
1230      if (getTelecom().isEmpty()) {
1231        addTelecom();
1232      }
1233      return getTelecom().get(0);
1234    }
1235
1236    /**
1237     * @return {@link #availableTime} (A collection of times the practitioner is available or performing this role at the location and/or healthcareservice.)
1238     */
1239    public List<PractitionerRoleAvailableTimeComponent> getAvailableTime() { 
1240      if (this.availableTime == null)
1241        this.availableTime = new ArrayList<PractitionerRoleAvailableTimeComponent>();
1242      return this.availableTime;
1243    }
1244
1245    /**
1246     * @return Returns a reference to <code>this</code> for easy method chaining
1247     */
1248    public PractitionerRole setAvailableTime(List<PractitionerRoleAvailableTimeComponent> theAvailableTime) { 
1249      this.availableTime = theAvailableTime;
1250      return this;
1251    }
1252
1253    public boolean hasAvailableTime() { 
1254      if (this.availableTime == null)
1255        return false;
1256      for (PractitionerRoleAvailableTimeComponent item : this.availableTime)
1257        if (!item.isEmpty())
1258          return true;
1259      return false;
1260    }
1261
1262    public PractitionerRoleAvailableTimeComponent addAvailableTime() { //3
1263      PractitionerRoleAvailableTimeComponent t = new PractitionerRoleAvailableTimeComponent();
1264      if (this.availableTime == null)
1265        this.availableTime = new ArrayList<PractitionerRoleAvailableTimeComponent>();
1266      this.availableTime.add(t);
1267      return t;
1268    }
1269
1270    public PractitionerRole addAvailableTime(PractitionerRoleAvailableTimeComponent t) { //3
1271      if (t == null)
1272        return this;
1273      if (this.availableTime == null)
1274        this.availableTime = new ArrayList<PractitionerRoleAvailableTimeComponent>();
1275      this.availableTime.add(t);
1276      return this;
1277    }
1278
1279    /**
1280     * @return The first repetition of repeating field {@link #availableTime}, creating it if it does not already exist {3}
1281     */
1282    public PractitionerRoleAvailableTimeComponent getAvailableTimeFirstRep() { 
1283      if (getAvailableTime().isEmpty()) {
1284        addAvailableTime();
1285      }
1286      return getAvailableTime().get(0);
1287    }
1288
1289    /**
1290     * @return {@link #notAvailable} (The practitioner is not available or performing this role during this period of time due to the provided reason.)
1291     */
1292    public List<PractitionerRoleNotAvailableComponent> getNotAvailable() { 
1293      if (this.notAvailable == null)
1294        this.notAvailable = new ArrayList<PractitionerRoleNotAvailableComponent>();
1295      return this.notAvailable;
1296    }
1297
1298    /**
1299     * @return Returns a reference to <code>this</code> for easy method chaining
1300     */
1301    public PractitionerRole setNotAvailable(List<PractitionerRoleNotAvailableComponent> theNotAvailable) { 
1302      this.notAvailable = theNotAvailable;
1303      return this;
1304    }
1305
1306    public boolean hasNotAvailable() { 
1307      if (this.notAvailable == null)
1308        return false;
1309      for (PractitionerRoleNotAvailableComponent item : this.notAvailable)
1310        if (!item.isEmpty())
1311          return true;
1312      return false;
1313    }
1314
1315    public PractitionerRoleNotAvailableComponent addNotAvailable() { //3
1316      PractitionerRoleNotAvailableComponent t = new PractitionerRoleNotAvailableComponent();
1317      if (this.notAvailable == null)
1318        this.notAvailable = new ArrayList<PractitionerRoleNotAvailableComponent>();
1319      this.notAvailable.add(t);
1320      return t;
1321    }
1322
1323    public PractitionerRole addNotAvailable(PractitionerRoleNotAvailableComponent t) { //3
1324      if (t == null)
1325        return this;
1326      if (this.notAvailable == null)
1327        this.notAvailable = new ArrayList<PractitionerRoleNotAvailableComponent>();
1328      this.notAvailable.add(t);
1329      return this;
1330    }
1331
1332    /**
1333     * @return The first repetition of repeating field {@link #notAvailable}, creating it if it does not already exist {3}
1334     */
1335    public PractitionerRoleNotAvailableComponent getNotAvailableFirstRep() { 
1336      if (getNotAvailable().isEmpty()) {
1337        addNotAvailable();
1338      }
1339      return getNotAvailable().get(0);
1340    }
1341
1342    /**
1343     * @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
1344     */
1345    public StringType getAvailabilityExceptionsElement() { 
1346      if (this.availabilityExceptions == null)
1347        if (Configuration.errorOnAutoCreate())
1348          throw new Error("Attempt to auto-create PractitionerRole.availabilityExceptions");
1349        else if (Configuration.doAutoCreate())
1350          this.availabilityExceptions = new StringType(); // bb
1351      return this.availabilityExceptions;
1352    }
1353
1354    public boolean hasAvailabilityExceptionsElement() { 
1355      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
1356    }
1357
1358    public boolean hasAvailabilityExceptions() { 
1359      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
1360    }
1361
1362    /**
1363     * @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
1364     */
1365    public PractitionerRole setAvailabilityExceptionsElement(StringType value) { 
1366      this.availabilityExceptions = value;
1367      return this;
1368    }
1369
1370    /**
1371     * @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.
1372     */
1373    public String getAvailabilityExceptions() { 
1374      return this.availabilityExceptions == null ? null : this.availabilityExceptions.getValue();
1375    }
1376
1377    /**
1378     * @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.
1379     */
1380    public PractitionerRole setAvailabilityExceptions(String value) { 
1381      if (Utilities.noString(value))
1382        this.availabilityExceptions = null;
1383      else {
1384        if (this.availabilityExceptions == null)
1385          this.availabilityExceptions = new StringType();
1386        this.availabilityExceptions.setValue(value);
1387      }
1388      return this;
1389    }
1390
1391    /**
1392     * @return {@link #endpoint} (Technical endpoints providing access to services operated for the practitioner with this role.)
1393     */
1394    public List<Reference> getEndpoint() { 
1395      if (this.endpoint == null)
1396        this.endpoint = new ArrayList<Reference>();
1397      return this.endpoint;
1398    }
1399
1400    /**
1401     * @return Returns a reference to <code>this</code> for easy method chaining
1402     */
1403    public PractitionerRole setEndpoint(List<Reference> theEndpoint) { 
1404      this.endpoint = theEndpoint;
1405      return this;
1406    }
1407
1408    public boolean hasEndpoint() { 
1409      if (this.endpoint == null)
1410        return false;
1411      for (Reference item : this.endpoint)
1412        if (!item.isEmpty())
1413          return true;
1414      return false;
1415    }
1416
1417    public Reference addEndpoint() { //3
1418      Reference t = new Reference();
1419      if (this.endpoint == null)
1420        this.endpoint = new ArrayList<Reference>();
1421      this.endpoint.add(t);
1422      return t;
1423    }
1424
1425    public PractitionerRole addEndpoint(Reference t) { //3
1426      if (t == null)
1427        return this;
1428      if (this.endpoint == null)
1429        this.endpoint = new ArrayList<Reference>();
1430      this.endpoint.add(t);
1431      return this;
1432    }
1433
1434    /**
1435     * @return The first repetition of repeating field {@link #endpoint}, creating it if it does not already exist {3}
1436     */
1437    public Reference getEndpointFirstRep() { 
1438      if (getEndpoint().isEmpty()) {
1439        addEndpoint();
1440      }
1441      return getEndpoint().get(0);
1442    }
1443
1444      protected void listChildren(List<Property> children) {
1445        super.listChildren(children);
1446        children.add(new Property("identifier", "Identifier", "Business Identifiers that are specific to a role/location.", 0, java.lang.Integer.MAX_VALUE, identifier));
1447        children.add(new Property("active", "boolean", "Whether this practitioner role record is in active use.", 0, 1, active));
1448        children.add(new Property("period", "Period", "The period during which the person is authorized to act as a practitioner in these role(s) for the organization.", 0, 1, period));
1449        children.add(new Property("practitioner", "Reference(Practitioner)", "Practitioner that is able to provide the defined services for the organization.", 0, 1, practitioner));
1450        children.add(new Property("organization", "Reference(Organization)", "The organization where the Practitioner performs the roles associated.", 0, 1, organization));
1451        children.add(new Property("code", "CodeableConcept", "Roles which this practitioner is authorized to perform for the organization.", 0, java.lang.Integer.MAX_VALUE, code));
1452        children.add(new Property("specialty", "CodeableConcept", "Specific specialty of the practitioner.", 0, java.lang.Integer.MAX_VALUE, specialty));
1453        children.add(new Property("location", "Reference(Location)", "The location(s) at which this practitioner provides care.", 0, java.lang.Integer.MAX_VALUE, location));
1454        children.add(new Property("healthcareService", "Reference(HealthcareService)", "The list of healthcare services that this worker provides for this role's Organization/Location(s).", 0, java.lang.Integer.MAX_VALUE, healthcareService));
1455        children.add(new Property("telecom", "ContactPoint", "Contact details that are specific to the role/location/service.", 0, java.lang.Integer.MAX_VALUE, telecom));
1456        children.add(new Property("availableTime", "", "A collection of times the practitioner is available or performing this role at the location and/or healthcareservice.", 0, java.lang.Integer.MAX_VALUE, availableTime));
1457        children.add(new Property("notAvailable", "", "The practitioner is not available or performing this role during this period of time due to the provided reason.", 0, java.lang.Integer.MAX_VALUE, notAvailable));
1458        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));
1459        children.add(new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services operated for the practitioner with this role.", 0, java.lang.Integer.MAX_VALUE, endpoint));
1460      }
1461
1462      @Override
1463      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1464        switch (_hash) {
1465        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business Identifiers that are specific to a role/location.", 0, java.lang.Integer.MAX_VALUE, identifier);
1466        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this practitioner role record is in active use.", 0, 1, active);
1467        case -991726143: /*period*/  return new Property("period", "Period", "The period during which the person is authorized to act as a practitioner in these role(s) for the organization.", 0, 1, period);
1468        case 574573338: /*practitioner*/  return new Property("practitioner", "Reference(Practitioner)", "Practitioner that is able to provide the defined services for the organization.", 0, 1, practitioner);
1469        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The organization where the Practitioner performs the roles associated.", 0, 1, organization);
1470        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Roles which this practitioner is authorized to perform for the organization.", 0, java.lang.Integer.MAX_VALUE, code);
1471        case -1694759682: /*specialty*/  return new Property("specialty", "CodeableConcept", "Specific specialty of the practitioner.", 0, java.lang.Integer.MAX_VALUE, specialty);
1472        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The location(s) at which this practitioner provides care.", 0, java.lang.Integer.MAX_VALUE, location);
1473        case 1289661064: /*healthcareService*/  return new Property("healthcareService", "Reference(HealthcareService)", "The list of healthcare services that this worker provides for this role's Organization/Location(s).", 0, java.lang.Integer.MAX_VALUE, healthcareService);
1474        case -1429363305: /*telecom*/  return new Property("telecom", "ContactPoint", "Contact details that are specific to the role/location/service.", 0, java.lang.Integer.MAX_VALUE, telecom);
1475        case 1873069366: /*availableTime*/  return new Property("availableTime", "", "A collection of times the practitioner is available or performing this role at the location and/or healthcareservice.", 0, java.lang.Integer.MAX_VALUE, availableTime);
1476        case -629572298: /*notAvailable*/  return new Property("notAvailable", "", "The practitioner is not available or performing this role during this period of time due to the provided reason.", 0, java.lang.Integer.MAX_VALUE, notAvailable);
1477        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);
1478        case 1741102485: /*endpoint*/  return new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services operated for the practitioner with this role.", 0, java.lang.Integer.MAX_VALUE, endpoint);
1479        default: return super.getNamedProperty(_hash, _name, _checkValid);
1480        }
1481
1482      }
1483
1484      @Override
1485      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1486        switch (hash) {
1487        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1488        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
1489        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1490        case 574573338: /*practitioner*/ return this.practitioner == null ? new Base[0] : new Base[] {this.practitioner}; // Reference
1491        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
1492        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
1493        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
1494        case 1901043637: /*location*/ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // Reference
1495        case 1289661064: /*healthcareService*/ return this.healthcareService == null ? new Base[0] : this.healthcareService.toArray(new Base[this.healthcareService.size()]); // Reference
1496        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
1497        case 1873069366: /*availableTime*/ return this.availableTime == null ? new Base[0] : this.availableTime.toArray(new Base[this.availableTime.size()]); // PractitionerRoleAvailableTimeComponent
1498        case -629572298: /*notAvailable*/ return this.notAvailable == null ? new Base[0] : this.notAvailable.toArray(new Base[this.notAvailable.size()]); // PractitionerRoleNotAvailableComponent
1499        case -1149143617: /*availabilityExceptions*/ return this.availabilityExceptions == null ? new Base[0] : new Base[] {this.availabilityExceptions}; // StringType
1500        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
1501        default: return super.getProperty(hash, name, checkValid);
1502        }
1503
1504      }
1505
1506      @Override
1507      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1508        switch (hash) {
1509        case -1618432855: // identifier
1510          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1511          return value;
1512        case -1422950650: // active
1513          this.active = TypeConvertor.castToBoolean(value); // BooleanType
1514          return value;
1515        case -991726143: // period
1516          this.period = TypeConvertor.castToPeriod(value); // Period
1517          return value;
1518        case 574573338: // practitioner
1519          this.practitioner = TypeConvertor.castToReference(value); // Reference
1520          return value;
1521        case 1178922291: // organization
1522          this.organization = TypeConvertor.castToReference(value); // Reference
1523          return value;
1524        case 3059181: // code
1525          this.getCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1526          return value;
1527        case -1694759682: // specialty
1528          this.getSpecialty().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1529          return value;
1530        case 1901043637: // location
1531          this.getLocation().add(TypeConvertor.castToReference(value)); // Reference
1532          return value;
1533        case 1289661064: // healthcareService
1534          this.getHealthcareService().add(TypeConvertor.castToReference(value)); // Reference
1535          return value;
1536        case -1429363305: // telecom
1537          this.getTelecom().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
1538          return value;
1539        case 1873069366: // availableTime
1540          this.getAvailableTime().add((PractitionerRoleAvailableTimeComponent) value); // PractitionerRoleAvailableTimeComponent
1541          return value;
1542        case -629572298: // notAvailable
1543          this.getNotAvailable().add((PractitionerRoleNotAvailableComponent) value); // PractitionerRoleNotAvailableComponent
1544          return value;
1545        case -1149143617: // availabilityExceptions
1546          this.availabilityExceptions = TypeConvertor.castToString(value); // StringType
1547          return value;
1548        case 1741102485: // endpoint
1549          this.getEndpoint().add(TypeConvertor.castToReference(value)); // Reference
1550          return value;
1551        default: return super.setProperty(hash, name, value);
1552        }
1553
1554      }
1555
1556      @Override
1557      public Base setProperty(String name, Base value) throws FHIRException {
1558        if (name.equals("identifier")) {
1559          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1560        } else if (name.equals("active")) {
1561          this.active = TypeConvertor.castToBoolean(value); // BooleanType
1562        } else if (name.equals("period")) {
1563          this.period = TypeConvertor.castToPeriod(value); // Period
1564        } else if (name.equals("practitioner")) {
1565          this.practitioner = TypeConvertor.castToReference(value); // Reference
1566        } else if (name.equals("organization")) {
1567          this.organization = TypeConvertor.castToReference(value); // Reference
1568        } else if (name.equals("code")) {
1569          this.getCode().add(TypeConvertor.castToCodeableConcept(value));
1570        } else if (name.equals("specialty")) {
1571          this.getSpecialty().add(TypeConvertor.castToCodeableConcept(value));
1572        } else if (name.equals("location")) {
1573          this.getLocation().add(TypeConvertor.castToReference(value));
1574        } else if (name.equals("healthcareService")) {
1575          this.getHealthcareService().add(TypeConvertor.castToReference(value));
1576        } else if (name.equals("telecom")) {
1577          this.getTelecom().add(TypeConvertor.castToContactPoint(value));
1578        } else if (name.equals("availableTime")) {
1579          this.getAvailableTime().add((PractitionerRoleAvailableTimeComponent) value);
1580        } else if (name.equals("notAvailable")) {
1581          this.getNotAvailable().add((PractitionerRoleNotAvailableComponent) value);
1582        } else if (name.equals("availabilityExceptions")) {
1583          this.availabilityExceptions = TypeConvertor.castToString(value); // StringType
1584        } else if (name.equals("endpoint")) {
1585          this.getEndpoint().add(TypeConvertor.castToReference(value));
1586        } else
1587          return super.setProperty(name, value);
1588        return value;
1589      }
1590
1591      @Override
1592      public Base makeProperty(int hash, String name) throws FHIRException {
1593        switch (hash) {
1594        case -1618432855:  return addIdentifier(); 
1595        case -1422950650:  return getActiveElement();
1596        case -991726143:  return getPeriod();
1597        case 574573338:  return getPractitioner();
1598        case 1178922291:  return getOrganization();
1599        case 3059181:  return addCode(); 
1600        case -1694759682:  return addSpecialty(); 
1601        case 1901043637:  return addLocation(); 
1602        case 1289661064:  return addHealthcareService(); 
1603        case -1429363305:  return addTelecom(); 
1604        case 1873069366:  return addAvailableTime(); 
1605        case -629572298:  return addNotAvailable(); 
1606        case -1149143617:  return getAvailabilityExceptionsElement();
1607        case 1741102485:  return addEndpoint(); 
1608        default: return super.makeProperty(hash, name);
1609        }
1610
1611      }
1612
1613      @Override
1614      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1615        switch (hash) {
1616        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1617        case -1422950650: /*active*/ return new String[] {"boolean"};
1618        case -991726143: /*period*/ return new String[] {"Period"};
1619        case 574573338: /*practitioner*/ return new String[] {"Reference"};
1620        case 1178922291: /*organization*/ return new String[] {"Reference"};
1621        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1622        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
1623        case 1901043637: /*location*/ return new String[] {"Reference"};
1624        case 1289661064: /*healthcareService*/ return new String[] {"Reference"};
1625        case -1429363305: /*telecom*/ return new String[] {"ContactPoint"};
1626        case 1873069366: /*availableTime*/ return new String[] {};
1627        case -629572298: /*notAvailable*/ return new String[] {};
1628        case -1149143617: /*availabilityExceptions*/ return new String[] {"string"};
1629        case 1741102485: /*endpoint*/ return new String[] {"Reference"};
1630        default: return super.getTypesForProperty(hash, name);
1631        }
1632
1633      }
1634
1635      @Override
1636      public Base addChild(String name) throws FHIRException {
1637        if (name.equals("identifier")) {
1638          return addIdentifier();
1639        }
1640        else if (name.equals("active")) {
1641          throw new FHIRException("Cannot call addChild on a primitive type PractitionerRole.active");
1642        }
1643        else if (name.equals("period")) {
1644          this.period = new Period();
1645          return this.period;
1646        }
1647        else if (name.equals("practitioner")) {
1648          this.practitioner = new Reference();
1649          return this.practitioner;
1650        }
1651        else if (name.equals("organization")) {
1652          this.organization = new Reference();
1653          return this.organization;
1654        }
1655        else if (name.equals("code")) {
1656          return addCode();
1657        }
1658        else if (name.equals("specialty")) {
1659          return addSpecialty();
1660        }
1661        else if (name.equals("location")) {
1662          return addLocation();
1663        }
1664        else if (name.equals("healthcareService")) {
1665          return addHealthcareService();
1666        }
1667        else if (name.equals("telecom")) {
1668          return addTelecom();
1669        }
1670        else if (name.equals("availableTime")) {
1671          return addAvailableTime();
1672        }
1673        else if (name.equals("notAvailable")) {
1674          return addNotAvailable();
1675        }
1676        else if (name.equals("availabilityExceptions")) {
1677          throw new FHIRException("Cannot call addChild on a primitive type PractitionerRole.availabilityExceptions");
1678        }
1679        else if (name.equals("endpoint")) {
1680          return addEndpoint();
1681        }
1682        else
1683          return super.addChild(name);
1684      }
1685
1686  public String fhirType() {
1687    return "PractitionerRole";
1688
1689  }
1690
1691      public PractitionerRole copy() {
1692        PractitionerRole dst = new PractitionerRole();
1693        copyValues(dst);
1694        return dst;
1695      }
1696
1697      public void copyValues(PractitionerRole dst) {
1698        super.copyValues(dst);
1699        if (identifier != null) {
1700          dst.identifier = new ArrayList<Identifier>();
1701          for (Identifier i : identifier)
1702            dst.identifier.add(i.copy());
1703        };
1704        dst.active = active == null ? null : active.copy();
1705        dst.period = period == null ? null : period.copy();
1706        dst.practitioner = practitioner == null ? null : practitioner.copy();
1707        dst.organization = organization == null ? null : organization.copy();
1708        if (code != null) {
1709          dst.code = new ArrayList<CodeableConcept>();
1710          for (CodeableConcept i : code)
1711            dst.code.add(i.copy());
1712        };
1713        if (specialty != null) {
1714          dst.specialty = new ArrayList<CodeableConcept>();
1715          for (CodeableConcept i : specialty)
1716            dst.specialty.add(i.copy());
1717        };
1718        if (location != null) {
1719          dst.location = new ArrayList<Reference>();
1720          for (Reference i : location)
1721            dst.location.add(i.copy());
1722        };
1723        if (healthcareService != null) {
1724          dst.healthcareService = new ArrayList<Reference>();
1725          for (Reference i : healthcareService)
1726            dst.healthcareService.add(i.copy());
1727        };
1728        if (telecom != null) {
1729          dst.telecom = new ArrayList<ContactPoint>();
1730          for (ContactPoint i : telecom)
1731            dst.telecom.add(i.copy());
1732        };
1733        if (availableTime != null) {
1734          dst.availableTime = new ArrayList<PractitionerRoleAvailableTimeComponent>();
1735          for (PractitionerRoleAvailableTimeComponent i : availableTime)
1736            dst.availableTime.add(i.copy());
1737        };
1738        if (notAvailable != null) {
1739          dst.notAvailable = new ArrayList<PractitionerRoleNotAvailableComponent>();
1740          for (PractitionerRoleNotAvailableComponent i : notAvailable)
1741            dst.notAvailable.add(i.copy());
1742        };
1743        dst.availabilityExceptions = availabilityExceptions == null ? null : availabilityExceptions.copy();
1744        if (endpoint != null) {
1745          dst.endpoint = new ArrayList<Reference>();
1746          for (Reference i : endpoint)
1747            dst.endpoint.add(i.copy());
1748        };
1749      }
1750
1751      protected PractitionerRole typedCopy() {
1752        return copy();
1753      }
1754
1755      @Override
1756      public boolean equalsDeep(Base other_) {
1757        if (!super.equalsDeep(other_))
1758          return false;
1759        if (!(other_ instanceof PractitionerRole))
1760          return false;
1761        PractitionerRole o = (PractitionerRole) other_;
1762        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(period, o.period, true)
1763           && compareDeep(practitioner, o.practitioner, true) && compareDeep(organization, o.organization, true)
1764           && compareDeep(code, o.code, true) && compareDeep(specialty, o.specialty, true) && compareDeep(location, o.location, true)
1765           && compareDeep(healthcareService, o.healthcareService, true) && compareDeep(telecom, o.telecom, true)
1766           && compareDeep(availableTime, o.availableTime, true) && compareDeep(notAvailable, o.notAvailable, true)
1767           && compareDeep(availabilityExceptions, o.availabilityExceptions, true) && compareDeep(endpoint, o.endpoint, true)
1768          ;
1769      }
1770
1771      @Override
1772      public boolean equalsShallow(Base other_) {
1773        if (!super.equalsShallow(other_))
1774          return false;
1775        if (!(other_ instanceof PractitionerRole))
1776          return false;
1777        PractitionerRole o = (PractitionerRole) other_;
1778        return compareValues(active, o.active, true) && compareValues(availabilityExceptions, o.availabilityExceptions, true)
1779          ;
1780      }
1781
1782      public boolean isEmpty() {
1783        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, period
1784          , practitioner, organization, code, specialty, location, healthcareService, telecom
1785          , availableTime, notAvailable, availabilityExceptions, endpoint);
1786      }
1787
1788  @Override
1789  public ResourceType getResourceType() {
1790    return ResourceType.PractitionerRole;
1791   }
1792
1793 /**
1794   * Search parameter: <b>active</b>
1795   * <p>
1796   * Description: <b>Whether this practitioner role record is in active use</b><br>
1797   * Type: <b>token</b><br>
1798   * Path: <b>PractitionerRole.active</b><br>
1799   * </p>
1800   */
1801  @SearchParamDefinition(name="active", path="PractitionerRole.active", description="Whether this practitioner role record is in active use", type="token" )
1802  public static final String SP_ACTIVE = "active";
1803 /**
1804   * <b>Fluent Client</b> search parameter constant for <b>active</b>
1805   * <p>
1806   * Description: <b>Whether this practitioner role record is in active use</b><br>
1807   * Type: <b>token</b><br>
1808   * Path: <b>PractitionerRole.active</b><br>
1809   * </p>
1810   */
1811  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
1812
1813 /**
1814   * Search parameter: <b>date</b>
1815   * <p>
1816   * Description: <b>The period during which the practitioner is authorized to perform in these role(s)</b><br>
1817   * Type: <b>date</b><br>
1818   * Path: <b>PractitionerRole.period</b><br>
1819   * </p>
1820   */
1821  @SearchParamDefinition(name="date", path="PractitionerRole.period", description="The period during which the practitioner is authorized to perform in these role(s)", type="date" )
1822  public static final String SP_DATE = "date";
1823 /**
1824   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1825   * <p>
1826   * Description: <b>The period during which the practitioner is authorized to perform in these role(s)</b><br>
1827   * Type: <b>date</b><br>
1828   * Path: <b>PractitionerRole.period</b><br>
1829   * </p>
1830   */
1831  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1832
1833 /**
1834   * Search parameter: <b>endpoint</b>
1835   * <p>
1836   * Description: <b>Technical endpoints providing access to services operated for the practitioner with this role</b><br>
1837   * Type: <b>reference</b><br>
1838   * Path: <b>PractitionerRole.endpoint</b><br>
1839   * </p>
1840   */
1841  @SearchParamDefinition(name="endpoint", path="PractitionerRole.endpoint", description="Technical endpoints providing access to services operated for the practitioner with this role", type="reference", target={Endpoint.class } )
1842  public static final String SP_ENDPOINT = "endpoint";
1843 /**
1844   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
1845   * <p>
1846   * Description: <b>Technical endpoints providing access to services operated for the practitioner with this role</b><br>
1847   * Type: <b>reference</b><br>
1848   * Path: <b>PractitionerRole.endpoint</b><br>
1849   * </p>
1850   */
1851  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENDPOINT);
1852
1853/**
1854   * Constant for fluent queries to be used to add include statements. Specifies
1855   * the path value of "<b>PractitionerRole:endpoint</b>".
1856   */
1857  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include("PractitionerRole:endpoint").toLocked();
1858
1859 /**
1860   * Search parameter: <b>identifier</b>
1861   * <p>
1862   * Description: <b>A practitioner's Identifier</b><br>
1863   * Type: <b>token</b><br>
1864   * Path: <b>PractitionerRole.identifier</b><br>
1865   * </p>
1866   */
1867  @SearchParamDefinition(name="identifier", path="PractitionerRole.identifier", description="A practitioner's Identifier", type="token" )
1868  public static final String SP_IDENTIFIER = "identifier";
1869 /**
1870   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1871   * <p>
1872   * Description: <b>A practitioner's Identifier</b><br>
1873   * Type: <b>token</b><br>
1874   * Path: <b>PractitionerRole.identifier</b><br>
1875   * </p>
1876   */
1877  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1878
1879 /**
1880   * Search parameter: <b>location</b>
1881   * <p>
1882   * Description: <b>One of the locations at which this practitioner provides care</b><br>
1883   * Type: <b>reference</b><br>
1884   * Path: <b>PractitionerRole.location</b><br>
1885   * </p>
1886   */
1887  @SearchParamDefinition(name="location", path="PractitionerRole.location", description="One of the locations at which this practitioner provides care", type="reference", target={Location.class } )
1888  public static final String SP_LOCATION = "location";
1889 /**
1890   * <b>Fluent Client</b> search parameter constant for <b>location</b>
1891   * <p>
1892   * Description: <b>One of the locations at which this practitioner provides care</b><br>
1893   * Type: <b>reference</b><br>
1894   * Path: <b>PractitionerRole.location</b><br>
1895   * </p>
1896   */
1897  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
1898
1899/**
1900   * Constant for fluent queries to be used to add include statements. Specifies
1901   * the path value of "<b>PractitionerRole:location</b>".
1902   */
1903  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("PractitionerRole:location").toLocked();
1904
1905 /**
1906   * Search parameter: <b>organization</b>
1907   * <p>
1908   * Description: <b>The identity of the organization the practitioner represents / acts on behalf of</b><br>
1909   * Type: <b>reference</b><br>
1910   * Path: <b>PractitionerRole.organization</b><br>
1911   * </p>
1912   */
1913  @SearchParamDefinition(name="organization", path="PractitionerRole.organization", description="The identity of the organization the practitioner represents / acts on behalf of", type="reference", target={Organization.class } )
1914  public static final String SP_ORGANIZATION = "organization";
1915 /**
1916   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1917   * <p>
1918   * Description: <b>The identity of the organization the practitioner represents / acts on behalf of</b><br>
1919   * Type: <b>reference</b><br>
1920   * Path: <b>PractitionerRole.organization</b><br>
1921   * </p>
1922   */
1923  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
1924
1925/**
1926   * Constant for fluent queries to be used to add include statements. Specifies
1927   * the path value of "<b>PractitionerRole:organization</b>".
1928   */
1929  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("PractitionerRole:organization").toLocked();
1930
1931 /**
1932   * Search parameter: <b>practitioner</b>
1933   * <p>
1934   * Description: <b>Practitioner that is able to provide the defined services for the organization</b><br>
1935   * Type: <b>reference</b><br>
1936   * Path: <b>PractitionerRole.practitioner</b><br>
1937   * </p>
1938   */
1939  @SearchParamDefinition(name="practitioner", path="PractitionerRole.practitioner", description="Practitioner that is able to provide the defined services for the organization", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Practitioner.class } )
1940  public static final String SP_PRACTITIONER = "practitioner";
1941 /**
1942   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
1943   * <p>
1944   * Description: <b>Practitioner that is able to provide the defined services for the organization</b><br>
1945   * Type: <b>reference</b><br>
1946   * Path: <b>PractitionerRole.practitioner</b><br>
1947   * </p>
1948   */
1949  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
1950
1951/**
1952   * Constant for fluent queries to be used to add include statements. Specifies
1953   * the path value of "<b>PractitionerRole:practitioner</b>".
1954   */
1955  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("PractitionerRole:practitioner").toLocked();
1956
1957 /**
1958   * Search parameter: <b>role</b>
1959   * <p>
1960   * Description: <b>The practitioner can perform this role at for the organization</b><br>
1961   * Type: <b>token</b><br>
1962   * Path: <b>PractitionerRole.code</b><br>
1963   * </p>
1964   */
1965  @SearchParamDefinition(name="role", path="PractitionerRole.code", description="The practitioner can perform this role at for the organization", type="token" )
1966  public static final String SP_ROLE = "role";
1967 /**
1968   * <b>Fluent Client</b> search parameter constant for <b>role</b>
1969   * <p>
1970   * Description: <b>The practitioner can perform this role at for the organization</b><br>
1971   * Type: <b>token</b><br>
1972   * Path: <b>PractitionerRole.code</b><br>
1973   * </p>
1974   */
1975  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ROLE);
1976
1977 /**
1978   * Search parameter: <b>service</b>
1979   * <p>
1980   * Description: <b>The list of healthcare services that this worker provides for this role's Organization/Location(s)</b><br>
1981   * Type: <b>reference</b><br>
1982   * Path: <b>PractitionerRole.healthcareService</b><br>
1983   * </p>
1984   */
1985  @SearchParamDefinition(name="service", path="PractitionerRole.healthcareService", description="The list of healthcare services that this worker provides for this role's Organization/Location(s)", type="reference", target={HealthcareService.class } )
1986  public static final String SP_SERVICE = "service";
1987 /**
1988   * <b>Fluent Client</b> search parameter constant for <b>service</b>
1989   * <p>
1990   * Description: <b>The list of healthcare services that this worker provides for this role's Organization/Location(s)</b><br>
1991   * Type: <b>reference</b><br>
1992   * Path: <b>PractitionerRole.healthcareService</b><br>
1993   * </p>
1994   */
1995  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SERVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SERVICE);
1996
1997/**
1998   * Constant for fluent queries to be used to add include statements. Specifies
1999   * the path value of "<b>PractitionerRole:service</b>".
2000   */
2001  public static final ca.uhn.fhir.model.api.Include INCLUDE_SERVICE = new ca.uhn.fhir.model.api.Include("PractitionerRole:service").toLocked();
2002
2003 /**
2004   * Search parameter: <b>specialty</b>
2005   * <p>
2006   * Description: <b>The practitioner has this specialty at an organization</b><br>
2007   * Type: <b>token</b><br>
2008   * Path: <b>PractitionerRole.specialty</b><br>
2009   * </p>
2010   */
2011  @SearchParamDefinition(name="specialty", path="PractitionerRole.specialty", description="The practitioner has this specialty at an organization", type="token" )
2012  public static final String SP_SPECIALTY = "specialty";
2013 /**
2014   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
2015   * <p>
2016   * Description: <b>The practitioner has this specialty at an organization</b><br>
2017   * Type: <b>token</b><br>
2018   * Path: <b>PractitionerRole.specialty</b><br>
2019   * </p>
2020   */
2021  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIALTY);
2022
2023 /**
2024   * Search parameter: <b>email</b>
2025   * <p>
2026   * Description: <b>Multiple Resources: 
2027
2028* [Patient](patient.html): A value in an email contact
2029* [Person](person.html): A value in an email contact
2030* [Practitioner](practitioner.html): A value in an email contact
2031* [PractitionerRole](practitionerrole.html): A value in an email contact
2032* [RelatedPerson](relatedperson.html): A value in an email contact
2033</b><br>
2034   * Type: <b>token</b><br>
2035   * Path: <b>Patient.telecom.where(system='email') | Person.telecom.where(system='email') | Practitioner.telecom.where(system='email') | PractitionerRole.telecom.where(system='email') | RelatedPerson.telecom.where(system='email')</b><br>
2036   * </p>
2037   */
2038  @SearchParamDefinition(name="email", path="Patient.telecom.where(system='email') | Person.telecom.where(system='email') | Practitioner.telecom.where(system='email') | PractitionerRole.telecom.where(system='email') | RelatedPerson.telecom.where(system='email')", description="Multiple Resources: \r\n\r\n* [Patient](patient.html): A value in an email contact\r\n* [Person](person.html): A value in an email contact\r\n* [Practitioner](practitioner.html): A value in an email contact\r\n* [PractitionerRole](practitionerrole.html): A value in an email contact\r\n* [RelatedPerson](relatedperson.html): A value in an email contact\r\n", type="token" )
2039  public static final String SP_EMAIL = "email";
2040 /**
2041   * <b>Fluent Client</b> search parameter constant for <b>email</b>
2042   * <p>
2043   * Description: <b>Multiple Resources: 
2044
2045* [Patient](patient.html): A value in an email contact
2046* [Person](person.html): A value in an email contact
2047* [Practitioner](practitioner.html): A value in an email contact
2048* [PractitionerRole](practitionerrole.html): A value in an email contact
2049* [RelatedPerson](relatedperson.html): A value in an email contact
2050</b><br>
2051   * Type: <b>token</b><br>
2052   * Path: <b>Patient.telecom.where(system='email') | Person.telecom.where(system='email') | Practitioner.telecom.where(system='email') | PractitionerRole.telecom.where(system='email') | RelatedPerson.telecom.where(system='email')</b><br>
2053   * </p>
2054   */
2055  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMAIL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EMAIL);
2056
2057 /**
2058   * Search parameter: <b>phone</b>
2059   * <p>
2060   * Description: <b>Multiple Resources: 
2061
2062* [Patient](patient.html): A value in a phone contact
2063* [Person](person.html): A value in a phone contact
2064* [Practitioner](practitioner.html): A value in a phone contact
2065* [PractitionerRole](practitionerrole.html): A value in a phone contact
2066* [RelatedPerson](relatedperson.html): A value in a phone contact
2067</b><br>
2068   * Type: <b>token</b><br>
2069   * Path: <b>Patient.telecom.where(system='phone') | Person.telecom.where(system='phone') | Practitioner.telecom.where(system='phone') | PractitionerRole.telecom.where(system='phone') | RelatedPerson.telecom.where(system='phone')</b><br>
2070   * </p>
2071   */
2072  @SearchParamDefinition(name="phone", path="Patient.telecom.where(system='phone') | Person.telecom.where(system='phone') | Practitioner.telecom.where(system='phone') | PractitionerRole.telecom.where(system='phone') | RelatedPerson.telecom.where(system='phone')", description="Multiple Resources: \r\n\r\n* [Patient](patient.html): A value in a phone contact\r\n* [Person](person.html): A value in a phone contact\r\n* [Practitioner](practitioner.html): A value in a phone contact\r\n* [PractitionerRole](practitionerrole.html): A value in a phone contact\r\n* [RelatedPerson](relatedperson.html): A value in a phone contact\r\n", type="token" )
2073  public static final String SP_PHONE = "phone";
2074 /**
2075   * <b>Fluent Client</b> search parameter constant for <b>phone</b>
2076   * <p>
2077   * Description: <b>Multiple Resources: 
2078
2079* [Patient](patient.html): A value in a phone contact
2080* [Person](person.html): A value in a phone contact
2081* [Practitioner](practitioner.html): A value in a phone contact
2082* [PractitionerRole](practitionerrole.html): A value in a phone contact
2083* [RelatedPerson](relatedperson.html): A value in a phone contact
2084</b><br>
2085   * Type: <b>token</b><br>
2086   * Path: <b>Patient.telecom.where(system='phone') | Person.telecom.where(system='phone') | Practitioner.telecom.where(system='phone') | PractitionerRole.telecom.where(system='phone') | RelatedPerson.telecom.where(system='phone')</b><br>
2087   * </p>
2088   */
2089  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PHONE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PHONE);
2090
2091 /**
2092   * Search parameter: <b>telecom</b>
2093   * <p>
2094   * Description: <b>Multiple Resources: 
2095
2096* [Patient](patient.html): The value in any kind of telecom details of the patient
2097* [Person](person.html): The value in any kind of contact
2098* [Practitioner](practitioner.html): The value in any kind of contact
2099* [PractitionerRole](practitionerrole.html): The value in any kind of contact
2100* [RelatedPerson](relatedperson.html): The value in any kind of contact
2101</b><br>
2102   * Type: <b>token</b><br>
2103   * Path: <b>Patient.telecom | Person.telecom | Practitioner.telecom | PractitionerRole.telecom | RelatedPerson.telecom</b><br>
2104   * </p>
2105   */
2106  @SearchParamDefinition(name="telecom", path="Patient.telecom | Person.telecom | Practitioner.telecom | PractitionerRole.telecom | RelatedPerson.telecom", description="Multiple Resources: \r\n\r\n* [Patient](patient.html): The value in any kind of telecom details of the patient\r\n* [Person](person.html): The value in any kind of contact\r\n* [Practitioner](practitioner.html): The value in any kind of contact\r\n* [PractitionerRole](practitionerrole.html): The value in any kind of contact\r\n* [RelatedPerson](relatedperson.html): The value in any kind of contact\r\n", type="token" )
2107  public static final String SP_TELECOM = "telecom";
2108 /**
2109   * <b>Fluent Client</b> search parameter constant for <b>telecom</b>
2110   * <p>
2111   * Description: <b>Multiple Resources: 
2112
2113* [Patient](patient.html): The value in any kind of telecom details of the patient
2114* [Person](person.html): The value in any kind of contact
2115* [Practitioner](practitioner.html): The value in any kind of contact
2116* [PractitionerRole](practitionerrole.html): The value in any kind of contact
2117* [RelatedPerson](relatedperson.html): The value in any kind of contact
2118</b><br>
2119   * Type: <b>token</b><br>
2120   * Path: <b>Patient.telecom | Person.telecom | Practitioner.telecom | PractitionerRole.telecom | RelatedPerson.telecom</b><br>
2121   * </p>
2122   */
2123  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TELECOM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TELECOM);
2124
2125
2126}
2127