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

namespace Google\Cloud\Bigtable\V2\Type;

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

/**
 * A mapping of keys to values of a given type.
 * Values of type `Map` are stored in a `Value.array_value` where each entry
 * is another `Value.array_value` with two elements (the key and the value,
 * in that order).
 * Normally encoded Map values won't have repeated keys, however, clients are
 * expected to handle the case in which they do. If the same key appears
 * multiple times, the _last_ value takes precedence.
 *
 * Generated from protobuf message <code>google.bigtable.v2.Type.Map</code>
 */
class Map extends \Google\Protobuf\Internal\Message
{
    /**
     * The type of a map key.
     * Only `Bytes`, `String`, and `Int64` are allowed as key types.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type key_type = 1;</code>
     */
    protected $key_type = null;
    /**
     * The type of the values in a map.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type value_type = 2;</code>
     */
    protected $value_type = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Bigtable\V2\Type $key_type
     *           The type of a map key.
     *           Only `Bytes`, `String`, and `Int64` are allowed as key types.
     *     @type \Google\Cloud\Bigtable\V2\Type $value_type
     *           The type of the values in a map.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Bigtable\V2\Types::initOnce();
        parent::__construct($data);
    }

    /**
     * The type of a map key.
     * Only `Bytes`, `String`, and `Int64` are allowed as key types.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type key_type = 1;</code>
     * @return \Google\Cloud\Bigtable\V2\Type|null
     */
    public function getKeyType()
    {
        return $this->key_type;
    }

    public function hasKeyType()
    {
        return isset($this->key_type);
    }

    public function clearKeyType()
    {
        unset($this->key_type);
    }

    /**
     * The type of a map key.
     * Only `Bytes`, `String`, and `Int64` are allowed as key types.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type key_type = 1;</code>
     * @param \Google\Cloud\Bigtable\V2\Type $var
     * @return $this
     */
    public function setKeyType($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class);
        $this->key_type = $var;

        return $this;
    }

    /**
     * The type of the values in a map.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type value_type = 2;</code>
     * @return \Google\Cloud\Bigtable\V2\Type|null
     */
    public function getValueType()
    {
        return $this->value_type;
    }

    public function hasValueType()
    {
        return isset($this->value_type);
    }

    public function clearValueType()
    {
        unset($this->value_type);
    }

    /**
     * The type of the values in a map.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type value_type = 2;</code>
     * @param \Google\Cloud\Bigtable\V2\Type $var
     * @return $this
     */
    public function setValueType($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class);
        $this->value_type = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Map::class, \Google\Cloud\Bigtable\V2\Type_Map::class);

