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

namespace Google\Cloud\Compute\V1\BackendService;

use UnexpectedValueException;

/**
 * Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header.
 *
 * Protobuf type <code>google.cloud.compute.v1.BackendService.CompressionMode</code>
 */
class CompressionMode
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_COMPRESSION_MODE = 0;</code>
     */
    const UNDEFINED_COMPRESSION_MODE = 0;
    /**
     * Automatically uses the best compression based on the Accept-Encoding header sent by the client.
     *
     * Generated from protobuf enum <code>AUTOMATIC = 165298699;</code>
     */
    const AUTOMATIC = 165298699;
    /**
     * Disables compression. Existing compressed responses cached by Cloud CDN will not be served to clients.
     *
     * Generated from protobuf enum <code>DISABLED = 516696700;</code>
     */
    const DISABLED = 516696700;

    private static $valueToName = [
        self::UNDEFINED_COMPRESSION_MODE => 'UNDEFINED_COMPRESSION_MODE',
        self::AUTOMATIC => 'AUTOMATIC',
        self::DISABLED => 'DISABLED',
    ];

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


