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

namespace Google\Cloud\Datastore\Admin\V1\Index;

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

/**
 * A property of an index.
 *
 * Generated from protobuf message <code>google.datastore.admin.v1.Index.IndexedProperty</code>
 */
class IndexedProperty extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The property name to index.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $name = '';
    /**
     * Required. The indexed property's direction.  Must not be
     * DIRECTION_UNSPECIFIED.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.Index.Direction direction = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $direction = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. The property name to index.
     *     @type int $direction
     *           Required. The indexed property's direction.  Must not be
     *           DIRECTION_UNSPECIFIED.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Datastore\Admin\V1\Index::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The property name to index.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. The property name to index.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Required. The indexed property's direction.  Must not be
     * DIRECTION_UNSPECIFIED.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.Index.Direction direction = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getDirection()
    {
        return $this->direction;
    }

    /**
     * Required. The indexed property's direction.  Must not be
     * DIRECTION_UNSPECIFIED.
     *
     * Generated from protobuf field <code>.google.datastore.admin.v1.Index.Direction direction = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setDirection($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Datastore\Admin\V1\Index\Direction::class);
        $this->direction = $var;

        return $this;
    }

}

