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