<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/discoveryengine/v1/common.proto

namespace Google\Cloud\DiscoveryEngine\V1;

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

/**
 * Information of an end user.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1.UserInfo</code>
 */
class UserInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * Highly recommended for logged-in users. Unique identifier for logged-in
     * user, such as a user name. Don't set for anonymous users.
     * Always use a hashed value for this ID.
     * Don't set the field to the same fixed ID for different users. This mixes
     * the event history of those users together, which results in degraded
     * model quality.
     * The field must be a UTF-8 encoded string with a length limit of 128
     * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     *
     * Generated from protobuf field <code>string user_id = 1;</code>
     */
    protected $user_id = '';
    /**
     * User agent as included in the HTTP header. Required for getting
     * [SearchResponse.sponsored_results][].
     * The field must be a UTF-8 encoded string with a length limit of 1,000
     * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     * This should not be set when using the client side event reporting with
     * GTM or JavaScript tag in
     * [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent]
     * or if
     * [UserEvent.direct_user_request][google.cloud.discoveryengine.v1.UserEvent.direct_user_request]
     * is set.
     *
     * Generated from protobuf field <code>string user_agent = 2;</code>
     */
    protected $user_agent = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $user_id
     *           Highly recommended for logged-in users. Unique identifier for logged-in
     *           user, such as a user name. Don't set for anonymous users.
     *           Always use a hashed value for this ID.
     *           Don't set the field to the same fixed ID for different users. This mixes
     *           the event history of those users together, which results in degraded
     *           model quality.
     *           The field must be a UTF-8 encoded string with a length limit of 128
     *           characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     *     @type string $user_agent
     *           User agent as included in the HTTP header. Required for getting
     *           [SearchResponse.sponsored_results][].
     *           The field must be a UTF-8 encoded string with a length limit of 1,000
     *           characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     *           This should not be set when using the client side event reporting with
     *           GTM or JavaScript tag in
     *           [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent]
     *           or if
     *           [UserEvent.direct_user_request][google.cloud.discoveryengine.v1.UserEvent.direct_user_request]
     *           is set.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1\Common::initOnce();
        parent::__construct($data);
    }

    /**
     * Highly recommended for logged-in users. Unique identifier for logged-in
     * user, such as a user name. Don't set for anonymous users.
     * Always use a hashed value for this ID.
     * Don't set the field to the same fixed ID for different users. This mixes
     * the event history of those users together, which results in degraded
     * model quality.
     * The field must be a UTF-8 encoded string with a length limit of 128
     * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     *
     * Generated from protobuf field <code>string user_id = 1;</code>
     * @return string
     */
    public function getUserId()
    {
        return $this->user_id;
    }

    /**
     * Highly recommended for logged-in users. Unique identifier for logged-in
     * user, such as a user name. Don't set for anonymous users.
     * Always use a hashed value for this ID.
     * Don't set the field to the same fixed ID for different users. This mixes
     * the event history of those users together, which results in degraded
     * model quality.
     * The field must be a UTF-8 encoded string with a length limit of 128
     * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     *
     * Generated from protobuf field <code>string user_id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setUserId($var)
    {
        GPBUtil::checkString($var, True);
        $this->user_id = $var;

        return $this;
    }

    /**
     * User agent as included in the HTTP header. Required for getting
     * [SearchResponse.sponsored_results][].
     * The field must be a UTF-8 encoded string with a length limit of 1,000
     * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     * This should not be set when using the client side event reporting with
     * GTM or JavaScript tag in
     * [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent]
     * or if
     * [UserEvent.direct_user_request][google.cloud.discoveryengine.v1.UserEvent.direct_user_request]
     * is set.
     *
     * Generated from protobuf field <code>string user_agent = 2;</code>
     * @return string
     */
    public function getUserAgent()
    {
        return $this->user_agent;
    }

    /**
     * User agent as included in the HTTP header. Required for getting
     * [SearchResponse.sponsored_results][].
     * The field must be a UTF-8 encoded string with a length limit of 1,000
     * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     * This should not be set when using the client side event reporting with
     * GTM or JavaScript tag in
     * [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent]
     * or if
     * [UserEvent.direct_user_request][google.cloud.discoveryengine.v1.UserEvent.direct_user_request]
     * is set.
     *
     * Generated from protobuf field <code>string user_agent = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setUserAgent($var)
    {
        GPBUtil::checkString($var, True);
        $this->user_agent = $var;

        return $this;
    }

}

