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

namespace Google\Cloud\Dialogflow\Cx\V3;

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

/**
 * The result of calling a tool's action that has been executed by the client.
 *
 * Generated from protobuf message <code>google.cloud.dialogflow.cx.v3.ToolCallResult</code>
 */
class ToolCallResult extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with
     * this call. Format:
     * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.
     *
     * Generated from protobuf field <code>string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $tool = '';
    /**
     * Required. The name of the tool's action associated with this call.
     *
     * Generated from protobuf field <code>string action = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $action = '';
    protected $result;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $tool
     *           Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with
     *           this call. Format:
     *           `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.
     *     @type string $action
     *           Required. The name of the tool's action associated with this call.
     *     @type \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult\Error $error
     *           The tool call's error.
     *     @type \Google\Protobuf\Struct $output_parameters
     *           The tool call's output parameters.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ToolCall::initOnce();
        parent::__construct($data);
    }

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

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

        return $this;
    }

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

    /**
     * Required. The name of the tool's action associated with this call.
     *
     * Generated from protobuf field <code>string action = 2 [(.google.api.field_behavior) = REQUIRED];</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.cx.v3.ToolCallResult.Error error = 3;</code>
     * @return \Google\Cloud\Dialogflow\Cx\V3\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.cx.v3.ToolCallResult.Error error = 3;</code>
     * @param \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult\Error $var
     * @return $this
     */
    public function setError($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult\Error::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * The tool call's output parameters.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct output_parameters = 4;</code>
     * @return \Google\Protobuf\Struct|null
     */
    public function getOutputParameters()
    {
        return $this->readOneof(4);
    }

    public function hasOutputParameters()
    {
        return $this->hasOneof(4);
    }

    /**
     * The tool call's output parameters.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct output_parameters = 4;</code>
     * @param \Google\Protobuf\Struct $var
     * @return $this
     */
    public function setOutputParameters($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
        $this->writeOneof(4, $var);

        return $this;
    }

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

}

