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

namespace Google\Cloud\Bigtable\V2\Type\Struct;

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

/**
 * Rules used to convert to or from lower level types.
 *
 * Generated from protobuf message <code>google.bigtable.v2.Type.Struct.Encoding</code>
 */
class Encoding extends \Google\Protobuf\Internal\Message
{
    protected $encoding;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\Singleton $singleton
     *           Use `Singleton` encoding.
     *     @type \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\DelimitedBytes $delimited_bytes
     *           Use `DelimitedBytes` encoding.
     *     @type \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\OrderedCodeBytes $ordered_code_bytes
     *           User `OrderedCodeBytes` encoding.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Bigtable\V2\Types::initOnce();
        parent::__construct($data);
    }

    /**
     * Use `Singleton` encoding.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding.Singleton singleton = 1;</code>
     * @return \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\Singleton|null
     */
    public function getSingleton()
    {
        return $this->readOneof(1);
    }

    public function hasSingleton()
    {
        return $this->hasOneof(1);
    }

    /**
     * Use `Singleton` encoding.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding.Singleton singleton = 1;</code>
     * @param \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\Singleton $var
     * @return $this
     */
    public function setSingleton($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\Singleton::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Use `DelimitedBytes` encoding.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding.DelimitedBytes delimited_bytes = 2;</code>
     * @return \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\DelimitedBytes|null
     */
    public function getDelimitedBytes()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Use `DelimitedBytes` encoding.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding.DelimitedBytes delimited_bytes = 2;</code>
     * @param \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\DelimitedBytes $var
     * @return $this
     */
    public function setDelimitedBytes($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\DelimitedBytes::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * User `OrderedCodeBytes` encoding.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding.OrderedCodeBytes ordered_code_bytes = 3;</code>
     * @return \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\OrderedCodeBytes|null
     */
    public function getOrderedCodeBytes()
    {
        return $this->readOneof(3);
    }

    public function hasOrderedCodeBytes()
    {
        return $this->hasOneof(3);
    }

    /**
     * User `OrderedCodeBytes` encoding.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.Type.Struct.Encoding.OrderedCodeBytes ordered_code_bytes = 3;</code>
     * @param \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\OrderedCodeBytes $var
     * @return $this
     */
    public function setOrderedCodeBytes($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Struct\Encoding\OrderedCodeBytes::class);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

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

