<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/dialogflow/v2/tool_call.proto

namespace Google\Cloud\Dialogflow\V2;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * The result of calling a tool's action.
 *
 * Generated from protobuf message <code>google.cloud.dialogflow.v2.ToolCallResult</code>
 */
class ToolCallResult extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The name of the tool's action associated with this call.
     *
     * Generated from protobuf field <code>string action = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $action = '';
    /**
     * Output only. Create time of the tool call result.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $create_time = null;
    /**
     * Optional. The answer record associated with this tool call result.
     *
     * Generated from protobuf field <code>string answer_record = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $answer_record = '';
    protected $source;
    protected $result;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $tool
     *           Optional. The [tool][google.cloud.dialogflow.v2.Tool] associated with
     *           this call. Format:
     *           `projects/<ProjectID>/locations/<LocationID>/tools/<ToolID>`.
     *     @type string $ces_toolset
     *           Optional. CES toolset name for this call.
     *           Format:
     *           `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/toolsets/ToolsetID>`.
     *     @type string $ces_tool
     *           Optional. CES tool name for this call.
     *           Format:
     *           `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/tools/<ToolID>`.
     *     @type string $ces_app
     *           Optional. CES app name for this call.
     *           Format:
     *           `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>`.
     *     @type string $action
     *           Optional. The name of the tool's action associated with this call.
     *     @type \Google\Cloud\Dialogflow\V2\ToolCallResult\Error $error
     *           The tool call's error.
     *     @type string $raw_content
     *           Only populated if the response content is not utf-8 encoded.
     *           (by definition byte fields are base64 encoded).
     *     @type string $content
     *           Only populated if the response content is utf-8 encoded.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. Create time of the tool call result.
     *     @type string $answer_record
     *           Optional. The answer record associated with this tool call result.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dialogflow\V2\ToolCall::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. The [tool][google.cloud.dialogflow.v2.Tool] associated with
     * this call. Format:
     * `projects/<ProjectID>/locations/<LocationID>/tools/<ToolID>`.
     *
     * Generated from protobuf field <code>string tool = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getTool()
    {
        return $this->readOneof(1);
    }

    public function hasTool()
    {
        return $this->hasOneof(1);
    }

    /**
     * Optional. The [tool][google.cloud.dialogflow.v2.Tool] associated with
     * this call. Format:
     * `projects/<ProjectID>/locations/<LocationID>/tools/<ToolID>`.
     *
     * Generated from protobuf field <code>string tool = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setTool($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Optional. CES toolset name for this call.
     * Format:
     * `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/toolsets/ToolsetID>`.
     *
     * Generated from protobuf field <code>string ces_toolset = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getCesToolset()
    {
        return $this->readOneof(13);
    }

    public function hasCesToolset()
    {
        return $this->hasOneof(13);
    }

    /**
     * Optional. CES toolset name for this call.
     * Format:
     * `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/toolsets/ToolsetID>`.
     *
     * Generated from protobuf field <code>string ces_toolset = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setCesToolset($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(13, $var);

        return $this;
    }

    /**
     * Optional. CES tool name for this call.
     * Format:
     * `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/tools/<ToolID>`.
     *
     * Generated from protobuf field <code>string ces_tool = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getCesTool()
    {
        return $this->readOneof(12);
    }

    public function hasCesTool()
    {
        return $this->hasOneof(12);
    }

    /**
     * Optional. CES tool name for this call.
     * Format:
     * `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/tools/<ToolID>`.
     *
     * Generated from protobuf field <code>string ces_tool = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setCesTool($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(12, $var);

        return $this;
    }

    /**
     * Optional. CES app name for this call.
     * Format:
     * `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>`.
     *
     * Generated from protobuf field <code>string ces_app = 11 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getCesApp()
    {
        return $this->readOneof(11);
    }

    public function hasCesApp()
    {
        return $this->hasOneof(11);
    }

    /**
     * Optional. CES app name for this call.
     * Format:
     * `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>`.
     *
     * Generated from protobuf field <code>string ces_app = 11 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setCesApp($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(11, $var);

        return $this;
    }

    /**
     * Optional. The name of the tool's action associated with this call.
     *
     * Generated from protobuf field <code>string action = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getAction()
    {
        return $this->action;
    }

    /**
     * Optional. The name of the tool's action associated with this call.
     *
     * Generated from protobuf field <code>string action = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setAction($var)
    {
        GPBUtil::checkString($var, True);
        $this->action = $var;

        return $this;
    }

    /**
     * The tool call's error.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.v2.ToolCallResult.Error error = 3;</code>
     * @return \Google\Cloud\Dialogflow\V2\ToolCallResult\Error|null
     */
    public function getError()
    {
        return $this->readOneof(3);
    }

    public function hasError()
    {
        return $this->hasOneof(3);
    }

    /**
     * The tool call's error.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.v2.ToolCallResult.Error error = 3;</code>
     * @param \Google\Cloud\Dialogflow\V2\ToolCallResult\Error $var
     * @return $this
     */
    public function setError($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\ToolCallResult\Error::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Only populated if the response content is not utf-8 encoded.
     * (by definition byte fields are base64 encoded).
     *
     * Generated from protobuf field <code>bytes raw_content = 5;</code>
     * @return string
     */
    public function getRawContent()
    {
        return $this->readOneof(5);
    }

    public function hasRawContent()
    {
        return $this->hasOneof(5);
    }

    /**
     * Only populated if the response content is not utf-8 encoded.
     * (by definition byte fields are base64 encoded).
     *
     * Generated from protobuf field <code>bytes raw_content = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setRawContent($var)
    {
        GPBUtil::checkString($var, False);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Only populated if the response content is utf-8 encoded.
     *
     * Generated from protobuf field <code>string content = 6;</code>
     * @return string
     */
    public function getContent()
    {
        return $this->readOneof(6);
    }

    public function hasContent()
    {
        return $this->hasOneof(6);
    }

    /**
     * Only populated if the response content is utf-8 encoded.
     *
     * Generated from protobuf field <code>string content = 6;</code>
     * @param string $var
     * @return $this
     */
    public function setContent($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Output only. Create time of the tool call result.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * Output only. Create time of the tool call result.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * Optional. The answer record associated with this tool call result.
     *
     * Generated from protobuf field <code>string answer_record = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getAnswerRecord()
    {
        return $this->answer_record;
    }

    /**
     * Optional. The answer record associated with this tool call result.
     *
     * Generated from protobuf field <code>string answer_record = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setAnswerRecord($var)
    {
        GPBUtil::checkString($var, True);
        $this->answer_record = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getSource()
    {
        return $this->whichOneof("source");
    }

    /**
     * @return string
     */
    public function getResult()
    {
        return $this->whichOneof("result");
    }

}

