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

namespace Google\Cloud\Firestore\Admin\V1\Index\IndexField;

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

/**
 * The index configuration to support vector search operations
 *
 * Generated from protobuf message <code>google.firestore.admin.v1.Index.IndexField.VectorConfig</code>
 */
class VectorConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The vector dimension this configuration applies to.
     * The resulting index will only include vectors of this dimension, and
     * can be used for vector search with the same dimension.
     *
     * Generated from protobuf field <code>int32 dimension = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $dimension = 0;
    protected $type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $dimension
     *           Required. The vector dimension this configuration applies to.
     *           The resulting index will only include vectors of this dimension, and
     *           can be used for vector search with the same dimension.
     *     @type \Google\Cloud\Firestore\Admin\V1\Index\IndexField\VectorConfig\FlatIndex $flat
     *           Indicates the vector index is a flat index.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\Admin\V1\Index::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The vector dimension this configuration applies to.
     * The resulting index will only include vectors of this dimension, and
     * can be used for vector search with the same dimension.
     *
     * Generated from protobuf field <code>int32 dimension = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getDimension()
    {
        return $this->dimension;
    }

    /**
     * Required. The vector dimension this configuration applies to.
     * The resulting index will only include vectors of this dimension, and
     * can be used for vector search with the same dimension.
     *
     * Generated from protobuf field <code>int32 dimension = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setDimension($var)
    {
        GPBUtil::checkInt32($var);
        $this->dimension = $var;

        return $this;
    }

    /**
     * Indicates the vector index is a flat index.
     *
     * Generated from protobuf field <code>.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex flat = 2;</code>
     * @return \Google\Cloud\Firestore\Admin\V1\Index\IndexField\VectorConfig\FlatIndex|null
     */
    public function getFlat()
    {
        return $this->readOneof(2);
    }

    public function hasFlat()
    {
        return $this->hasOneof(2);
    }

    /**
     * Indicates the vector index is a flat index.
     *
     * Generated from protobuf field <code>.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex flat = 2;</code>
     * @param \Google\Cloud\Firestore\Admin\V1\Index\IndexField\VectorConfig\FlatIndex $var
     * @return $this
     */
    public function setFlat($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Index\IndexField\VectorConfig\FlatIndex::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getType()
    {
        return $this->whichOneof("type");
    }

}

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

