001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.
070 */
071@ResourceDef(name="GuidanceResponse", profile="http://hl7.org/fhir/StructureDefinition/GuidanceResponse")
072public class GuidanceResponse extends DomainResource {
073
074    public enum GuidanceResponseStatus {
075        /**
076         * The request was processed successfully.
077         */
078        SUCCESS, 
079        /**
080         * The request was processed successfully, but more data may result in a more complete evaluation.
081         */
082        DATAREQUESTED, 
083        /**
084         * The request was processed, but more data is required to complete the evaluation.
085         */
086        DATAREQUIRED, 
087        /**
088         * The request is currently being processed.
089         */
090        INPROGRESS, 
091        /**
092         * The request was not processed successfully.
093         */
094        FAILURE, 
095        /**
096         * The response was entered in error.
097         */
098        ENTEREDINERROR, 
099        /**
100         * added to help the parsers with the generic types
101         */
102        NULL;
103        public static GuidanceResponseStatus fromCode(String codeString) throws FHIRException {
104            if (codeString == null || "".equals(codeString))
105                return null;
106        if ("success".equals(codeString))
107          return SUCCESS;
108        if ("data-requested".equals(codeString))
109          return DATAREQUESTED;
110        if ("data-required".equals(codeString))
111          return DATAREQUIRED;
112        if ("in-progress".equals(codeString))
113          return INPROGRESS;
114        if ("failure".equals(codeString))
115          return FAILURE;
116        if ("entered-in-error".equals(codeString))
117          return ENTEREDINERROR;
118        if (Configuration.isAcceptInvalidEnums())
119          return null;
120        else
121          throw new FHIRException("Unknown GuidanceResponseStatus code '"+codeString+"'");
122        }
123        public String toCode() {
124          switch (this) {
125            case SUCCESS: return "success";
126            case DATAREQUESTED: return "data-requested";
127            case DATAREQUIRED: return "data-required";
128            case INPROGRESS: return "in-progress";
129            case FAILURE: return "failure";
130            case ENTEREDINERROR: return "entered-in-error";
131            default: return "?";
132          }
133        }
134        public String getSystem() {
135          switch (this) {
136            case SUCCESS: return "http://hl7.org/fhir/guidance-response-status";
137            case DATAREQUESTED: return "http://hl7.org/fhir/guidance-response-status";
138            case DATAREQUIRED: return "http://hl7.org/fhir/guidance-response-status";
139            case INPROGRESS: return "http://hl7.org/fhir/guidance-response-status";
140            case FAILURE: return "http://hl7.org/fhir/guidance-response-status";
141            case ENTEREDINERROR: return "http://hl7.org/fhir/guidance-response-status";
142            default: return "?";
143          }
144        }
145        public String getDefinition() {
146          switch (this) {
147            case SUCCESS: return "The request was processed successfully.";
148            case DATAREQUESTED: return "The request was processed successfully, but more data may result in a more complete evaluation.";
149            case DATAREQUIRED: return "The request was processed, but more data is required to complete the evaluation.";
150            case INPROGRESS: return "The request is currently being processed.";
151            case FAILURE: return "The request was not processed successfully.";
152            case ENTEREDINERROR: return "The response was entered in error.";
153            default: return "?";
154          }
155        }
156        public String getDisplay() {
157          switch (this) {
158            case SUCCESS: return "Success";
159            case DATAREQUESTED: return "Data Requested";
160            case DATAREQUIRED: return "Data Required";
161            case INPROGRESS: return "In Progress";
162            case FAILURE: return "Failure";
163            case ENTEREDINERROR: return "Entered In Error";
164            default: return "?";
165          }
166        }
167    }
168
169  public static class GuidanceResponseStatusEnumFactory implements EnumFactory<GuidanceResponseStatus> {
170    public GuidanceResponseStatus fromCode(String codeString) throws IllegalArgumentException {
171      if (codeString == null || "".equals(codeString))
172            if (codeString == null || "".equals(codeString))
173                return null;
174        if ("success".equals(codeString))
175          return GuidanceResponseStatus.SUCCESS;
176        if ("data-requested".equals(codeString))
177          return GuidanceResponseStatus.DATAREQUESTED;
178        if ("data-required".equals(codeString))
179          return GuidanceResponseStatus.DATAREQUIRED;
180        if ("in-progress".equals(codeString))
181          return GuidanceResponseStatus.INPROGRESS;
182        if ("failure".equals(codeString))
183          return GuidanceResponseStatus.FAILURE;
184        if ("entered-in-error".equals(codeString))
185          return GuidanceResponseStatus.ENTEREDINERROR;
186        throw new IllegalArgumentException("Unknown GuidanceResponseStatus code '"+codeString+"'");
187        }
188        public Enumeration<GuidanceResponseStatus> fromType(Base code) throws FHIRException {
189          if (code == null)
190            return null;
191          if (code.isEmpty())
192            return new Enumeration<GuidanceResponseStatus>(this);
193          String codeString = ((PrimitiveType) code).asStringValue();
194          if (codeString == null || "".equals(codeString))
195            return null;
196        if ("success".equals(codeString))
197          return new Enumeration<GuidanceResponseStatus>(this, GuidanceResponseStatus.SUCCESS);
198        if ("data-requested".equals(codeString))
199          return new Enumeration<GuidanceResponseStatus>(this, GuidanceResponseStatus.DATAREQUESTED);
200        if ("data-required".equals(codeString))
201          return new Enumeration<GuidanceResponseStatus>(this, GuidanceResponseStatus.DATAREQUIRED);
202        if ("in-progress".equals(codeString))
203          return new Enumeration<GuidanceResponseStatus>(this, GuidanceResponseStatus.INPROGRESS);
204        if ("failure".equals(codeString))
205          return new Enumeration<GuidanceResponseStatus>(this, GuidanceResponseStatus.FAILURE);
206        if ("entered-in-error".equals(codeString))
207          return new Enumeration<GuidanceResponseStatus>(this, GuidanceResponseStatus.ENTEREDINERROR);
208        throw new FHIRException("Unknown GuidanceResponseStatus code '"+codeString+"'");
209        }
210    public String toCode(GuidanceResponseStatus code) {
211      if (code == GuidanceResponseStatus.SUCCESS)
212        return "success";
213      if (code == GuidanceResponseStatus.DATAREQUESTED)
214        return "data-requested";
215      if (code == GuidanceResponseStatus.DATAREQUIRED)
216        return "data-required";
217      if (code == GuidanceResponseStatus.INPROGRESS)
218        return "in-progress";
219      if (code == GuidanceResponseStatus.FAILURE)
220        return "failure";
221      if (code == GuidanceResponseStatus.ENTEREDINERROR)
222        return "entered-in-error";
223      return "?";
224      }
225    public String toSystem(GuidanceResponseStatus code) {
226      return code.getSystem();
227      }
228    }
229
230    /**
231     * The identifier of the request associated with this response. If an identifier was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario.
232     */
233    @Child(name = "requestIdentifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
234    @Description(shortDefinition="The identifier of the request associated with this response, if any", formalDefinition="The identifier of the request associated with this response. If an identifier was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario." )
235    protected Identifier requestIdentifier;
236
237    /**
238     * Allows a service to provide  unique, business identifiers for the response.
239     */
240    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
241    @Description(shortDefinition="Business identifier", formalDefinition="Allows a service to provide  unique, business identifiers for the response." )
242    protected List<Identifier> identifier;
243
244    /**
245     * An identifier, CodeableConcept or canonical reference to the guidance that was requested.
246     */
247    @Child(name = "module", type = {UriType.class, CanonicalType.class, CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
248    @Description(shortDefinition="What guidance was requested", formalDefinition="An identifier, CodeableConcept or canonical reference to the guidance that was requested." )
249    protected Type module;
250
251    /**
252     * The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.
253     */
254    @Child(name = "status", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=true)
255    @Description(shortDefinition="success | data-requested | data-required | in-progress | failure | entered-in-error", formalDefinition="The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information." )
256    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/guidance-response-status")
257    protected Enumeration<GuidanceResponseStatus> status;
258
259    /**
260     * The patient for which the request was processed.
261     */
262    @Child(name = "subject", type = {Patient.class, Group.class}, order=4, min=0, max=1, modifier=false, summary=false)
263    @Description(shortDefinition="Patient the request was performed for", formalDefinition="The patient for which the request was processed." )
264    protected Reference subject;
265
266    /**
267     * The encounter during which this response was created or to which the creation of this record is tightly associated.
268     */
269    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=false)
270    @Description(shortDefinition="Encounter during which the response was returned", formalDefinition="The encounter during which this response was created or to which the creation of this record is tightly associated." )
271    protected Reference encounter;
272
273    /**
274     * Indicates when the guidance response was processed.
275     */
276    @Child(name = "occurrenceDateTime", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
277    @Description(shortDefinition="When the guidance response was processed", formalDefinition="Indicates when the guidance response was processed." )
278    protected DateTimeType occurrenceDateTime;
279
280    /**
281     * Provides a reference to the device that performed the guidance.
282     */
283    @Child(name = "performer", type = {Device.class}, order=7, min=0, max=1, modifier=false, summary=false)
284    @Description(shortDefinition="Device returning the guidance", formalDefinition="Provides a reference to the device that performed the guidance." )
285    protected Reference performer;
286
287    /**
288     * Describes the reason for the guidance response in coded or textual form.
289     */
290    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
291    @Description(shortDefinition="Why guidance is needed", formalDefinition="Describes the reason for the guidance response in coded or textual form." )
292    protected List<CodeableConcept> reasonCode;
293
294    /**
295     * Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.
296     */
297    @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
298    @Description(shortDefinition="Why guidance is needed", formalDefinition="Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response." )
299    protected List<Reference> reasonReference;
300
301    /**
302     * Provides a mechanism to communicate additional information about the response.
303     */
304    @Child(name = "note", type = {Annotation.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
305    @Description(shortDefinition="Additional notes about the response", formalDefinition="Provides a mechanism to communicate additional information about the response." )
306    protected List<Annotation> note;
307
308    /**
309     * Messages resulting from the evaluation of the artifact or artifacts. As part of evaluating the request, the engine may produce informational or warning messages. These messages will be provided by this element.
310     */
311    @Child(name = "evaluationMessage", type = {OperationOutcome.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
312    @Description(shortDefinition="Messages resulting from the evaluation of the artifact or artifacts", formalDefinition="Messages resulting from the evaluation of the artifact or artifacts. As part of evaluating the request, the engine may produce informational or warning messages. These messages will be provided by this element." )
313    protected List<Reference> evaluationMessage;
314
315    /**
316     * The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element.
317     */
318    @Child(name = "outputParameters", type = {Parameters.class}, order=12, min=0, max=1, modifier=false, summary=false)
319    @Description(shortDefinition="The output parameters of the evaluation, if any", formalDefinition="The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element." )
320    protected Reference outputParameters;
321
322    /**
323     * The actions, if any, produced by the evaluation of the artifact.
324     */
325    @Child(name = "result", type = {CarePlan.class, RequestGroup.class}, order=13, min=0, max=1, modifier=false, summary=false)
326    @Description(shortDefinition="Proposed actions, if any", formalDefinition="The actions, if any, produced by the evaluation of the artifact." )
327    protected Reference result;
328
329    /**
330     * If the evaluation could not be completed due to lack of information, or additional information would potentially result in a more accurate response, this element will a description of the data required in order to proceed with the evaluation. A subsequent request to the service should include this data.
331     */
332    @Child(name = "dataRequirement", type = {DataRequirement.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
333    @Description(shortDefinition="Additional required data", formalDefinition="If the evaluation could not be completed due to lack of information, or additional information would potentially result in a more accurate response, this element will a description of the data required in order to proceed with the evaluation. A subsequent request to the service should include this data." )
334    protected List<DataRequirement> dataRequirement;
335
336    private static final long serialVersionUID = -159555787L;
337
338  /**
339   * Constructor
340   */
341    public GuidanceResponse() {
342      super();
343    }
344
345  /**
346   * Constructor
347   */
348    public GuidanceResponse(Type module, Enumeration<GuidanceResponseStatus> status) {
349      super();
350      this.module = module;
351      this.status = status;
352    }
353
354    /**
355     * @return {@link #requestIdentifier} (The identifier of the request associated with this response. If an identifier was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario.)
356     */
357    public Identifier getRequestIdentifier() { 
358      if (this.requestIdentifier == null)
359        if (Configuration.errorOnAutoCreate())
360          throw new Error("Attempt to auto-create GuidanceResponse.requestIdentifier");
361        else if (Configuration.doAutoCreate())
362          this.requestIdentifier = new Identifier(); // cc
363      return this.requestIdentifier;
364    }
365
366    public boolean hasRequestIdentifier() { 
367      return this.requestIdentifier != null && !this.requestIdentifier.isEmpty();
368    }
369
370    /**
371     * @param value {@link #requestIdentifier} (The identifier of the request associated with this response. If an identifier was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario.)
372     */
373    public GuidanceResponse setRequestIdentifier(Identifier value) { 
374      this.requestIdentifier = value;
375      return this;
376    }
377
378    /**
379     * @return {@link #identifier} (Allows a service to provide  unique, business identifiers for the response.)
380     */
381    public List<Identifier> getIdentifier() { 
382      if (this.identifier == null)
383        this.identifier = new ArrayList<Identifier>();
384      return this.identifier;
385    }
386
387    /**
388     * @return Returns a reference to <code>this</code> for easy method chaining
389     */
390    public GuidanceResponse setIdentifier(List<Identifier> theIdentifier) { 
391      this.identifier = theIdentifier;
392      return this;
393    }
394
395    public boolean hasIdentifier() { 
396      if (this.identifier == null)
397        return false;
398      for (Identifier item : this.identifier)
399        if (!item.isEmpty())
400          return true;
401      return false;
402    }
403
404    public Identifier addIdentifier() { //3
405      Identifier t = new Identifier();
406      if (this.identifier == null)
407        this.identifier = new ArrayList<Identifier>();
408      this.identifier.add(t);
409      return t;
410    }
411
412    public GuidanceResponse addIdentifier(Identifier t) { //3
413      if (t == null)
414        return this;
415      if (this.identifier == null)
416        this.identifier = new ArrayList<Identifier>();
417      this.identifier.add(t);
418      return this;
419    }
420
421    /**
422     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
423     */
424    public Identifier getIdentifierFirstRep() { 
425      if (getIdentifier().isEmpty()) {
426        addIdentifier();
427      }
428      return getIdentifier().get(0);
429    }
430
431    /**
432     * @return {@link #module} (An identifier, CodeableConcept or canonical reference to the guidance that was requested.)
433     */
434    public Type getModule() { 
435      return this.module;
436    }
437
438    /**
439     * @return {@link #module} (An identifier, CodeableConcept or canonical reference to the guidance that was requested.)
440     */
441    public UriType getModuleUriType() throws FHIRException { 
442      if (this.module == null)
443        this.module = new UriType();
444      if (!(this.module instanceof UriType))
445        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.module.getClass().getName()+" was encountered");
446      return (UriType) this.module;
447    }
448
449    public boolean hasModuleUriType() { 
450      return this != null && this.module instanceof UriType;
451    }
452
453    /**
454     * @return {@link #module} (An identifier, CodeableConcept or canonical reference to the guidance that was requested.)
455     */
456    public CanonicalType getModuleCanonicalType() throws FHIRException { 
457      if (this.module == null)
458        this.module = new CanonicalType();
459      if (!(this.module instanceof CanonicalType))
460        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.module.getClass().getName()+" was encountered");
461      return (CanonicalType) this.module;
462    }
463
464    public boolean hasModuleCanonicalType() { 
465      return this != null && this.module instanceof CanonicalType;
466    }
467
468    /**
469     * @return {@link #module} (An identifier, CodeableConcept or canonical reference to the guidance that was requested.)
470     */
471    public CodeableConcept getModuleCodeableConcept() throws FHIRException { 
472      if (this.module == null)
473        this.module = new CodeableConcept();
474      if (!(this.module instanceof CodeableConcept))
475        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.module.getClass().getName()+" was encountered");
476      return (CodeableConcept) this.module;
477    }
478
479    public boolean hasModuleCodeableConcept() { 
480      return this != null && this.module instanceof CodeableConcept;
481    }
482
483    public boolean hasModule() { 
484      return this.module != null && !this.module.isEmpty();
485    }
486
487    /**
488     * @param value {@link #module} (An identifier, CodeableConcept or canonical reference to the guidance that was requested.)
489     */
490    public GuidanceResponse setModule(Type value) { 
491      if (value != null && !(value instanceof UriType || value instanceof CanonicalType || value instanceof CodeableConcept))
492        throw new Error("Not the right type for GuidanceResponse.module[x]: "+value.fhirType());
493      this.module = value;
494      return this;
495    }
496
497    /**
498     * @return {@link #status} (The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
499     */
500    public Enumeration<GuidanceResponseStatus> getStatusElement() { 
501      if (this.status == null)
502        if (Configuration.errorOnAutoCreate())
503          throw new Error("Attempt to auto-create GuidanceResponse.status");
504        else if (Configuration.doAutoCreate())
505          this.status = new Enumeration<GuidanceResponseStatus>(new GuidanceResponseStatusEnumFactory()); // bb
506      return this.status;
507    }
508
509    public boolean hasStatusElement() { 
510      return this.status != null && !this.status.isEmpty();
511    }
512
513    public boolean hasStatus() { 
514      return this.status != null && !this.status.isEmpty();
515    }
516
517    /**
518     * @param value {@link #status} (The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
519     */
520    public GuidanceResponse setStatusElement(Enumeration<GuidanceResponseStatus> value) { 
521      this.status = value;
522      return this;
523    }
524
525    /**
526     * @return The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.
527     */
528    public GuidanceResponseStatus getStatus() { 
529      return this.status == null ? null : this.status.getValue();
530    }
531
532    /**
533     * @param value The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.
534     */
535    public GuidanceResponse setStatus(GuidanceResponseStatus value) { 
536        if (this.status == null)
537          this.status = new Enumeration<GuidanceResponseStatus>(new GuidanceResponseStatusEnumFactory());
538        this.status.setValue(value);
539      return this;
540    }
541
542    /**
543     * @return {@link #subject} (The patient for which the request was processed.)
544     */
545    public Reference getSubject() { 
546      if (this.subject == null)
547        if (Configuration.errorOnAutoCreate())
548          throw new Error("Attempt to auto-create GuidanceResponse.subject");
549        else if (Configuration.doAutoCreate())
550          this.subject = new Reference(); // cc
551      return this.subject;
552    }
553
554    public boolean hasSubject() { 
555      return this.subject != null && !this.subject.isEmpty();
556    }
557
558    /**
559     * @param value {@link #subject} (The patient for which the request was processed.)
560     */
561    public GuidanceResponse setSubject(Reference value) { 
562      this.subject = value;
563      return this;
564    }
565
566    /**
567     * @return {@link #encounter} (The encounter during which this response was created or to which the creation of this record is tightly associated.)
568     */
569    public Reference getEncounter() { 
570      if (this.encounter == null)
571        if (Configuration.errorOnAutoCreate())
572          throw new Error("Attempt to auto-create GuidanceResponse.encounter");
573        else if (Configuration.doAutoCreate())
574          this.encounter = new Reference(); // cc
575      return this.encounter;
576    }
577
578    public boolean hasEncounter() { 
579      return this.encounter != null && !this.encounter.isEmpty();
580    }
581
582    /**
583     * @param value {@link #encounter} (The encounter during which this response was created or to which the creation of this record is tightly associated.)
584     */
585    public GuidanceResponse setEncounter(Reference value) { 
586      this.encounter = value;
587      return this;
588    }
589
590    /**
591     * @return {@link #occurrenceDateTime} (Indicates when the guidance response was processed.). This is the underlying object with id, value and extensions. The accessor "getOccurrenceDateTime" gives direct access to the value
592     */
593    public DateTimeType getOccurrenceDateTimeElement() { 
594      if (this.occurrenceDateTime == null)
595        if (Configuration.errorOnAutoCreate())
596          throw new Error("Attempt to auto-create GuidanceResponse.occurrenceDateTime");
597        else if (Configuration.doAutoCreate())
598          this.occurrenceDateTime = new DateTimeType(); // bb
599      return this.occurrenceDateTime;
600    }
601
602    public boolean hasOccurrenceDateTimeElement() { 
603      return this.occurrenceDateTime != null && !this.occurrenceDateTime.isEmpty();
604    }
605
606    public boolean hasOccurrenceDateTime() { 
607      return this.occurrenceDateTime != null && !this.occurrenceDateTime.isEmpty();
608    }
609
610    /**
611     * @param value {@link #occurrenceDateTime} (Indicates when the guidance response was processed.). This is the underlying object with id, value and extensions. The accessor "getOccurrenceDateTime" gives direct access to the value
612     */
613    public GuidanceResponse setOccurrenceDateTimeElement(DateTimeType value) { 
614      this.occurrenceDateTime = value;
615      return this;
616    }
617
618    /**
619     * @return Indicates when the guidance response was processed.
620     */
621    public Date getOccurrenceDateTime() { 
622      return this.occurrenceDateTime == null ? null : this.occurrenceDateTime.getValue();
623    }
624
625    /**
626     * @param value Indicates when the guidance response was processed.
627     */
628    public GuidanceResponse setOccurrenceDateTime(Date value) { 
629      if (value == null)
630        this.occurrenceDateTime = null;
631      else {
632        if (this.occurrenceDateTime == null)
633          this.occurrenceDateTime = new DateTimeType();
634        this.occurrenceDateTime.setValue(value);
635      }
636      return this;
637    }
638
639    /**
640     * @return {@link #performer} (Provides a reference to the device that performed the guidance.)
641     */
642    public Reference getPerformer() { 
643      if (this.performer == null)
644        if (Configuration.errorOnAutoCreate())
645          throw new Error("Attempt to auto-create GuidanceResponse.performer");
646        else if (Configuration.doAutoCreate())
647          this.performer = new Reference(); // cc
648      return this.performer;
649    }
650
651    public boolean hasPerformer() { 
652      return this.performer != null && !this.performer.isEmpty();
653    }
654
655    /**
656     * @param value {@link #performer} (Provides a reference to the device that performed the guidance.)
657     */
658    public GuidanceResponse setPerformer(Reference value) { 
659      this.performer = value;
660      return this;
661    }
662
663    /**
664     * @return {@link #reasonCode} (Describes the reason for the guidance response in coded or textual form.)
665     */
666    public List<CodeableConcept> getReasonCode() { 
667      if (this.reasonCode == null)
668        this.reasonCode = new ArrayList<CodeableConcept>();
669      return this.reasonCode;
670    }
671
672    /**
673     * @return Returns a reference to <code>this</code> for easy method chaining
674     */
675    public GuidanceResponse setReasonCode(List<CodeableConcept> theReasonCode) { 
676      this.reasonCode = theReasonCode;
677      return this;
678    }
679
680    public boolean hasReasonCode() { 
681      if (this.reasonCode == null)
682        return false;
683      for (CodeableConcept item : this.reasonCode)
684        if (!item.isEmpty())
685          return true;
686      return false;
687    }
688
689    public CodeableConcept addReasonCode() { //3
690      CodeableConcept t = new CodeableConcept();
691      if (this.reasonCode == null)
692        this.reasonCode = new ArrayList<CodeableConcept>();
693      this.reasonCode.add(t);
694      return t;
695    }
696
697    public GuidanceResponse addReasonCode(CodeableConcept t) { //3
698      if (t == null)
699        return this;
700      if (this.reasonCode == null)
701        this.reasonCode = new ArrayList<CodeableConcept>();
702      this.reasonCode.add(t);
703      return this;
704    }
705
706    /**
707     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
708     */
709    public CodeableConcept getReasonCodeFirstRep() { 
710      if (getReasonCode().isEmpty()) {
711        addReasonCode();
712      }
713      return getReasonCode().get(0);
714    }
715
716    /**
717     * @return {@link #reasonReference} (Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.)
718     */
719    public List<Reference> getReasonReference() { 
720      if (this.reasonReference == null)
721        this.reasonReference = new ArrayList<Reference>();
722      return this.reasonReference;
723    }
724
725    /**
726     * @return Returns a reference to <code>this</code> for easy method chaining
727     */
728    public GuidanceResponse setReasonReference(List<Reference> theReasonReference) { 
729      this.reasonReference = theReasonReference;
730      return this;
731    }
732
733    public boolean hasReasonReference() { 
734      if (this.reasonReference == null)
735        return false;
736      for (Reference item : this.reasonReference)
737        if (!item.isEmpty())
738          return true;
739      return false;
740    }
741
742    public Reference addReasonReference() { //3
743      Reference t = new Reference();
744      if (this.reasonReference == null)
745        this.reasonReference = new ArrayList<Reference>();
746      this.reasonReference.add(t);
747      return t;
748    }
749
750    public GuidanceResponse addReasonReference(Reference t) { //3
751      if (t == null)
752        return this;
753      if (this.reasonReference == null)
754        this.reasonReference = new ArrayList<Reference>();
755      this.reasonReference.add(t);
756      return this;
757    }
758
759    /**
760     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
761     */
762    public Reference getReasonReferenceFirstRep() { 
763      if (getReasonReference().isEmpty()) {
764        addReasonReference();
765      }
766      return getReasonReference().get(0);
767    }
768
769    /**
770     * @return {@link #note} (Provides a mechanism to communicate additional information about the response.)
771     */
772    public List<Annotation> getNote() { 
773      if (this.note == null)
774        this.note = new ArrayList<Annotation>();
775      return this.note;
776    }
777
778    /**
779     * @return Returns a reference to <code>this</code> for easy method chaining
780     */
781    public GuidanceResponse setNote(List<Annotation> theNote) { 
782      this.note = theNote;
783      return this;
784    }
785
786    public boolean hasNote() { 
787      if (this.note == null)
788        return false;
789      for (Annotation item : this.note)
790        if (!item.isEmpty())
791          return true;
792      return false;
793    }
794
795    public Annotation addNote() { //3
796      Annotation t = new Annotation();
797      if (this.note == null)
798        this.note = new ArrayList<Annotation>();
799      this.note.add(t);
800      return t;
801    }
802
803    public GuidanceResponse addNote(Annotation t) { //3
804      if (t == null)
805        return this;
806      if (this.note == null)
807        this.note = new ArrayList<Annotation>();
808      this.note.add(t);
809      return this;
810    }
811
812    /**
813     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
814     */
815    public Annotation getNoteFirstRep() { 
816      if (getNote().isEmpty()) {
817        addNote();
818      }
819      return getNote().get(0);
820    }
821
822    /**
823     * @return {@link #evaluationMessage} (Messages resulting from the evaluation of the artifact or artifacts. As part of evaluating the request, the engine may produce informational or warning messages. These messages will be provided by this element.)
824     */
825    public List<Reference> getEvaluationMessage() { 
826      if (this.evaluationMessage == null)
827        this.evaluationMessage = new ArrayList<Reference>();
828      return this.evaluationMessage;
829    }
830
831    /**
832     * @return Returns a reference to <code>this</code> for easy method chaining
833     */
834    public GuidanceResponse setEvaluationMessage(List<Reference> theEvaluationMessage) { 
835      this.evaluationMessage = theEvaluationMessage;
836      return this;
837    }
838
839    public boolean hasEvaluationMessage() { 
840      if (this.evaluationMessage == null)
841        return false;
842      for (Reference item : this.evaluationMessage)
843        if (!item.isEmpty())
844          return true;
845      return false;
846    }
847
848    public Reference addEvaluationMessage() { //3
849      Reference t = new Reference();
850      if (this.evaluationMessage == null)
851        this.evaluationMessage = new ArrayList<Reference>();
852      this.evaluationMessage.add(t);
853      return t;
854    }
855
856    public GuidanceResponse addEvaluationMessage(Reference t) { //3
857      if (t == null)
858        return this;
859      if (this.evaluationMessage == null)
860        this.evaluationMessage = new ArrayList<Reference>();
861      this.evaluationMessage.add(t);
862      return this;
863    }
864
865    /**
866     * @return The first repetition of repeating field {@link #evaluationMessage}, creating it if it does not already exist
867     */
868    public Reference getEvaluationMessageFirstRep() { 
869      if (getEvaluationMessage().isEmpty()) {
870        addEvaluationMessage();
871      }
872      return getEvaluationMessage().get(0);
873    }
874
875    /**
876     * @return {@link #outputParameters} (The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element.)
877     */
878    public Reference getOutputParameters() { 
879      if (this.outputParameters == null)
880        if (Configuration.errorOnAutoCreate())
881          throw new Error("Attempt to auto-create GuidanceResponse.outputParameters");
882        else if (Configuration.doAutoCreate())
883          this.outputParameters = new Reference(); // cc
884      return this.outputParameters;
885    }
886
887    public boolean hasOutputParameters() { 
888      return this.outputParameters != null && !this.outputParameters.isEmpty();
889    }
890
891    /**
892     * @param value {@link #outputParameters} (The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element.)
893     */
894    public GuidanceResponse setOutputParameters(Reference value) { 
895      this.outputParameters = value;
896      return this;
897    }
898
899    /**
900     * @return {@link #result} (The actions, if any, produced by the evaluation of the artifact.)
901     */
902    public Reference getResult() { 
903      if (this.result == null)
904        if (Configuration.errorOnAutoCreate())
905          throw new Error("Attempt to auto-create GuidanceResponse.result");
906        else if (Configuration.doAutoCreate())
907          this.result = new Reference(); // cc
908      return this.result;
909    }
910
911    public boolean hasResult() { 
912      return this.result != null && !this.result.isEmpty();
913    }
914
915    /**
916     * @param value {@link #result} (The actions, if any, produced by the evaluation of the artifact.)
917     */
918    public GuidanceResponse setResult(Reference value) { 
919      this.result = value;
920      return this;
921    }
922
923    /**
924     * @return {@link #dataRequirement} (If the evaluation could not be completed due to lack of information, or additional information would potentially result in a more accurate response, this element will a description of the data required in order to proceed with the evaluation. A subsequent request to the service should include this data.)
925     */
926    public List<DataRequirement> getDataRequirement() { 
927      if (this.dataRequirement == null)
928        this.dataRequirement = new ArrayList<DataRequirement>();
929      return this.dataRequirement;
930    }
931
932    /**
933     * @return Returns a reference to <code>this</code> for easy method chaining
934     */
935    public GuidanceResponse setDataRequirement(List<DataRequirement> theDataRequirement) { 
936      this.dataRequirement = theDataRequirement;
937      return this;
938    }
939
940    public boolean hasDataRequirement() { 
941      if (this.dataRequirement == null)
942        return false;
943      for (DataRequirement item : this.dataRequirement)
944        if (!item.isEmpty())
945          return true;
946      return false;
947    }
948
949    public DataRequirement addDataRequirement() { //3
950      DataRequirement t = new DataRequirement();
951      if (this.dataRequirement == null)
952        this.dataRequirement = new ArrayList<DataRequirement>();
953      this.dataRequirement.add(t);
954      return t;
955    }
956
957    public GuidanceResponse addDataRequirement(DataRequirement t) { //3
958      if (t == null)
959        return this;
960      if (this.dataRequirement == null)
961        this.dataRequirement = new ArrayList<DataRequirement>();
962      this.dataRequirement.add(t);
963      return this;
964    }
965
966    /**
967     * @return The first repetition of repeating field {@link #dataRequirement}, creating it if it does not already exist
968     */
969    public DataRequirement getDataRequirementFirstRep() { 
970      if (getDataRequirement().isEmpty()) {
971        addDataRequirement();
972      }
973      return getDataRequirement().get(0);
974    }
975
976      protected void listChildren(List<Property> children) {
977        super.listChildren(children);
978        children.add(new Property("requestIdentifier", "Identifier", "The identifier of the request associated with this response. If an identifier was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario.", 0, 1, requestIdentifier));
979        children.add(new Property("identifier", "Identifier", "Allows a service to provide  unique, business identifiers for the response.", 0, java.lang.Integer.MAX_VALUE, identifier));
980        children.add(new Property("module[x]", "uri|canonical|CodeableConcept", "An identifier, CodeableConcept or canonical reference to the guidance that was requested.", 0, 1, module));
981        children.add(new Property("status", "code", "The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.", 0, 1, status));
982        children.add(new Property("subject", "Reference(Patient|Group)", "The patient for which the request was processed.", 0, 1, subject));
983        children.add(new Property("encounter", "Reference(Encounter)", "The encounter during which this response was created or to which the creation of this record is tightly associated.", 0, 1, encounter));
984        children.add(new Property("occurrenceDateTime", "dateTime", "Indicates when the guidance response was processed.", 0, 1, occurrenceDateTime));
985        children.add(new Property("performer", "Reference(Device)", "Provides a reference to the device that performed the guidance.", 0, 1, performer));
986        children.add(new Property("reasonCode", "CodeableConcept", "Describes the reason for the guidance response in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
987        children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
988        children.add(new Property("note", "Annotation", "Provides a mechanism to communicate additional information about the response.", 0, java.lang.Integer.MAX_VALUE, note));
989        children.add(new Property("evaluationMessage", "Reference(OperationOutcome)", "Messages resulting from the evaluation of the artifact or artifacts. As part of evaluating the request, the engine may produce informational or warning messages. These messages will be provided by this element.", 0, java.lang.Integer.MAX_VALUE, evaluationMessage));
990        children.add(new Property("outputParameters", "Reference(Parameters)", "The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element.", 0, 1, outputParameters));
991        children.add(new Property("result", "Reference(CarePlan|RequestGroup)", "The actions, if any, produced by the evaluation of the artifact.", 0, 1, result));
992        children.add(new Property("dataRequirement", "DataRequirement", "If the evaluation could not be completed due to lack of information, or additional information would potentially result in a more accurate response, this element will a description of the data required in order to proceed with the evaluation. A subsequent request to the service should include this data.", 0, java.lang.Integer.MAX_VALUE, dataRequirement));
993      }
994
995      @Override
996      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
997        switch (_hash) {
998        case -354233192: /*requestIdentifier*/  return new Property("requestIdentifier", "Identifier", "The identifier of the request associated with this response. If an identifier was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario.", 0, 1, requestIdentifier);
999        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Allows a service to provide  unique, business identifiers for the response.", 0, java.lang.Integer.MAX_VALUE, identifier);
1000        case -1552083308: /*module[x]*/  return new Property("module[x]", "uri|canonical|CodeableConcept", "An identifier, CodeableConcept or canonical reference to the guidance that was requested.", 0, 1, module);
1001        case -1068784020: /*module*/  return new Property("module[x]", "uri|canonical|CodeableConcept", "An identifier, CodeableConcept or canonical reference to the guidance that was requested.", 0, 1, module);
1002        case -1552089248: /*moduleUri*/  return new Property("module[x]", "uri|canonical|CodeableConcept", "An identifier, CodeableConcept or canonical reference to the guidance that was requested.", 0, 1, module);
1003        case -1153656856: /*moduleCanonical*/  return new Property("module[x]", "uri|canonical|CodeableConcept", "An identifier, CodeableConcept or canonical reference to the guidance that was requested.", 0, 1, module);
1004        case -1157899371: /*moduleCodeableConcept*/  return new Property("module[x]", "uri|canonical|CodeableConcept", "An identifier, CodeableConcept or canonical reference to the guidance that was requested.", 0, 1, module);
1005        case -892481550: /*status*/  return new Property("status", "code", "The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.", 0, 1, status);
1006        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The patient for which the request was processed.", 0, 1, subject);
1007        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The encounter during which this response was created or to which the creation of this record is tightly associated.", 0, 1, encounter);
1008        case -298443636: /*occurrenceDateTime*/  return new Property("occurrenceDateTime", "dateTime", "Indicates when the guidance response was processed.", 0, 1, occurrenceDateTime);
1009        case 481140686: /*performer*/  return new Property("performer", "Reference(Device)", "Provides a reference to the device that performed the guidance.", 0, 1, performer);
1010        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Describes the reason for the guidance response in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
1011        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
1012        case 3387378: /*note*/  return new Property("note", "Annotation", "Provides a mechanism to communicate additional information about the response.", 0, java.lang.Integer.MAX_VALUE, note);
1013        case 1081619755: /*evaluationMessage*/  return new Property("evaluationMessage", "Reference(OperationOutcome)", "Messages resulting from the evaluation of the artifact or artifacts. As part of evaluating the request, the engine may produce informational or warning messages. These messages will be provided by this element.", 0, java.lang.Integer.MAX_VALUE, evaluationMessage);
1014        case 525609419: /*outputParameters*/  return new Property("outputParameters", "Reference(Parameters)", "The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element.", 0, 1, outputParameters);
1015        case -934426595: /*result*/  return new Property("result", "Reference(CarePlan|RequestGroup)", "The actions, if any, produced by the evaluation of the artifact.", 0, 1, result);
1016        case 629147193: /*dataRequirement*/  return new Property("dataRequirement", "DataRequirement", "If the evaluation could not be completed due to lack of information, or additional information would potentially result in a more accurate response, this element will a description of the data required in order to proceed with the evaluation. A subsequent request to the service should include this data.", 0, java.lang.Integer.MAX_VALUE, dataRequirement);
1017        default: return super.getNamedProperty(_hash, _name, _checkValid);
1018        }
1019
1020      }
1021
1022      @Override
1023      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1024        switch (hash) {
1025        case -354233192: /*requestIdentifier*/ return this.requestIdentifier == null ? new Base[0] : new Base[] {this.requestIdentifier}; // Identifier
1026        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1027        case -1068784020: /*module*/ return this.module == null ? new Base[0] : new Base[] {this.module}; // Type
1028        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<GuidanceResponseStatus>
1029        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1030        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1031        case -298443636: /*occurrenceDateTime*/ return this.occurrenceDateTime == null ? new Base[0] : new Base[] {this.occurrenceDateTime}; // DateTimeType
1032        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
1033        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
1034        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
1035        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1036        case 1081619755: /*evaluationMessage*/ return this.evaluationMessage == null ? new Base[0] : this.evaluationMessage.toArray(new Base[this.evaluationMessage.size()]); // Reference
1037        case 525609419: /*outputParameters*/ return this.outputParameters == null ? new Base[0] : new Base[] {this.outputParameters}; // Reference
1038        case -934426595: /*result*/ return this.result == null ? new Base[0] : new Base[] {this.result}; // Reference
1039        case 629147193: /*dataRequirement*/ return this.dataRequirement == null ? new Base[0] : this.dataRequirement.toArray(new Base[this.dataRequirement.size()]); // DataRequirement
1040        default: return super.getProperty(hash, name, checkValid);
1041        }
1042
1043      }
1044
1045      @Override
1046      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1047        switch (hash) {
1048        case -354233192: // requestIdentifier
1049          this.requestIdentifier = castToIdentifier(value); // Identifier
1050          return value;
1051        case -1618432855: // identifier
1052          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1053          return value;
1054        case -1068784020: // module
1055          this.module = castToType(value); // Type
1056          return value;
1057        case -892481550: // status
1058          value = new GuidanceResponseStatusEnumFactory().fromType(castToCode(value));
1059          this.status = (Enumeration) value; // Enumeration<GuidanceResponseStatus>
1060          return value;
1061        case -1867885268: // subject
1062          this.subject = castToReference(value); // Reference
1063          return value;
1064        case 1524132147: // encounter
1065          this.encounter = castToReference(value); // Reference
1066          return value;
1067        case -298443636: // occurrenceDateTime
1068          this.occurrenceDateTime = castToDateTime(value); // DateTimeType
1069          return value;
1070        case 481140686: // performer
1071          this.performer = castToReference(value); // Reference
1072          return value;
1073        case 722137681: // reasonCode
1074          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
1075          return value;
1076        case -1146218137: // reasonReference
1077          this.getReasonReference().add(castToReference(value)); // Reference
1078          return value;
1079        case 3387378: // note
1080          this.getNote().add(castToAnnotation(value)); // Annotation
1081          return value;
1082        case 1081619755: // evaluationMessage
1083          this.getEvaluationMessage().add(castToReference(value)); // Reference
1084          return value;
1085        case 525609419: // outputParameters
1086          this.outputParameters = castToReference(value); // Reference
1087          return value;
1088        case -934426595: // result
1089          this.result = castToReference(value); // Reference
1090          return value;
1091        case 629147193: // dataRequirement
1092          this.getDataRequirement().add(castToDataRequirement(value)); // DataRequirement
1093          return value;
1094        default: return super.setProperty(hash, name, value);
1095        }
1096
1097      }
1098
1099      @Override
1100      public Base setProperty(String name, Base value) throws FHIRException {
1101        if (name.equals("requestIdentifier")) {
1102          this.requestIdentifier = castToIdentifier(value); // Identifier
1103        } else if (name.equals("identifier")) {
1104          this.getIdentifier().add(castToIdentifier(value));
1105        } else if (name.equals("module[x]")) {
1106          this.module = castToType(value); // Type
1107        } else if (name.equals("status")) {
1108          value = new GuidanceResponseStatusEnumFactory().fromType(castToCode(value));
1109          this.status = (Enumeration) value; // Enumeration<GuidanceResponseStatus>
1110        } else if (name.equals("subject")) {
1111          this.subject = castToReference(value); // Reference
1112        } else if (name.equals("encounter")) {
1113          this.encounter = castToReference(value); // Reference
1114        } else if (name.equals("occurrenceDateTime")) {
1115          this.occurrenceDateTime = castToDateTime(value); // DateTimeType
1116        } else if (name.equals("performer")) {
1117          this.performer = castToReference(value); // Reference
1118        } else if (name.equals("reasonCode")) {
1119          this.getReasonCode().add(castToCodeableConcept(value));
1120        } else if (name.equals("reasonReference")) {
1121          this.getReasonReference().add(castToReference(value));
1122        } else if (name.equals("note")) {
1123          this.getNote().add(castToAnnotation(value));
1124        } else if (name.equals("evaluationMessage")) {
1125          this.getEvaluationMessage().add(castToReference(value));
1126        } else if (name.equals("outputParameters")) {
1127          this.outputParameters = castToReference(value); // Reference
1128        } else if (name.equals("result")) {
1129          this.result = castToReference(value); // Reference
1130        } else if (name.equals("dataRequirement")) {
1131          this.getDataRequirement().add(castToDataRequirement(value));
1132        } else
1133          return super.setProperty(name, value);
1134        return value;
1135      }
1136
1137      @Override
1138      public Base makeProperty(int hash, String name) throws FHIRException {
1139        switch (hash) {
1140        case -354233192:  return getRequestIdentifier();
1141        case -1618432855:  return addIdentifier(); 
1142        case -1552083308:  return getModule();
1143        case -1068784020:  return getModule();
1144        case -892481550:  return getStatusElement();
1145        case -1867885268:  return getSubject();
1146        case 1524132147:  return getEncounter();
1147        case -298443636:  return getOccurrenceDateTimeElement();
1148        case 481140686:  return getPerformer();
1149        case 722137681:  return addReasonCode(); 
1150        case -1146218137:  return addReasonReference(); 
1151        case 3387378:  return addNote(); 
1152        case 1081619755:  return addEvaluationMessage(); 
1153        case 525609419:  return getOutputParameters();
1154        case -934426595:  return getResult();
1155        case 629147193:  return addDataRequirement(); 
1156        default: return super.makeProperty(hash, name);
1157        }
1158
1159      }
1160
1161      @Override
1162      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1163        switch (hash) {
1164        case -354233192: /*requestIdentifier*/ return new String[] {"Identifier"};
1165        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1166        case -1068784020: /*module*/ return new String[] {"uri", "canonical", "CodeableConcept"};
1167        case -892481550: /*status*/ return new String[] {"code"};
1168        case -1867885268: /*subject*/ return new String[] {"Reference"};
1169        case 1524132147: /*encounter*/ return new String[] {"Reference"};
1170        case -298443636: /*occurrenceDateTime*/ return new String[] {"dateTime"};
1171        case 481140686: /*performer*/ return new String[] {"Reference"};
1172        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
1173        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
1174        case 3387378: /*note*/ return new String[] {"Annotation"};
1175        case 1081619755: /*evaluationMessage*/ return new String[] {"Reference"};
1176        case 525609419: /*outputParameters*/ return new String[] {"Reference"};
1177        case -934426595: /*result*/ return new String[] {"Reference"};
1178        case 629147193: /*dataRequirement*/ return new String[] {"DataRequirement"};
1179        default: return super.getTypesForProperty(hash, name);
1180        }
1181
1182      }
1183
1184      @Override
1185      public Base addChild(String name) throws FHIRException {
1186        if (name.equals("requestIdentifier")) {
1187          this.requestIdentifier = new Identifier();
1188          return this.requestIdentifier;
1189        }
1190        else if (name.equals("identifier")) {
1191          return addIdentifier();
1192        }
1193        else if (name.equals("moduleUri")) {
1194          this.module = new UriType();
1195          return this.module;
1196        }
1197        else if (name.equals("moduleCanonical")) {
1198          this.module = new CanonicalType();
1199          return this.module;
1200        }
1201        else if (name.equals("moduleCodeableConcept")) {
1202          this.module = new CodeableConcept();
1203          return this.module;
1204        }
1205        else if (name.equals("status")) {
1206          throw new FHIRException("Cannot call addChild on a primitive type GuidanceResponse.status");
1207        }
1208        else if (name.equals("subject")) {
1209          this.subject = new Reference();
1210          return this.subject;
1211        }
1212        else if (name.equals("encounter")) {
1213          this.encounter = new Reference();
1214          return this.encounter;
1215        }
1216        else if (name.equals("occurrenceDateTime")) {
1217          throw new FHIRException("Cannot call addChild on a primitive type GuidanceResponse.occurrenceDateTime");
1218        }
1219        else if (name.equals("performer")) {
1220          this.performer = new Reference();
1221          return this.performer;
1222        }
1223        else if (name.equals("reasonCode")) {
1224          return addReasonCode();
1225        }
1226        else if (name.equals("reasonReference")) {
1227          return addReasonReference();
1228        }
1229        else if (name.equals("note")) {
1230          return addNote();
1231        }
1232        else if (name.equals("evaluationMessage")) {
1233          return addEvaluationMessage();
1234        }
1235        else if (name.equals("outputParameters")) {
1236          this.outputParameters = new Reference();
1237          return this.outputParameters;
1238        }
1239        else if (name.equals("result")) {
1240          this.result = new Reference();
1241          return this.result;
1242        }
1243        else if (name.equals("dataRequirement")) {
1244          return addDataRequirement();
1245        }
1246        else
1247          return super.addChild(name);
1248      }
1249
1250  public String fhirType() {
1251    return "GuidanceResponse";
1252
1253  }
1254
1255      public GuidanceResponse copy() {
1256        GuidanceResponse dst = new GuidanceResponse();
1257        copyValues(dst);
1258        return dst;
1259      }
1260
1261      public void copyValues(GuidanceResponse dst) {
1262        super.copyValues(dst);
1263        dst.requestIdentifier = requestIdentifier == null ? null : requestIdentifier.copy();
1264        if (identifier != null) {
1265          dst.identifier = new ArrayList<Identifier>();
1266          for (Identifier i : identifier)
1267            dst.identifier.add(i.copy());
1268        };
1269        dst.module = module == null ? null : module.copy();
1270        dst.status = status == null ? null : status.copy();
1271        dst.subject = subject == null ? null : subject.copy();
1272        dst.encounter = encounter == null ? null : encounter.copy();
1273        dst.occurrenceDateTime = occurrenceDateTime == null ? null : occurrenceDateTime.copy();
1274        dst.performer = performer == null ? null : performer.copy();
1275        if (reasonCode != null) {
1276          dst.reasonCode = new ArrayList<CodeableConcept>();
1277          for (CodeableConcept i : reasonCode)
1278            dst.reasonCode.add(i.copy());
1279        };
1280        if (reasonReference != null) {
1281          dst.reasonReference = new ArrayList<Reference>();
1282          for (Reference i : reasonReference)
1283            dst.reasonReference.add(i.copy());
1284        };
1285        if (note != null) {
1286          dst.note = new ArrayList<Annotation>();
1287          for (Annotation i : note)
1288            dst.note.add(i.copy());
1289        };
1290        if (evaluationMessage != null) {
1291          dst.evaluationMessage = new ArrayList<Reference>();
1292          for (Reference i : evaluationMessage)
1293            dst.evaluationMessage.add(i.copy());
1294        };
1295        dst.outputParameters = outputParameters == null ? null : outputParameters.copy();
1296        dst.result = result == null ? null : result.copy();
1297        if (dataRequirement != null) {
1298          dst.dataRequirement = new ArrayList<DataRequirement>();
1299          for (DataRequirement i : dataRequirement)
1300            dst.dataRequirement.add(i.copy());
1301        };
1302      }
1303
1304      protected GuidanceResponse typedCopy() {
1305        return copy();
1306      }
1307
1308      @Override
1309      public boolean equalsDeep(Base other_) {
1310        if (!super.equalsDeep(other_))
1311          return false;
1312        if (!(other_ instanceof GuidanceResponse))
1313          return false;
1314        GuidanceResponse o = (GuidanceResponse) other_;
1315        return compareDeep(requestIdentifier, o.requestIdentifier, true) && compareDeep(identifier, o.identifier, true)
1316           && compareDeep(module, o.module, true) && compareDeep(status, o.status, true) && compareDeep(subject, o.subject, true)
1317           && compareDeep(encounter, o.encounter, true) && compareDeep(occurrenceDateTime, o.occurrenceDateTime, true)
1318           && compareDeep(performer, o.performer, true) && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
1319           && compareDeep(note, o.note, true) && compareDeep(evaluationMessage, o.evaluationMessage, true)
1320           && compareDeep(outputParameters, o.outputParameters, true) && compareDeep(result, o.result, true)
1321           && compareDeep(dataRequirement, o.dataRequirement, true);
1322      }
1323
1324      @Override
1325      public boolean equalsShallow(Base other_) {
1326        if (!super.equalsShallow(other_))
1327          return false;
1328        if (!(other_ instanceof GuidanceResponse))
1329          return false;
1330        GuidanceResponse o = (GuidanceResponse) other_;
1331        return compareValues(status, o.status, true) && compareValues(occurrenceDateTime, o.occurrenceDateTime, true)
1332          ;
1333      }
1334
1335      public boolean isEmpty() {
1336        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(requestIdentifier, identifier
1337          , module, status, subject, encounter, occurrenceDateTime, performer, reasonCode
1338          , reasonReference, note, evaluationMessage, outputParameters, result, dataRequirement
1339          );
1340      }
1341
1342  @Override
1343  public ResourceType getResourceType() {
1344    return ResourceType.GuidanceResponse;
1345   }
1346
1347 /**
1348   * Search parameter: <b>request</b>
1349   * <p>
1350   * Description: <b>The identifier of the request associated with the response</b><br>
1351   * Type: <b>token</b><br>
1352   * Path: <b>GuidanceResponse.requestIdentifier</b><br>
1353   * </p>
1354   */
1355  @SearchParamDefinition(name="request", path="GuidanceResponse.requestIdentifier", description="The identifier of the request associated with the response", type="token" )
1356  public static final String SP_REQUEST = "request";
1357 /**
1358   * <b>Fluent Client</b> search parameter constant for <b>request</b>
1359   * <p>
1360   * Description: <b>The identifier of the request associated with the response</b><br>
1361   * Type: <b>token</b><br>
1362   * Path: <b>GuidanceResponse.requestIdentifier</b><br>
1363   * </p>
1364   */
1365  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REQUEST = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REQUEST);
1366
1367 /**
1368   * Search parameter: <b>identifier</b>
1369   * <p>
1370   * Description: <b>The identifier of the guidance response</b><br>
1371   * Type: <b>token</b><br>
1372   * Path: <b>GuidanceResponse.identifier</b><br>
1373   * </p>
1374   */
1375  @SearchParamDefinition(name="identifier", path="GuidanceResponse.identifier", description="The identifier of the guidance response", type="token" )
1376  public static final String SP_IDENTIFIER = "identifier";
1377 /**
1378   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1379   * <p>
1380   * Description: <b>The identifier of the guidance response</b><br>
1381   * Type: <b>token</b><br>
1382   * Path: <b>GuidanceResponse.identifier</b><br>
1383   * </p>
1384   */
1385  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1386
1387 /**
1388   * Search parameter: <b>patient</b>
1389   * <p>
1390   * Description: <b>The identity of a patient to search for guidance response results</b><br>
1391   * Type: <b>reference</b><br>
1392   * Path: <b>GuidanceResponse.subject</b><br>
1393   * </p>
1394   */
1395  @SearchParamDefinition(name="patient", path="GuidanceResponse.subject.where(resolve() is Patient)", description="The identity of a patient to search for guidance response results", type="reference", target={Patient.class } )
1396  public static final String SP_PATIENT = "patient";
1397 /**
1398   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1399   * <p>
1400   * Description: <b>The identity of a patient to search for guidance response results</b><br>
1401   * Type: <b>reference</b><br>
1402   * Path: <b>GuidanceResponse.subject</b><br>
1403   * </p>
1404   */
1405  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1406
1407/**
1408   * Constant for fluent queries to be used to add include statements. Specifies
1409   * the path value of "<b>GuidanceResponse:patient</b>".
1410   */
1411  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("GuidanceResponse:patient").toLocked();
1412
1413 /**
1414   * Search parameter: <b>subject</b>
1415   * <p>
1416   * Description: <b>The subject that the guidance response is about</b><br>
1417   * Type: <b>reference</b><br>
1418   * Path: <b>GuidanceResponse.subject</b><br>
1419   * </p>
1420   */
1421  @SearchParamDefinition(name="subject", path="GuidanceResponse.subject", description="The subject that the guidance response is about", type="reference", target={Group.class, Patient.class } )
1422  public static final String SP_SUBJECT = "subject";
1423 /**
1424   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1425   * <p>
1426   * Description: <b>The subject that the guidance response is about</b><br>
1427   * Type: <b>reference</b><br>
1428   * Path: <b>GuidanceResponse.subject</b><br>
1429   * </p>
1430   */
1431  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1432
1433/**
1434   * Constant for fluent queries to be used to add include statements. Specifies
1435   * the path value of "<b>GuidanceResponse:subject</b>".
1436   */
1437  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("GuidanceResponse:subject").toLocked();
1438
1439
1440}
1441