<?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 structured data value, consisting of fields which map to dynamically
 * typed values.
 * Values of type `Struct` are stored in `Value.array_value` where entries are
 * in the same order and number as `field_types`.
 *
 * Generated from protobuf message <code>google.bigtable.v2.Type.Struct</code>
 */
class Struct extends \Google\Protobuf\Internal\Message
{
    /**
     * The names and types of the fields in this struct.
     *
     * Generated from protobuf field <code>repeated .google.bigtable.v2.Type.Struct.Field fields = 1;</code>
     */
    private $fields;
    /**
     * The encoding to use when converting to or from lower level types.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding encoding = 2;</code>
     */
    protected $encoding = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<\Google\Cloud\Bigtable\V2\Type\Struct\Field>|\Google\Protobuf\Internal\RepeatedField $fields
     *           The names and types of the fields in this struct.
     *     @type \Google\Cloud\Bigtable\V2\Type\Struct\Encoding $encoding
     *           The encoding to use when converting to or from lower level types.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Bigtable\V2\Types::initOnce();
        parent::__construct($data);
    }

    /**
     * The names and types of the fields in this struct.
     *
     * Generated from protobuf field <code>repeated .google.bigtable.v2.Type.Struct.Field fields = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getFields()
    {
        return $this->fields;
    }

    /**
     * The names and types of the fields in this struct.
     *
     * Generated from protobuf field <code>repeated .google.bigtable.v2.Type.Struct.Field fields = 1;</code>
     * @param array<\Google\Cloud\Bigtable\V2\Type\Struct\Field>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setFields($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Type\Struct\Field::class);
        $this->fields = $arr;

        return $this;
    }

    /**
     * The encoding to use when converting to or from lower level types.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding encoding = 2;</code>
     * @return \Google\Cloud\Bigtable\V2\Type\Struct\Encoding|null
     */
    public function getEncoding()
    {
        return $this->encoding;
    }

    public function hasEncoding()
    {
        return isset($this->encoding);
    }

    public function clearEncoding()
    {
        unset($this->encoding);
    }

    /**
     * The encoding to use when converting to or from lower level types.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding encoding = 2;</code>
     * @param \Google\Cloud\Bigtable\V2\Type\Struct\Encoding $var
     * @return $this
     */
    public function setEncoding($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Struct\Encoding::class);
        $this->encoding = $var;

        return $this;
    }

}

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

