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

namespace Google\Cloud\Kms\V1\CryptoKey;

use UnexpectedValueException;

/**
 * [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
 * describes the cryptographic capabilities of a
 * [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
 * for the operations allowed by its purpose. For more information, see [Key
 * purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
 *
 * Protobuf type <code>google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose</code>
 */
class CryptoKeyPurpose
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0;</code>
     */
    const CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0;
    /**
     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
     * with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
     * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
     *
     * Generated from protobuf enum <code>ENCRYPT_DECRYPT = 1;</code>
     */
    const ENCRYPT_DECRYPT = 1;
    /**
     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
     * with
     * [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
     * and
     * [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
     *
     * Generated from protobuf enum <code>ASYMMETRIC_SIGN = 5;</code>
     */
    const ASYMMETRIC_SIGN = 5;
    /**
     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
     * with
     * [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
     * and
     * [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
     *
     * Generated from protobuf enum <code>ASYMMETRIC_DECRYPT = 6;</code>
     */
    const ASYMMETRIC_DECRYPT = 6;
    /**
     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
     * with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
     *
     * Generated from protobuf enum <code>MAC = 9;</code>
     */
    const MAC = 9;

    private static $valueToName = [
        self::CRYPTO_KEY_PURPOSE_UNSPECIFIED => 'CRYPTO_KEY_PURPOSE_UNSPECIFIED',
        self::ENCRYPT_DECRYPT => 'ENCRYPT_DECRYPT',
        self::ASYMMETRIC_SIGN => 'ASYMMETRIC_SIGN',
        self::ASYMMETRIC_DECRYPT => 'ASYMMETRIC_DECRYPT',
        self::MAC => 'MAC',
    ];

    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(CryptoKeyPurpose::class, \Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose::class);

