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

namespace Google\Cloud\Dialogflow\V2;

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

/**
 * Represents a context.
 *
 * Generated from protobuf message <code>google.cloud.dialogflow.v2.Context</code>
 */
class Context extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The unique identifier of the context. Format:
     * `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
     * The `Context ID` is always converted to lowercase, may only contain
     * characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * Optional. The number of conversational query requests after which the
     * context expires. If set to `0` (the default) the context expires
     * immediately. Contexts expire automatically after 20 minutes if there
     * are no matching queries.
     *
     * Generated from protobuf field <code>int32 lifespan_count = 2;</code>
     */
    private $lifespan_count = 0;
    /**
     * Optional. The collection of parameters associated with this context.
     * Refer to [this
     * doc](https://cloud.google.com/dialogflow/docs/intents-actions-parameters)
     * for syntax.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct parameters = 3;</code>
     */
    private $parameters = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. The unique identifier of the context. Format:
     *           `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
     *           The `Context ID` is always converted to lowercase, may only contain
     *           characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long.
     *     @type int $lifespan_count
     *           Optional. The number of conversational query requests after which the
     *           context expires. If set to `0` (the default) the context expires
     *           immediately. Contexts expire automatically after 20 minutes if there
     *           are no matching queries.
     *     @type \Google\Protobuf\Struct $parameters
     *           Optional. The collection of parameters associated with this context.
     *           Refer to [this
     *           doc](https://cloud.google.com/dialogflow/docs/intents-actions-parameters)
     *           for syntax.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dialogflow\V2\Context::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The unique identifier of the context. Format:
     * `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
     * The `Context ID` is always converted to lowercase, may only contain
     * characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. The unique identifier of the context. Format:
     * `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
     * The `Context ID` is always converted to lowercase, may only contain
     * characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Optional. The number of conversational query requests after which the
     * context expires. If set to `0` (the default) the context expires
     * immediately. Contexts expire automatically after 20 minutes if there
     * are no matching queries.
     *
     * Generated from protobuf field <code>int32 lifespan_count = 2;</code>
     * @return int
     */
    public function getLifespanCount()
    {
        return $this->lifespan_count;
    }

    /**
     * Optional. The number of conversational query requests after which the
     * context expires. If set to `0` (the default) the context expires
     * immediately. Contexts expire automatically after 20 minutes if there
     * are no matching queries.
     *
     * Generated from protobuf field <code>int32 lifespan_count = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setLifespanCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->lifespan_count = $var;

        return $this;
    }

    /**
     * Optional. The collection of parameters associated with this context.
     * Refer to [this
     * doc](https://cloud.google.com/dialogflow/docs/intents-actions-parameters)
     * for syntax.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct parameters = 3;</code>
     * @return \Google\Protobuf\Struct
     */
    public function getParameters()
    {
        return $this->parameters;
    }

    /**
     * Optional. The collection of parameters associated with this context.
     * Refer to [this
     * doc](https://cloud.google.com/dialogflow/docs/intents-actions-parameters)
     * for syntax.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct parameters = 3;</code>
     * @param \Google\Protobuf\Struct $var
     * @return $this
     */
    public function setParameters($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
        $this->parameters = $var;

        return $this;
    }

}

