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

namespace Google\Cloud\Kms\V1\ImportJob;

use UnexpectedValueException;

/**
 * The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
 * it can be used.
 *
 * Protobuf type <code>google.cloud.kms.v1.ImportJob.ImportJobState</code>
 */
class ImportJobState
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>IMPORT_JOB_STATE_UNSPECIFIED = 0;</code>
     */
    const IMPORT_JOB_STATE_UNSPECIFIED = 0;
    /**
     * The wrapping key for this job is still being generated. It may not be
     * used. Cloud KMS will automatically mark this job as
     * [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
     * the wrapping key is generated.
     *
     * Generated from protobuf enum <code>PENDING_GENERATION = 1;</code>
     */
    const PENDING_GENERATION = 1;
    /**
     * This job may be used in
     * [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
     * and
     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
     * requests.
     *
     * Generated from protobuf enum <code>ACTIVE = 2;</code>
     */
    const ACTIVE = 2;
    /**
     * This job can no longer be used and may not leave this state once entered.
     *
     * Generated from protobuf enum <code>EXPIRED = 3;</code>
     */
    const EXPIRED = 3;

    private static $valueToName = [
        self::IMPORT_JOB_STATE_UNSPECIFIED => 'IMPORT_JOB_STATE_UNSPECIFIED',
        self::PENDING_GENERATION => 'PENDING_GENERATION',
        self::ACTIVE => 'ACTIVE',
        self::EXPIRED => 'EXPIRED',
    ];

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

