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

namespace Google\Cloud\Gaming\V1\OperationStatus;

use UnexpectedValueException;

/**
 * Protobuf type <code>google.cloud.gaming.v1.OperationStatus.ErrorCode</code>
 */
class ErrorCode
{
    /**
     * Generated from protobuf enum <code>ERROR_CODE_UNSPECIFIED = 0;</code>
     */
    const ERROR_CODE_UNSPECIFIED = 0;
    /**
     * Generated from protobuf enum <code>INTERNAL_ERROR = 1;</code>
     */
    const INTERNAL_ERROR = 1;
    /**
     * Generated from protobuf enum <code>PERMISSION_DENIED = 2;</code>
     */
    const PERMISSION_DENIED = 2;
    /**
     * Generated from protobuf enum <code>CLUSTER_CONNECTION = 3;</code>
     */
    const CLUSTER_CONNECTION = 3;

    private static $valueToName = [
        self::ERROR_CODE_UNSPECIFIED => 'ERROR_CODE_UNSPECIFIED',
        self::INTERNAL_ERROR => 'INTERNAL_ERROR',
        self::PERMISSION_DENIED => 'PERMISSION_DENIED',
        self::CLUSTER_CONNECTION => 'CLUSTER_CONNECTION',
    ];

    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(ErrorCode::class, \Google\Cloud\Gaming\V1\OperationStatus_ErrorCode::class);

