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

namespace Google\Cloud\Retail\V2;

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

/**
 * Response of the auto-complete query.
 *
 * Generated from protobuf message <code>google.cloud.retail.v2.CompleteQueryResponse</code>
 */
class CompleteQueryResponse extends \Google\Protobuf\Internal\Message
{
    /**
     * Results of the matching suggestions. The result list is ordered and the
     * first result is top suggestion.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CompleteQueryResponse.CompletionResult completion_results = 1;</code>
     */
    private $completion_results;
    /**
     * A unique complete token. This should be included in the
     * [SearchRequest][google.cloud.retail.v2.SearchRequest] resulting from this
     * completion, which enables accurate attribution of complete model
     * performance.
     *
     * Generated from protobuf field <code>string attribution_token = 2;</code>
     */
    private $attribution_token = '';
    /**
     * Matched recent searches of this user. This field is a restricted feature.
     * Contact Retail Support (retail-search-support&#64;google.com) if you are
     * interested in enabling it.
     * This feature is only available when
     * [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
     * field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
     * The recent searches satisfy the follow rules:
     *  * They are ordered from latest to oldest.
     *  * They are matched with
     *  [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
     *  case insensitively.
     *  * They are transformed to lower cases.
     *  * They are UTF-8 safe.
     * Recent searches are deduplicated. More recent searches will be reserved
     * when duplication happens.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult recent_search_results = 3;</code>
     */
    private $recent_search_results;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Retail\V2\CompleteQueryResponse\CompletionResult[]|\Google\Protobuf\Internal\RepeatedField $completion_results
     *           Results of the matching suggestions. The result list is ordered and the
     *           first result is top suggestion.
     *     @type string $attribution_token
     *           A unique complete token. This should be included in the
     *           [SearchRequest][google.cloud.retail.v2.SearchRequest] resulting from this
     *           completion, which enables accurate attribution of complete model
     *           performance.
     *     @type \Google\Cloud\Retail\V2\CompleteQueryResponse\RecentSearchResult[]|\Google\Protobuf\Internal\RepeatedField $recent_search_results
     *           Matched recent searches of this user. This field is a restricted feature.
     *           Contact Retail Support (retail-search-support&#64;google.com) if you are
     *           interested in enabling it.
     *           This feature is only available when
     *           [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
     *           field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
     *           The recent searches satisfy the follow rules:
     *            * They are ordered from latest to oldest.
     *            * They are matched with
     *            [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
     *            case insensitively.
     *            * They are transformed to lower cases.
     *            * They are UTF-8 safe.
     *           Recent searches are deduplicated. More recent searches will be reserved
     *           when duplication happens.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Retail\V2\CompletionService::initOnce();
        parent::__construct($data);
    }

    /**
     * Results of the matching suggestions. The result list is ordered and the
     * first result is top suggestion.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CompleteQueryResponse.CompletionResult completion_results = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getCompletionResults()
    {
        return $this->completion_results;
    }

    /**
     * Results of the matching suggestions. The result list is ordered and the
     * first result is top suggestion.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CompleteQueryResponse.CompletionResult completion_results = 1;</code>
     * @param \Google\Cloud\Retail\V2\CompleteQueryResponse\CompletionResult[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setCompletionResults($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Retail\V2\CompleteQueryResponse\CompletionResult::class);
        $this->completion_results = $arr;

        return $this;
    }

    /**
     * A unique complete token. This should be included in the
     * [SearchRequest][google.cloud.retail.v2.SearchRequest] resulting from this
     * completion, which enables accurate attribution of complete model
     * performance.
     *
     * Generated from protobuf field <code>string attribution_token = 2;</code>
     * @return string
     */
    public function getAttributionToken()
    {
        return $this->attribution_token;
    }

    /**
     * A unique complete token. This should be included in the
     * [SearchRequest][google.cloud.retail.v2.SearchRequest] resulting from this
     * completion, which enables accurate attribution of complete model
     * performance.
     *
     * Generated from protobuf field <code>string attribution_token = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setAttributionToken($var)
    {
        GPBUtil::checkString($var, True);
        $this->attribution_token = $var;

        return $this;
    }

    /**
     * Matched recent searches of this user. This field is a restricted feature.
     * Contact Retail Support (retail-search-support&#64;google.com) if you are
     * interested in enabling it.
     * This feature is only available when
     * [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
     * field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
     * The recent searches satisfy the follow rules:
     *  * They are ordered from latest to oldest.
     *  * They are matched with
     *  [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
     *  case insensitively.
     *  * They are transformed to lower cases.
     *  * They are UTF-8 safe.
     * Recent searches are deduplicated. More recent searches will be reserved
     * when duplication happens.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult recent_search_results = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getRecentSearchResults()
    {
        return $this->recent_search_results;
    }

    /**
     * Matched recent searches of this user. This field is a restricted feature.
     * Contact Retail Support (retail-search-support&#64;google.com) if you are
     * interested in enabling it.
     * This feature is only available when
     * [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
     * field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
     * The recent searches satisfy the follow rules:
     *  * They are ordered from latest to oldest.
     *  * They are matched with
     *  [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
     *  case insensitively.
     *  * They are transformed to lower cases.
     *  * They are UTF-8 safe.
     * Recent searches are deduplicated. More recent searches will be reserved
     * when duplication happens.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult recent_search_results = 3;</code>
     * @param \Google\Cloud\Retail\V2\CompleteQueryResponse\RecentSearchResult[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setRecentSearchResults($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Retail\V2\CompleteQueryResponse\RecentSearchResult::class);
        $this->recent_search_results = $arr;

        return $this;
    }

}

