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

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

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

/**
 * Rules used to convert to or from lower level types.
 *
 * Generated from protobuf message <code>google.bigtable.admin.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\Admin\V2\Type\Struct\Encoding\Singleton $singleton
     *           Use `Singleton` encoding.
     *     @type \Google\Cloud\Bigtable\Admin\V2\Type\Struct\Encoding\DelimitedBytes $delimited_bytes
     *           Use `DelimitedBytes` encoding.
     *     @type \Google\Cloud\Bigtable\Admin\V2\Type\Struct\Encoding\OrderedCodeBytes $ordered_code_bytes
     *           User `OrderedCodeBytes` encoding.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce();
        parent::__construct($data);
    }

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

        return $this;
    }

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

        return $this;
    }

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

        return $this;
    }

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

}

