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

namespace Google\Cloud\Logging\V2\TailLogEntriesResponse\SuppressionInfo;

use UnexpectedValueException;

/**
 * An indicator of why entries were omitted.
 *
 * Protobuf type <code>google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason</code>
 */
class Reason
{
    /**
     * Unexpected default.
     *
     * Generated from protobuf enum <code>REASON_UNSPECIFIED = 0;</code>
     */
    const REASON_UNSPECIFIED = 0;
    /**
     * Indicates suppression occurred due to relevant entries being
     * received in excess of rate limits. For quotas and limits, see
     * [Logging API quotas and
     * limits](https://cloud.google.com/logging/quotas#api-limits).
     *
     * Generated from protobuf enum <code>RATE_LIMIT = 1;</code>
     */
    const RATE_LIMIT = 1;
    /**
     * Indicates suppression occurred due to the client not consuming
     * responses quickly enough.
     *
     * Generated from protobuf enum <code>NOT_CONSUMED = 2;</code>
     */
    const NOT_CONSUMED = 2;

    private static $valueToName = [
        self::REASON_UNSPECIFIED => 'REASON_UNSPECIFIED',
        self::RATE_LIMIT => 'RATE_LIMIT',
        self::NOT_CONSUMED => 'NOT_CONSUMED',
    ];

    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);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Reason::class, \Google\Cloud\Logging\V2\TailLogEntriesResponse_SuppressionInfo_Reason::class);

