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

namespace Google\Cloud\AppEngine\V1\UrlMap;

use UnexpectedValueException;

/**
 * Redirect codes.
 *
 * Protobuf type <code>google.appengine.v1.UrlMap.RedirectHttpResponseCode</code>
 */
class RedirectHttpResponseCode
{
    /**
     * Not specified. `302` is assumed.
     *
     * Generated from protobuf enum <code>REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED = 0;</code>
     */
    const REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED = 0;
    /**
     * `301 Moved Permanently` code.
     *
     * Generated from protobuf enum <code>REDIRECT_HTTP_RESPONSE_CODE_301 = 1;</code>
     */
    const REDIRECT_HTTP_RESPONSE_CODE_301 = 1;
    /**
     * `302 Moved Temporarily` code.
     *
     * Generated from protobuf enum <code>REDIRECT_HTTP_RESPONSE_CODE_302 = 2;</code>
     */
    const REDIRECT_HTTP_RESPONSE_CODE_302 = 2;
    /**
     * `303 See Other` code.
     *
     * Generated from protobuf enum <code>REDIRECT_HTTP_RESPONSE_CODE_303 = 3;</code>
     */
    const REDIRECT_HTTP_RESPONSE_CODE_303 = 3;
    /**
     * `307 Temporary Redirect` code.
     *
     * Generated from protobuf enum <code>REDIRECT_HTTP_RESPONSE_CODE_307 = 4;</code>
     */
    const REDIRECT_HTTP_RESPONSE_CODE_307 = 4;

    private static $valueToName = [
        self::REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED => 'REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED',
        self::REDIRECT_HTTP_RESPONSE_CODE_301 => 'REDIRECT_HTTP_RESPONSE_CODE_301',
        self::REDIRECT_HTTP_RESPONSE_CODE_302 => 'REDIRECT_HTTP_RESPONSE_CODE_302',
        self::REDIRECT_HTTP_RESPONSE_CODE_303 => 'REDIRECT_HTTP_RESPONSE_CODE_303',
        self::REDIRECT_HTTP_RESPONSE_CODE_307 => 'REDIRECT_HTTP_RESPONSE_CODE_307',
    ];

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

