<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/bigquery/storage/v1/stream.proto

namespace Google\Cloud\BigQuery\Storage\V1\WriteStream;

use UnexpectedValueException;

/**
 * Type enum of the stream.
 *
 * Protobuf type <code>google.cloud.bigquery.storage.v1.WriteStream.Type</code>
 */
class Type
{
    /**
     * Unknown type.
     *
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * Data will commit automatically and appear as soon as the write is
     * acknowledged.
     *
     * Generated from protobuf enum <code>COMMITTED = 1;</code>
     */
    const COMMITTED = 1;
    /**
     * Data is invisible until the stream is committed.
     *
     * Generated from protobuf enum <code>PENDING = 2;</code>
     */
    const PENDING = 2;
    /**
     * Data is only visible up to the offset to which it was flushed.
     *
     * Generated from protobuf enum <code>BUFFERED = 3;</code>
     */
    const BUFFERED = 3;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::COMMITTED => 'COMMITTED',
        self::PENDING => 'PENDING',
        self::BUFFERED => 'BUFFERED',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

