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