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