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

namespace Google\Cloud\CertificateManager\V1\CertificateIssuanceConfig;

use UnexpectedValueException;

/**
 * The type of keypair to generate.
 *
 * Protobuf type <code>google.cloud.certificatemanager.v1.CertificateIssuanceConfig.KeyAlgorithm</code>
 */
class KeyAlgorithm
{
    /**
     * Unspecified key algorithm.
     *
     * Generated from protobuf enum <code>KEY_ALGORITHM_UNSPECIFIED = 0;</code>
     */
    const KEY_ALGORITHM_UNSPECIFIED = 0;
    /**
     * Specifies RSA with a 2048-bit modulus.
     *
     * Generated from protobuf enum <code>RSA_2048 = 1;</code>
     */
    const RSA_2048 = 1;
    /**
     * Specifies ECDSA with curve P256.
     *
     * Generated from protobuf enum <code>ECDSA_P256 = 4;</code>
     */
    const ECDSA_P256 = 4;

    private static $valueToName = [
        self::KEY_ALGORITHM_UNSPECIFIED => 'KEY_ALGORITHM_UNSPECIFIED',
        self::RSA_2048 => 'RSA_2048',
        self::ECDSA_P256 => 'ECDSA_P256',
    ];

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

