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

namespace Google\Cloud\Firestore\V1\StructuredQuery;

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

/**
 * Nearest Neighbors search config.
 *
 * Generated from protobuf message <code>google.firestore.v1.StructuredQuery.FindNearest</code>
 */
class FindNearest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $vector_field = null;
    /**
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     *
     * Generated from protobuf field <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $query_vector = null;
    /**
     * Required. The Distance Measure to use, required.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $distance_measure = 0;
    /**
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $limit = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $vector_field
     *           Required. An indexed vector field to search upon. Only documents which
     *           contain vectors whose dimensionality match the query_vector can be
     *           returned.
     *     @type \Google\Cloud\Firestore\V1\Value $query_vector
     *           Required. The query vector that we are searching on. Must be a vector of
     *           no more than 2048 dimensions.
     *     @type int $distance_measure
     *           Required. The Distance Measure to use, required.
     *     @type \Google\Protobuf\Int32Value $limit
     *           Required. The number of nearest neighbors to return. Must be a positive
     *           integer of no more than 1000.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\Query::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference|null
     */
    public function getVectorField()
    {
        return $this->vector_field;
    }

    public function hasVectorField()
    {
        return isset($this->vector_field);
    }

    public function clearVectorField()
    {
        unset($this->vector_field);
    }

    /**
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $var
     * @return $this
     */
    public function setVectorField($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference::class);
        $this->vector_field = $var;

        return $this;
    }

    /**
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     *
     * Generated from protobuf field <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Firestore\V1\Value|null
     */
    public function getQueryVector()
    {
        return $this->query_vector;
    }

    public function hasQueryVector()
    {
        return isset($this->query_vector);
    }

    public function clearQueryVector()
    {
        unset($this->query_vector);
    }

    /**
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     *
     * Generated from protobuf field <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Firestore\V1\Value $var
     * @return $this
     */
    public function setQueryVector($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Value::class);
        $this->query_vector = $var;

        return $this;
    }

    /**
     * Required. The Distance Measure to use, required.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getDistanceMeasure()
    {
        return $this->distance_measure;
    }

    /**
     * Required. The Distance Measure to use, required.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setDistanceMeasure($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1\StructuredQuery\FindNearest\DistanceMeasure::class);
        $this->distance_measure = $var;

        return $this;
    }

    /**
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Int32Value|null
     */
    public function getLimit()
    {
        return $this->limit;
    }

    public function hasLimit()
    {
        return isset($this->limit);
    }

    public function clearLimit()
    {
        unset($this->limit);
    }

    /**
     * Returns the unboxed value from <code>getLimit()</code>

     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int|null
     */
    public function getLimitValue()
    {
        return $this->readWrapperValue("limit");
    }

    /**
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Protobuf\Int32Value $var
     * @return $this
     */
    public function setLimit($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Int32Value::class);
        $this->limit = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.

     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int|null $var
     * @return $this
     */
    public function setLimitValue($var)
    {
        $this->writeWrapperValue("limit", $var);
        return $this;}

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(FindNearest::class, \Google\Cloud\Firestore\V1\StructuredQuery_FindNearest::class);

