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

namespace Google\Cloud\Dataplex\V1\EncryptionConfig\FailureDetails;

use UnexpectedValueException;

/**
 * Error code for the failure if anything related to Cmek db fails.
 *
 * Protobuf type <code>google.cloud.dataplex.v1.EncryptionConfig.FailureDetails.ErrorCode</code>
 */
class ErrorCode
{
    /**
     * The error code is not specified
     *
     * Generated from protobuf enum <code>UNKNOWN = 0;</code>
     */
    const UNKNOWN = 0;
    /**
     * Error because of internal server error, will be retried automatically.
     *
     * Generated from protobuf enum <code>INTERNAL_ERROR = 1;</code>
     */
    const INTERNAL_ERROR = 1;
    /**
     * User action is required to resolve the error.
     *
     * Generated from protobuf enum <code>REQUIRE_USER_ACTION = 2;</code>
     */
    const REQUIRE_USER_ACTION = 2;

    private static $valueToName = [
        self::UNKNOWN => 'UNKNOWN',
        self::INTERNAL_ERROR => 'INTERNAL_ERROR',
        self::REQUIRE_USER_ACTION => 'REQUIRE_USER_ACTION',
    ];

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


