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