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