<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/api/cloudquotas/v1beta/resources.proto

namespace Google\Cloud\CloudQuotas\V1beta;

use UnexpectedValueException;

/**
 * Enumerations of quota safety checks.
 *
 * Protobuf type <code>google.api.cloudquotas.v1beta.QuotaSafetyCheck</code>
 */
class QuotaSafetyCheck
{
    /**
     * Unspecified quota safety check.
     *
     * Generated from protobuf enum <code>QUOTA_SAFETY_CHECK_UNSPECIFIED = 0;</code>
     */
    const QUOTA_SAFETY_CHECK_UNSPECIFIED = 0;
    /**
     * Validates that a quota mutation would not cause the consumer's effective
     * limit to be lower than the consumer's quota usage.
     *
     * Generated from protobuf enum <code>QUOTA_DECREASE_BELOW_USAGE = 1;</code>
     */
    const QUOTA_DECREASE_BELOW_USAGE = 1;
    /**
     * Validates that a quota mutation would not cause the consumer's effective
     * limit to decrease by more than 10 percent.
     *
     * Generated from protobuf enum <code>QUOTA_DECREASE_PERCENTAGE_TOO_HIGH = 2;</code>
     */
    const QUOTA_DECREASE_PERCENTAGE_TOO_HIGH = 2;

    private static $valueToName = [
        self::QUOTA_SAFETY_CHECK_UNSPECIFIED => 'QUOTA_SAFETY_CHECK_UNSPECIFIED',
        self::QUOTA_DECREASE_BELOW_USAGE => 'QUOTA_DECREASE_BELOW_USAGE',
        self::QUOTA_DECREASE_PERCENTAGE_TOO_HIGH => 'QUOTA_DECREASE_PERCENTAGE_TOO_HIGH',
    ];

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

