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