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