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

namespace Google\Cloud\DiscoveryEngine\V1;

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

/**
 * Request message for
 * [RankService.Rank][google.cloud.discoveryengine.v1.RankService.Rank] method.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1.RankRequest</code>
 */
class RankRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The resource name of the rank service config, such as
     * `projects/{project_num}/locations/{location}/rankingConfigs/default_ranking_config`.
     *
     * Generated from protobuf field <code>string ranking_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $ranking_config = '';
    /**
     * The identifier of the model to use. It is one of:
     * * `semantic-ranker-512&#64;latest`: Semantic ranking model with maxiumn input
     * token size 512.
     * It is set to `semantic-ranker-512&#64;latest` by default if unspecified.
     *
     * Generated from protobuf field <code>string model = 2;</code>
     */
    protected $model = '';
    /**
     * The number of results to return. If this is unset or no bigger than zero,
     * returns all results.
     *
     * Generated from protobuf field <code>int32 top_n = 3;</code>
     */
    protected $top_n = 0;
    /**
     * The query to use.
     *
     * Generated from protobuf field <code>string query = 4;</code>
     */
    protected $query = '';
    /**
     * Required. A list of records to rank. At most 200 records to rank.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $records;
    /**
     * If true, the response will contain only record ID and score. By default, it
     * is false, the response will contain record details.
     *
     * Generated from protobuf field <code>bool ignore_record_details_in_response = 6;</code>
     */
    protected $ignore_record_details_in_response = false;
    /**
     * The user labels applied to a resource must meet the following requirements:
     * * Each resource can have multiple labels, up to a maximum of 64.
     * * Each label must be a key-value pair.
     * * Keys have a minimum length of 1 character and a maximum length of 63
     *   characters and cannot be empty. Values can be empty and have a maximum
     *   length of 63 characters.
     * * Keys and values can contain only lowercase letters, numeric characters,
     *   underscores, and dashes. All characters must use UTF-8 encoding, and
     *   international characters are allowed.
     * * The key portion of a label must be unique. However, you can use the same
     *   key with multiple resources.
     * * Keys must start with a lowercase letter or international character.
     * See [Google Cloud
     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
     * for more details.
     *
     * Generated from protobuf field <code>map<string, string> user_labels = 7;</code>
     */
    private $user_labels;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $ranking_config
     *           Required. The resource name of the rank service config, such as
     *           `projects/{project_num}/locations/{location}/rankingConfigs/default_ranking_config`.
     *     @type string $model
     *           The identifier of the model to use. It is one of:
     *           * `semantic-ranker-512&#64;latest`: Semantic ranking model with maxiumn input
     *           token size 512.
     *           It is set to `semantic-ranker-512&#64;latest` by default if unspecified.
     *     @type int $top_n
     *           The number of results to return. If this is unset or no bigger than zero,
     *           returns all results.
     *     @type string $query
     *           The query to use.
     *     @type array<\Google\Cloud\DiscoveryEngine\V1\RankingRecord>|\Google\Protobuf\Internal\RepeatedField $records
     *           Required. A list of records to rank. At most 200 records to rank.
     *     @type bool $ignore_record_details_in_response
     *           If true, the response will contain only record ID and score. By default, it
     *           is false, the response will contain record details.
     *     @type array|\Google\Protobuf\Internal\MapField $user_labels
     *           The user labels applied to a resource must meet the following requirements:
     *           * Each resource can have multiple labels, up to a maximum of 64.
     *           * Each label must be a key-value pair.
     *           * Keys have a minimum length of 1 character and a maximum length of 63
     *             characters and cannot be empty. Values can be empty and have a maximum
     *             length of 63 characters.
     *           * Keys and values can contain only lowercase letters, numeric characters,
     *             underscores, and dashes. All characters must use UTF-8 encoding, and
     *             international characters are allowed.
     *           * The key portion of a label must be unique. However, you can use the same
     *             key with multiple resources.
     *           * Keys must start with a lowercase letter or international character.
     *           See [Google Cloud
     *           Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
     *           for more details.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1\RankService::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The resource name of the rank service config, such as
     * `projects/{project_num}/locations/{location}/rankingConfigs/default_ranking_config`.
     *
     * Generated from protobuf field <code>string ranking_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getRankingConfig()
    {
        return $this->ranking_config;
    }

    /**
     * Required. The resource name of the rank service config, such as
     * `projects/{project_num}/locations/{location}/rankingConfigs/default_ranking_config`.
     *
     * Generated from protobuf field <code>string ranking_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setRankingConfig($var)
    {
        GPBUtil::checkString($var, True);
        $this->ranking_config = $var;

        return $this;
    }

    /**
     * The identifier of the model to use. It is one of:
     * * `semantic-ranker-512&#64;latest`: Semantic ranking model with maxiumn input
     * token size 512.
     * It is set to `semantic-ranker-512&#64;latest` by default if unspecified.
     *
     * Generated from protobuf field <code>string model = 2;</code>
     * @return string
     */
    public function getModel()
    {
        return $this->model;
    }

    /**
     * The identifier of the model to use. It is one of:
     * * `semantic-ranker-512&#64;latest`: Semantic ranking model with maxiumn input
     * token size 512.
     * It is set to `semantic-ranker-512&#64;latest` by default if unspecified.
     *
     * Generated from protobuf field <code>string model = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setModel($var)
    {
        GPBUtil::checkString($var, True);
        $this->model = $var;

        return $this;
    }

    /**
     * The number of results to return. If this is unset or no bigger than zero,
     * returns all results.
     *
     * Generated from protobuf field <code>int32 top_n = 3;</code>
     * @return int
     */
    public function getTopN()
    {
        return $this->top_n;
    }

    /**
     * The number of results to return. If this is unset or no bigger than zero,
     * returns all results.
     *
     * Generated from protobuf field <code>int32 top_n = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setTopN($var)
    {
        GPBUtil::checkInt32($var);
        $this->top_n = $var;

        return $this;
    }

    /**
     * The query to use.
     *
     * Generated from protobuf field <code>string query = 4;</code>
     * @return string
     */
    public function getQuery()
    {
        return $this->query;
    }

    /**
     * The query to use.
     *
     * Generated from protobuf field <code>string query = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setQuery($var)
    {
        GPBUtil::checkString($var, True);
        $this->query = $var;

        return $this;
    }

    /**
     * Required. A list of records to rank. At most 200 records to rank.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getRecords()
    {
        return $this->records;
    }

    /**
     * Required. A list of records to rank. At most 200 records to rank.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param array<\Google\Cloud\DiscoveryEngine\V1\RankingRecord>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setRecords($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\RankingRecord::class);
        $this->records = $arr;

        return $this;
    }

    /**
     * If true, the response will contain only record ID and score. By default, it
     * is false, the response will contain record details.
     *
     * Generated from protobuf field <code>bool ignore_record_details_in_response = 6;</code>
     * @return bool
     */
    public function getIgnoreRecordDetailsInResponse()
    {
        return $this->ignore_record_details_in_response;
    }

    /**
     * If true, the response will contain only record ID and score. By default, it
     * is false, the response will contain record details.
     *
     * Generated from protobuf field <code>bool ignore_record_details_in_response = 6;</code>
     * @param bool $var
     * @return $this
     */
    public function setIgnoreRecordDetailsInResponse($var)
    {
        GPBUtil::checkBool($var);
        $this->ignore_record_details_in_response = $var;

        return $this;
    }

    /**
     * The user labels applied to a resource must meet the following requirements:
     * * Each resource can have multiple labels, up to a maximum of 64.
     * * Each label must be a key-value pair.
     * * Keys have a minimum length of 1 character and a maximum length of 63
     *   characters and cannot be empty. Values can be empty and have a maximum
     *   length of 63 characters.
     * * Keys and values can contain only lowercase letters, numeric characters,
     *   underscores, and dashes. All characters must use UTF-8 encoding, and
     *   international characters are allowed.
     * * The key portion of a label must be unique. However, you can use the same
     *   key with multiple resources.
     * * Keys must start with a lowercase letter or international character.
     * See [Google Cloud
     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
     * for more details.
     *
     * Generated from protobuf field <code>map<string, string> user_labels = 7;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getUserLabels()
    {
        return $this->user_labels;
    }

    /**
     * The user labels applied to a resource must meet the following requirements:
     * * Each resource can have multiple labels, up to a maximum of 64.
     * * Each label must be a key-value pair.
     * * Keys have a minimum length of 1 character and a maximum length of 63
     *   characters and cannot be empty. Values can be empty and have a maximum
     *   length of 63 characters.
     * * Keys and values can contain only lowercase letters, numeric characters,
     *   underscores, and dashes. All characters must use UTF-8 encoding, and
     *   international characters are allowed.
     * * The key portion of a label must be unique. However, you can use the same
     *   key with multiple resources.
     * * Keys must start with a lowercase letter or international character.
     * See [Google Cloud
     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
     * for more details.
     *
     * Generated from protobuf field <code>map<string, string> user_labels = 7;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setUserLabels($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->user_labels = $arr;

        return $this;
    }

}

