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