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