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