// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import GoogleCloudWkt

/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
/// individual cryptographic key, and the associated key material.
///
/// An
/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
/// version can be used for cryptographic operations.
///
/// For security reasons, the raw cryptographic key material represented by a
/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
/// or exported. It can only be used to encrypt, decrypt, or sign data when an
/// authorized user or application invokes Cloud KMS.
///
/// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/enabled>
public struct CryptoKeyVersion: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. The resource name for this
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
  /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  public var name: Swift.String = Swift.String()

  /// The current state of the
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  public var state: CryptoKeyVersion.CryptoKeyVersionState =
    CryptoKeyVersion.CryptoKeyVersionState()

  /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
  /// describing how crypto operations are performed with this
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  /// [google.cloud.kms.v1.ProtectionLevel]: <doc:ProtectionLevel>
  public var protectionLevel: ProtectionLevel = ProtectionLevel()

  /// Output only. The
  /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
  /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
  /// supports.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: <doc:CryptoKeyVersion/CryptoKeyVersionAlgorithm>
  public var algorithm: CryptoKeyVersion.CryptoKeyVersionAlgorithm =
    CryptoKeyVersion.CryptoKeyVersionAlgorithm()

  /// Output only. Statement that was generated and signed by the HSM at key
  /// creation time. Use this statement to verify attributes of the key as stored
  /// on the HSM, independently of Google. Only provided for key versions with
  /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
  /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: <doc:CryptoKeyVersion/protectionLevel>
  /// [google.cloud.kms.v1.ProtectionLevel.HSM]: <doc:ProtectionLevel/hsm>
  public var attestation: KeyOperationAttestation? = nil

  /// Output only. The time at which this
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. The time this
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
  /// generated.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  public var generateTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. The time this
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
  /// scheduled for destruction. Only present if
  /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
  /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/destroyScheduled>
  /// [google.cloud.kms.v1.CryptoKeyVersion.state]: <doc:CryptoKeyVersion/state>
  public var destroyTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. The time this CryptoKeyVersion's key material was
  /// destroyed. Only present if
  /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
  /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/destroyed>
  /// [google.cloud.kms.v1.CryptoKeyVersion.state]: <doc:CryptoKeyVersion/state>
  public var destroyEventTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
  /// used in the most recent import of this
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
  /// the underlying key material was imported.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  /// [google.cloud.kms.v1.ImportJob]: <doc:ImportJob>
  public var importJob: Swift.String = Swift.String()

  /// Output only. The time at which this
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
  /// most recently imported.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  public var importTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. The root cause of the most recent import failure. Only present
  /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
  /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/importFailed>
  /// [google.cloud.kms.v1.CryptoKeyVersion.state]: <doc:CryptoKeyVersion/state>
  public var importFailureReason: Swift.String = Swift.String()

  /// Output only. The root cause of the most recent generation failure. Only
  /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
  /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/generationFailed>
  /// [google.cloud.kms.v1.CryptoKeyVersion.state]: <doc:CryptoKeyVersion/state>
  public var generationFailureReason: Swift.String = Swift.String()

  /// Output only. The root cause of the most recent external destruction
  /// failure. Only present if
  /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
  /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/externalDestructionFailed>
  /// [google.cloud.kms.v1.CryptoKeyVersion.state]: <doc:CryptoKeyVersion/state>
  public var externalDestructionFailureReason: Swift.String = Swift.String()

  /// ExternalProtectionLevelOptions stores a group of additional fields for
  /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
  /// are specific to the
  /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
  /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
  /// protection levels.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: <doc:ProtectionLevel/external>
  /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: <doc:ProtectionLevel/externalVpc>
  public var externalProtectionLevelOptions: ExternalProtectionLevelOptions? = nil

  /// Output only. Whether or not this key version is eligible for reimport, by
  /// being specified as a target in
  /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
  ///
  /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: <doc:ImportCryptoKeyVersionRequest/cryptoKeyVersion>
  public var reimportEligible: Swift.Bool = Swift.Bool()

  /// Immutable. Field indicating that the key may be wrapped by a trusted key.
  /// This field can be set for all key purposes except
  /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT],
  /// and is only valid for keys with protection level
  /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT].
  /// This field can only be set at creation or import time via
  /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion],
  /// or
  /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
  ///
  /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: <doc:CryptoKey/CryptoKeyPurpose/encryptDecrypt>
  /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: <doc:KeyManagementService/createCryptoKeyVersion(request:)>
  /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: <doc:KeyManagementService/importCryptoKeyVersion(request:)>
  /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: <doc:ProtectionLevel/hsmSingleTenant>
  public var trustedWrappingEnabled: Swift.Bool = Swift.Bool()

  /// Output only. Field indicating that the key wrapping key is trusted.
  /// This field is only valid for key purpose
  /// [AES_256_WRAPPING][CryptoKey.CryptoKeyPurpose.AES_256_WRAPPING], and
  /// protection level
  /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT].
  ///
  /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: <doc:ProtectionLevel/hsmSingleTenant>
  public var hsmTrusted: Swift.Bool = Swift.Bool()

  /// Initialize a new instance of `CryptoKeyVersion`.
  public init() {}

  /// Use `config` to return a new instance of this object, with some fields updated.
  ///
  /// Commonly used to initialize the value, for example:
  ///
  /// ```
  /// let value = CryptoKeyVersion().with { $0.name = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  /// The algorithm of the
  /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
  /// parameters must be used for each cryptographic operation.
  ///
  /// The
  /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
  /// algorithm is usable with
  /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
  /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
  ///
  /// Algorithms beginning with `RSA_SIGN_` are usable with
  /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
  /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
  ///
  /// The fields in the name after `RSA_SIGN_` correspond to the following
  /// parameters: padding algorithm, modulus bit length, and digest algorithm.
  ///
  /// For PSS, the salt length used is equal to the length of digest
  /// algorithm. For example,
  /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
  /// will use PSS with a salt length of 256 bits or 32 bytes.
  ///
  /// Algorithms beginning with `RSA_DECRYPT_` are usable with
  /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
  /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
  ///
  /// The fields in the name after `RSA_DECRYPT_` correspond to the following
  /// parameters: padding algorithm, modulus bit length, and digest algorithm.
  ///
  /// Algorithms beginning with `EC_SIGN_` are usable with
  /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
  /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
  ///
  /// The fields in the name after `EC_SIGN_` correspond to the following
  /// parameters: elliptic curve, digest algorithm.
  ///
  /// Algorithms beginning with `HMAC_` are usable with
  /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
  /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
  ///
  /// The suffix following `HMAC_` corresponds to the hash algorithm being used
  /// (eg. SHA256).
  ///
  /// Algorithms beginning with `PQ_` are post-quantum.
  ///
  /// For more information, see [Key purposes and algorithms]
  /// (https://cloud.google.com/kms/docs/algorithms).
  ///
  /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: <doc:CryptoKey/CryptoKeyPurpose/asymmetricDecrypt>
  /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: <doc:CryptoKey/CryptoKeyPurpose/asymmetricSign>
  /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: <doc:CryptoKey/CryptoKeyPurpose/encryptDecrypt>
  /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: <doc:CryptoKey/CryptoKeyPurpose/mac>
  /// [google.cloud.kms.v1.CryptoKey.purpose]: <doc:CryptoKey/purpose>
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: <doc:CryptoKeyVersion/CryptoKeyVersionAlgorithm/googleSymmetricEncryption>
  /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: <doc:CryptoKeyVersion/CryptoKeyVersionAlgorithm/rsaSignPss2048Sha256>
  public enum CryptoKeyVersionAlgorithm: Codable, Equatable, Sendable {
    /// Not specified.
    case unspecified
    /// Creates symmetric encryption keys.
    case googleSymmetricEncryption
    /// RSASSA-PSS 2048 bit key with a SHA256 digest.
    case rsaSignPss2048Sha256
    /// RSASSA-PSS 3072 bit key with a SHA256 digest.
    case rsaSignPss3072Sha256
    /// RSASSA-PSS 4096 bit key with a SHA256 digest.
    case rsaSignPss4096Sha256
    /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
    case rsaSignPkcs12048Sha256
    /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
    case rsaSignPkcs13072Sha256
    /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
    case rsaSignPkcs14096Sha256
    /// RSAES-OAEP 2048 bit key with a SHA256 digest.
    case rsaDecryptOaep2048Sha256
    /// RSAES-OAEP 3072 bit key with a SHA256 digest.
    case rsaDecryptOaep3072Sha256
    /// RSAES-OAEP 4096 bit key with a SHA256 digest.
    case rsaDecryptOaep4096Sha256
    /// ECDSA on the NIST P-256 curve with a SHA256 digest.
    /// Other hash functions can also be used:
    /// https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms
    case ecSignP256Sha256
    /// ECDSA on the NIST P-384 curve with a SHA384 digest.
    /// Other hash functions can also be used:
    /// https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms
    case ecSignP384Sha384
    /// RSASSA-PSS 4096 bit key with a SHA512 digest.
    case rsaSignPss4096Sha512
    /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
    case rsaSignPkcs14096Sha512
    /// RSAES-OAEP 4096 bit key with a SHA512 digest.
    case rsaDecryptOaep4096Sha512
    /// Algorithm representing symmetric encryption by an external key manager.
    case externalSymmetricEncryption
    /// AES-GCM (Galois Counter Mode) using 256-bit keys.
    case aes256Gcm
    /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
    case rsaSignRawPkcs12048
    /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
    case rsaSignRawPkcs13072
    /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
    case rsaSignRawPkcs14096
    /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
    /// HSM protection level.
    /// Other hash functions can also be used:
    /// https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms
    case ecSignSecp256K1Sha256
    /// HMAC-SHA256 signing with a 256 bit key.
    case hmacSha256
    /// HMAC-SHA1 signing with a 160 bit key.
    case hmacSha1
    /// HMAC-SHA384 signing with a 384 bit key.
    case hmacSha384
    /// HMAC-SHA512 signing with a 512 bit key.
    case hmacSha512
    /// HMAC-SHA224 signing with a 224 bit key.
    case hmacSha224
    /// RSAES-OAEP 2048 bit key with a SHA1 digest.
    case rsaDecryptOaep2048Sha1
    /// RSAES-OAEP 3072 bit key with a SHA1 digest.
    case rsaDecryptOaep3072Sha1
    /// RSAES-OAEP 4096 bit key with a SHA1 digest.
    case rsaDecryptOaep4096Sha1
    /// EdDSA on the Curve25519 in pure mode (taking data as input).
    case ecSignEd25519
    /// AES-GCM (Galois Counter Mode) using 128-bit keys.
    case aes128Gcm
    /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
    case aes128Cbc
    /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
    case aes256Cbc
    /// AES-CTR (Counter Mode) using 128-bit keys.
    case aes128Ctr
    /// AES-CTR (Counter Mode) using 256-bit keys.
    case aes256Ctr
    /// ML-KEM-768 (FIPS 203)
    case mlKem768
    /// ML-KEM-1024 (FIPS 203)
    case mlKem1024
    /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
    /// security level 3. Randomized version.
    case pqSignMlDsa65
    /// The post-quantum stateless hash-based digital signature algorithm, at
    /// security level 1. Randomized version.
    case pqSignSlhDsaSha2128S
    /// The post-quantum stateless hash-based digital signature algorithm, at
    /// security level 1. Randomized pre-hash version supporting SHA256 digests.
    case pqSignHashSlhDsaSha2128SSha256
    /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
    /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
    case kemXwing
    /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
    /// security level 3. Randomized version supporting externally-computed
    /// message representatives.
    case pqSignMlDsa65ExternalMu
    /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
    /// security level 1. Randomized version.
    case pqSignMlDsa44
    /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
    /// security level 5. Randomized version.
    case pqSignMlDsa87
    /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
    /// security level 1. Randomized version supporting externally-computed
    /// message representatives.
    case pqSignMlDsa44ExternalMu
    /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
    /// security level 5. Randomized version supporting externally-computed
    /// message representatives.
    case pqSignMlDsa87ExternalMu
    /// AES key wrap with zero padding algorithm (RFC 5649). Can only be used
    /// by keys with purpose AES_WRAPPING.
    case aes256Kwp
    /// Encodes an unknown integer value.
    ///
    /// The most common cause for an unknown values is for the service to send
    /// a value unknown to the library. We recommend you update your library to
    /// the latest version.
    case unknownIntValue(Int)
    /// Encodes an unknown string value.
    ///
    /// The most common cause for an unknown values is for the service to send
    /// a value unknown to the library. We recommend you update your library to
    /// the latest version.
    case unknownStringValue(String)

    public init() {
      self = .unspecified
    }

    /// Returns the integer value associated with the enumeration.
    ///
    /// If the enumeration was initialized with an unknown string value, this returns `nil`.
    public var intValue: Int? {
      switch self {
      case .unspecified: return 0
      case .googleSymmetricEncryption: return 1
      case .rsaSignPss2048Sha256: return 2
      case .rsaSignPss3072Sha256: return 3
      case .rsaSignPss4096Sha256: return 4
      case .rsaSignPkcs12048Sha256: return 5
      case .rsaSignPkcs13072Sha256: return 6
      case .rsaSignPkcs14096Sha256: return 7
      case .rsaDecryptOaep2048Sha256: return 8
      case .rsaDecryptOaep3072Sha256: return 9
      case .rsaDecryptOaep4096Sha256: return 10
      case .ecSignP256Sha256: return 12
      case .ecSignP384Sha384: return 13
      case .rsaSignPss4096Sha512: return 15
      case .rsaSignPkcs14096Sha512: return 16
      case .rsaDecryptOaep4096Sha512: return 17
      case .externalSymmetricEncryption: return 18
      case .aes256Gcm: return 19
      case .rsaSignRawPkcs12048: return 28
      case .rsaSignRawPkcs13072: return 29
      case .rsaSignRawPkcs14096: return 30
      case .ecSignSecp256K1Sha256: return 31
      case .hmacSha256: return 32
      case .hmacSha1: return 33
      case .hmacSha384: return 34
      case .hmacSha512: return 35
      case .hmacSha224: return 36
      case .rsaDecryptOaep2048Sha1: return 37
      case .rsaDecryptOaep3072Sha1: return 38
      case .rsaDecryptOaep4096Sha1: return 39
      case .ecSignEd25519: return 40
      case .aes128Gcm: return 41
      case .aes128Cbc: return 42
      case .aes256Cbc: return 43
      case .aes128Ctr: return 44
      case .aes256Ctr: return 45
      case .mlKem768: return 47
      case .mlKem1024: return 48
      case .pqSignMlDsa65: return 56
      case .pqSignSlhDsaSha2128S: return 57
      case .pqSignHashSlhDsaSha2128SSha256: return 60
      case .kemXwing: return 63
      case .pqSignMlDsa65ExternalMu: return 67
      case .pqSignMlDsa44: return 68
      case .pqSignMlDsa87: return 69
      case .pqSignMlDsa44ExternalMu: return 70
      case .pqSignMlDsa87ExternalMu: return 71
      case .aes256Kwp: return 73
      case .unknownIntValue(let v): return v
      case .unknownStringValue: return nil
      }
    }

    /// Returns the string value (or name) associated with the enumeration.
    ///
    /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
    public var stringValue: Swift.String? {
      switch self {
      case .unspecified: return "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED"
      case .googleSymmetricEncryption: return "GOOGLE_SYMMETRIC_ENCRYPTION"
      case .rsaSignPss2048Sha256: return "RSA_SIGN_PSS_2048_SHA256"
      case .rsaSignPss3072Sha256: return "RSA_SIGN_PSS_3072_SHA256"
      case .rsaSignPss4096Sha256: return "RSA_SIGN_PSS_4096_SHA256"
      case .rsaSignPkcs12048Sha256: return "RSA_SIGN_PKCS1_2048_SHA256"
      case .rsaSignPkcs13072Sha256: return "RSA_SIGN_PKCS1_3072_SHA256"
      case .rsaSignPkcs14096Sha256: return "RSA_SIGN_PKCS1_4096_SHA256"
      case .rsaDecryptOaep2048Sha256: return "RSA_DECRYPT_OAEP_2048_SHA256"
      case .rsaDecryptOaep3072Sha256: return "RSA_DECRYPT_OAEP_3072_SHA256"
      case .rsaDecryptOaep4096Sha256: return "RSA_DECRYPT_OAEP_4096_SHA256"
      case .ecSignP256Sha256: return "EC_SIGN_P256_SHA256"
      case .ecSignP384Sha384: return "EC_SIGN_P384_SHA384"
      case .rsaSignPss4096Sha512: return "RSA_SIGN_PSS_4096_SHA512"
      case .rsaSignPkcs14096Sha512: return "RSA_SIGN_PKCS1_4096_SHA512"
      case .rsaDecryptOaep4096Sha512: return "RSA_DECRYPT_OAEP_4096_SHA512"
      case .externalSymmetricEncryption: return "EXTERNAL_SYMMETRIC_ENCRYPTION"
      case .aes256Gcm: return "AES_256_GCM"
      case .rsaSignRawPkcs12048: return "RSA_SIGN_RAW_PKCS1_2048"
      case .rsaSignRawPkcs13072: return "RSA_SIGN_RAW_PKCS1_3072"
      case .rsaSignRawPkcs14096: return "RSA_SIGN_RAW_PKCS1_4096"
      case .ecSignSecp256K1Sha256: return "EC_SIGN_SECP256K1_SHA256"
      case .hmacSha256: return "HMAC_SHA256"
      case .hmacSha1: return "HMAC_SHA1"
      case .hmacSha384: return "HMAC_SHA384"
      case .hmacSha512: return "HMAC_SHA512"
      case .hmacSha224: return "HMAC_SHA224"
      case .rsaDecryptOaep2048Sha1: return "RSA_DECRYPT_OAEP_2048_SHA1"
      case .rsaDecryptOaep3072Sha1: return "RSA_DECRYPT_OAEP_3072_SHA1"
      case .rsaDecryptOaep4096Sha1: return "RSA_DECRYPT_OAEP_4096_SHA1"
      case .ecSignEd25519: return "EC_SIGN_ED25519"
      case .aes128Gcm: return "AES_128_GCM"
      case .aes128Cbc: return "AES_128_CBC"
      case .aes256Cbc: return "AES_256_CBC"
      case .aes128Ctr: return "AES_128_CTR"
      case .aes256Ctr: return "AES_256_CTR"
      case .mlKem768: return "ML_KEM_768"
      case .mlKem1024: return "ML_KEM_1024"
      case .pqSignMlDsa65: return "PQ_SIGN_ML_DSA_65"
      case .pqSignSlhDsaSha2128S: return "PQ_SIGN_SLH_DSA_SHA2_128S"
      case .pqSignHashSlhDsaSha2128SSha256: return "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256"
      case .kemXwing: return "KEM_XWING"
      case .pqSignMlDsa65ExternalMu: return "PQ_SIGN_ML_DSA_65_EXTERNAL_MU"
      case .pqSignMlDsa44: return "PQ_SIGN_ML_DSA_44"
      case .pqSignMlDsa87: return "PQ_SIGN_ML_DSA_87"
      case .pqSignMlDsa44ExternalMu: return "PQ_SIGN_ML_DSA_44_EXTERNAL_MU"
      case .pqSignMlDsa87ExternalMu: return "PQ_SIGN_ML_DSA_87_EXTERNAL_MU"
      case .aes256Kwp: return "AES_256_KWP"
      case .unknownIntValue: return nil
      case .unknownStringValue(let v): return v
      }
    }

    /// Initialize from a string value.
    ///
    /// If the value is unknown, this initializes to [`unknownStringValue`](doc:CryptoKeyVersionAlgorithm/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED": self = .unspecified
      case "GOOGLE_SYMMETRIC_ENCRYPTION": self = .googleSymmetricEncryption
      case "AES_128_GCM": self = .aes128Gcm
      case "AES_256_GCM": self = .aes256Gcm
      case "AES_128_CBC": self = .aes128Cbc
      case "AES_256_CBC": self = .aes256Cbc
      case "AES_128_CTR": self = .aes128Ctr
      case "AES_256_CTR": self = .aes256Ctr
      case "RSA_SIGN_PSS_2048_SHA256": self = .rsaSignPss2048Sha256
      case "RSA_SIGN_PSS_3072_SHA256": self = .rsaSignPss3072Sha256
      case "RSA_SIGN_PSS_4096_SHA256": self = .rsaSignPss4096Sha256
      case "RSA_SIGN_PSS_4096_SHA512": self = .rsaSignPss4096Sha512
      case "RSA_SIGN_PKCS1_2048_SHA256": self = .rsaSignPkcs12048Sha256
      case "RSA_SIGN_PKCS1_3072_SHA256": self = .rsaSignPkcs13072Sha256
      case "RSA_SIGN_PKCS1_4096_SHA256": self = .rsaSignPkcs14096Sha256
      case "RSA_SIGN_PKCS1_4096_SHA512": self = .rsaSignPkcs14096Sha512
      case "RSA_SIGN_RAW_PKCS1_2048": self = .rsaSignRawPkcs12048
      case "RSA_SIGN_RAW_PKCS1_3072": self = .rsaSignRawPkcs13072
      case "RSA_SIGN_RAW_PKCS1_4096": self = .rsaSignRawPkcs14096
      case "RSA_DECRYPT_OAEP_2048_SHA256": self = .rsaDecryptOaep2048Sha256
      case "RSA_DECRYPT_OAEP_3072_SHA256": self = .rsaDecryptOaep3072Sha256
      case "RSA_DECRYPT_OAEP_4096_SHA256": self = .rsaDecryptOaep4096Sha256
      case "RSA_DECRYPT_OAEP_4096_SHA512": self = .rsaDecryptOaep4096Sha512
      case "RSA_DECRYPT_OAEP_2048_SHA1": self = .rsaDecryptOaep2048Sha1
      case "RSA_DECRYPT_OAEP_3072_SHA1": self = .rsaDecryptOaep3072Sha1
      case "RSA_DECRYPT_OAEP_4096_SHA1": self = .rsaDecryptOaep4096Sha1
      case "EC_SIGN_P256_SHA256": self = .ecSignP256Sha256
      case "EC_SIGN_P384_SHA384": self = .ecSignP384Sha384
      case "EC_SIGN_SECP256K1_SHA256": self = .ecSignSecp256K1Sha256
      case "EC_SIGN_ED25519": self = .ecSignEd25519
      case "HMAC_SHA256": self = .hmacSha256
      case "HMAC_SHA1": self = .hmacSha1
      case "HMAC_SHA384": self = .hmacSha384
      case "HMAC_SHA512": self = .hmacSha512
      case "HMAC_SHA224": self = .hmacSha224
      case "EXTERNAL_SYMMETRIC_ENCRYPTION": self = .externalSymmetricEncryption
      case "ML_KEM_768": self = .mlKem768
      case "ML_KEM_1024": self = .mlKem1024
      case "KEM_XWING": self = .kemXwing
      case "PQ_SIGN_ML_DSA_44": self = .pqSignMlDsa44
      case "PQ_SIGN_ML_DSA_65": self = .pqSignMlDsa65
      case "PQ_SIGN_ML_DSA_87": self = .pqSignMlDsa87
      case "PQ_SIGN_SLH_DSA_SHA2_128S": self = .pqSignSlhDsaSha2128S
      case "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256": self = .pqSignHashSlhDsaSha2128SSha256
      case "PQ_SIGN_ML_DSA_44_EXTERNAL_MU": self = .pqSignMlDsa44ExternalMu
      case "PQ_SIGN_ML_DSA_65_EXTERNAL_MU": self = .pqSignMlDsa65ExternalMu
      case "PQ_SIGN_ML_DSA_87_EXTERNAL_MU": self = .pqSignMlDsa87ExternalMu
      case "AES_256_KWP": self = .aes256Kwp
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:CryptoKeyVersionAlgorithm/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .googleSymmetricEncryption
      case 2: self = .rsaSignPss2048Sha256
      case 3: self = .rsaSignPss3072Sha256
      case 4: self = .rsaSignPss4096Sha256
      case 5: self = .rsaSignPkcs12048Sha256
      case 6: self = .rsaSignPkcs13072Sha256
      case 7: self = .rsaSignPkcs14096Sha256
      case 8: self = .rsaDecryptOaep2048Sha256
      case 9: self = .rsaDecryptOaep3072Sha256
      case 10: self = .rsaDecryptOaep4096Sha256
      case 12: self = .ecSignP256Sha256
      case 13: self = .ecSignP384Sha384
      case 15: self = .rsaSignPss4096Sha512
      case 16: self = .rsaSignPkcs14096Sha512
      case 17: self = .rsaDecryptOaep4096Sha512
      case 18: self = .externalSymmetricEncryption
      case 19: self = .aes256Gcm
      case 28: self = .rsaSignRawPkcs12048
      case 29: self = .rsaSignRawPkcs13072
      case 30: self = .rsaSignRawPkcs14096
      case 31: self = .ecSignSecp256K1Sha256
      case 32: self = .hmacSha256
      case 33: self = .hmacSha1
      case 34: self = .hmacSha384
      case 35: self = .hmacSha512
      case 36: self = .hmacSha224
      case 37: self = .rsaDecryptOaep2048Sha1
      case 38: self = .rsaDecryptOaep3072Sha1
      case 39: self = .rsaDecryptOaep4096Sha1
      case 40: self = .ecSignEd25519
      case 41: self = .aes128Gcm
      case 42: self = .aes128Cbc
      case 43: self = .aes256Cbc
      case 44: self = .aes128Ctr
      case 45: self = .aes256Ctr
      case 47: self = .mlKem768
      case 48: self = .mlKem1024
      case 56: self = .pqSignMlDsa65
      case 57: self = .pqSignSlhDsaSha2128S
      case 60: self = .pqSignHashSlhDsaSha2128SSha256
      case 63: self = .kemXwing
      case 67: self = .pqSignMlDsa65ExternalMu
      case 68: self = .pqSignMlDsa44
      case 69: self = .pqSignMlDsa87
      case 70: self = .pqSignMlDsa44ExternalMu
      case 71: self = .pqSignMlDsa87ExternalMu
      case 73: self = .aes256Kwp
      default: self = .unknownIntValue(intValue)
      }
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.singleValueContainer()
      if let v = try? container.decode(Int.self) {
        self.init(intValue: v)
        return
      }
      if let s = try? container.decode(String.self) {
        if let v = Int(s) {
          self.init(intValue: v)
        } else {
          self.init(stringValue: s)
        }
        return
      }
      throw DecodingError.dataCorruptedError(
        in: container, debugDescription: "Expected enum value, must be integer or string.")
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.singleValueContainer()
      switch self {
      case .unspecified: return try container.encode(0)
      case .googleSymmetricEncryption: return try container.encode(1)
      case .rsaSignPss2048Sha256: return try container.encode(2)
      case .rsaSignPss3072Sha256: return try container.encode(3)
      case .rsaSignPss4096Sha256: return try container.encode(4)
      case .rsaSignPkcs12048Sha256: return try container.encode(5)
      case .rsaSignPkcs13072Sha256: return try container.encode(6)
      case .rsaSignPkcs14096Sha256: return try container.encode(7)
      case .rsaDecryptOaep2048Sha256: return try container.encode(8)
      case .rsaDecryptOaep3072Sha256: return try container.encode(9)
      case .rsaDecryptOaep4096Sha256: return try container.encode(10)
      case .ecSignP256Sha256: return try container.encode(12)
      case .ecSignP384Sha384: return try container.encode(13)
      case .rsaSignPss4096Sha512: return try container.encode(15)
      case .rsaSignPkcs14096Sha512: return try container.encode(16)
      case .rsaDecryptOaep4096Sha512: return try container.encode(17)
      case .externalSymmetricEncryption: return try container.encode(18)
      case .aes256Gcm: return try container.encode(19)
      case .rsaSignRawPkcs12048: return try container.encode(28)
      case .rsaSignRawPkcs13072: return try container.encode(29)
      case .rsaSignRawPkcs14096: return try container.encode(30)
      case .ecSignSecp256K1Sha256: return try container.encode(31)
      case .hmacSha256: return try container.encode(32)
      case .hmacSha1: return try container.encode(33)
      case .hmacSha384: return try container.encode(34)
      case .hmacSha512: return try container.encode(35)
      case .hmacSha224: return try container.encode(36)
      case .rsaDecryptOaep2048Sha1: return try container.encode(37)
      case .rsaDecryptOaep3072Sha1: return try container.encode(38)
      case .rsaDecryptOaep4096Sha1: return try container.encode(39)
      case .ecSignEd25519: return try container.encode(40)
      case .aes128Gcm: return try container.encode(41)
      case .aes128Cbc: return try container.encode(42)
      case .aes256Cbc: return try container.encode(43)
      case .aes128Ctr: return try container.encode(44)
      case .aes256Ctr: return try container.encode(45)
      case .mlKem768: return try container.encode(47)
      case .mlKem1024: return try container.encode(48)
      case .pqSignMlDsa65: return try container.encode(56)
      case .pqSignSlhDsaSha2128S: return try container.encode(57)
      case .pqSignHashSlhDsaSha2128SSha256: return try container.encode(60)
      case .kemXwing: return try container.encode(63)
      case .pqSignMlDsa65ExternalMu: return try container.encode(67)
      case .pqSignMlDsa44: return try container.encode(68)
      case .pqSignMlDsa87: return try container.encode(69)
      case .pqSignMlDsa44ExternalMu: return try container.encode(70)
      case .pqSignMlDsa87ExternalMu: return try container.encode(71)
      case .aes256Kwp: return try container.encode(73)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
  /// indicating if it can be used.
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  public enum CryptoKeyVersionState: Codable, Equatable, Sendable {
    /// Not specified.
    case unspecified
    /// This version may be used for cryptographic operations.
    case enabled
    /// This version may not be used, but the key material is still available,
    /// and the version can be placed back into the
    /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
    /// state.
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/enabled>
    case disabled
    /// The key material of this version is destroyed and no longer stored.
    /// This version may only become
    /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
    /// again if this version is
    /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
    /// and the original key material is reimported with a call to
    /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/enabled>
    /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: <doc:CryptoKeyVersion/reimportEligible>
    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: <doc:KeyManagementService/importCryptoKeyVersion(request:)>
    case destroyed
    /// This version is scheduled for destruction, and will be destroyed soon.
    /// Call
    /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
    /// to put it back into the
    /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
    /// state.
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/disabled>
    /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: <doc:KeyManagementService/restoreCryptoKeyVersion(request:)>
    case destroyScheduled
    /// This version is still being generated. It may not be used, enabled,
    /// disabled, or destroyed yet. Cloud KMS will automatically mark this
    /// version
    /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
    /// as soon as the version is ready.
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/enabled>
    case pendingGeneration
    /// This version is still being imported. It may not be used, enabled,
    /// disabled, or destroyed yet. Cloud KMS will automatically mark this
    /// version
    /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
    /// as soon as the version is ready.
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: <doc:CryptoKeyVersion/CryptoKeyVersionState/enabled>
    case pendingImport
    /// This version was not imported successfully. It may not be used, enabled,
    /// disabled, or destroyed. The submitted key material has been discarded.
    /// Additional details can be found in
    /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: <doc:CryptoKeyVersion/importFailureReason>
    case importFailed
    /// This version was not generated successfully. It may not be used, enabled,
    /// disabled, or destroyed. Additional details can be found in
    /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: <doc:CryptoKeyVersion/generationFailureReason>
    case generationFailed
    /// This version was destroyed, and it may not be used or enabled again.
    /// Cloud KMS is waiting for the corresponding key material residing in an
    /// external key manager to be destroyed.
    case pendingExternalDestruction
    /// This version was destroyed, and it may not be used or enabled again.
    /// However, Cloud KMS could not confirm that the corresponding key material
    /// residing in an external key manager was destroyed. Additional details can
    /// be found in
    /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: <doc:CryptoKeyVersion/externalDestructionFailureReason>
    case externalDestructionFailed
    /// Encodes an unknown integer value.
    ///
    /// The most common cause for an unknown values is for the service to send
    /// a value unknown to the library. We recommend you update your library to
    /// the latest version.
    case unknownIntValue(Int)
    /// Encodes an unknown string value.
    ///
    /// The most common cause for an unknown values is for the service to send
    /// a value unknown to the library. We recommend you update your library to
    /// the latest version.
    case unknownStringValue(String)

    public init() {
      self = .unspecified
    }

    /// Returns the integer value associated with the enumeration.
    ///
    /// If the enumeration was initialized with an unknown string value, this returns `nil`.
    public var intValue: Int? {
      switch self {
      case .unspecified: return 0
      case .enabled: return 1
      case .disabled: return 2
      case .destroyed: return 3
      case .destroyScheduled: return 4
      case .pendingGeneration: return 5
      case .pendingImport: return 6
      case .importFailed: return 7
      case .generationFailed: return 8
      case .pendingExternalDestruction: return 9
      case .externalDestructionFailed: return 10
      case .unknownIntValue(let v): return v
      case .unknownStringValue: return nil
      }
    }

    /// Returns the string value (or name) associated with the enumeration.
    ///
    /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
    public var stringValue: Swift.String? {
      switch self {
      case .unspecified: return "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED"
      case .enabled: return "ENABLED"
      case .disabled: return "DISABLED"
      case .destroyed: return "DESTROYED"
      case .destroyScheduled: return "DESTROY_SCHEDULED"
      case .pendingGeneration: return "PENDING_GENERATION"
      case .pendingImport: return "PENDING_IMPORT"
      case .importFailed: return "IMPORT_FAILED"
      case .generationFailed: return "GENERATION_FAILED"
      case .pendingExternalDestruction: return "PENDING_EXTERNAL_DESTRUCTION"
      case .externalDestructionFailed: return "EXTERNAL_DESTRUCTION_FAILED"
      case .unknownIntValue: return nil
      case .unknownStringValue(let v): return v
      }
    }

    /// Initialize from a string value.
    ///
    /// If the value is unknown, this initializes to [`unknownStringValue`](doc:CryptoKeyVersionState/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED": self = .unspecified
      case "PENDING_GENERATION": self = .pendingGeneration
      case "ENABLED": self = .enabled
      case "DISABLED": self = .disabled
      case "DESTROYED": self = .destroyed
      case "DESTROY_SCHEDULED": self = .destroyScheduled
      case "PENDING_IMPORT": self = .pendingImport
      case "IMPORT_FAILED": self = .importFailed
      case "GENERATION_FAILED": self = .generationFailed
      case "PENDING_EXTERNAL_DESTRUCTION": self = .pendingExternalDestruction
      case "EXTERNAL_DESTRUCTION_FAILED": self = .externalDestructionFailed
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:CryptoKeyVersionState/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .enabled
      case 2: self = .disabled
      case 3: self = .destroyed
      case 4: self = .destroyScheduled
      case 5: self = .pendingGeneration
      case 6: self = .pendingImport
      case 7: self = .importFailed
      case 8: self = .generationFailed
      case 9: self = .pendingExternalDestruction
      case 10: self = .externalDestructionFailed
      default: self = .unknownIntValue(intValue)
      }
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.singleValueContainer()
      if let v = try? container.decode(Int.self) {
        self.init(intValue: v)
        return
      }
      if let s = try? container.decode(String.self) {
        if let v = Int(s) {
          self.init(intValue: v)
        } else {
          self.init(stringValue: s)
        }
        return
      }
      throw DecodingError.dataCorruptedError(
        in: container, debugDescription: "Expected enum value, must be integer or string.")
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.singleValueContainer()
      switch self {
      case .unspecified: return try container.encode(0)
      case .enabled: return try container.encode(1)
      case .disabled: return try container.encode(2)
      case .destroyed: return try container.encode(3)
      case .destroyScheduled: return try container.encode(4)
      case .pendingGeneration: return try container.encode(5)
      case .pendingImport: return try container.encode(6)
      case .importFailed: return try container.encode(7)
      case .generationFailed: return try container.encode(8)
      case .pendingExternalDestruction: return try container.encode(9)
      case .externalDestructionFailed: return try container.encode(10)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
  /// Controls the level of detail returned for
  /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
  /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
  /// and
  /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
  ///
  /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
  /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: <doc:KeyManagementService/listCryptoKeyVersions(request:)>
  /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: <doc:KeyManagementService/listCryptoKeys(request:)>
  public enum CryptoKeyVersionView: Codable, Equatable, Sendable {
    /// Default view for each
    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
    /// include the
    /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
    /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: <doc:CryptoKeyVersion/attestation>
    case unspecified
    /// Provides all fields in each
    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
    /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
    ///
    /// [google.cloud.kms.v1.CryptoKeyVersion]: <doc:CryptoKeyVersion>
    /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: <doc:CryptoKeyVersion/attestation>
    case full
    /// Encodes an unknown integer value.
    ///
    /// The most common cause for an unknown values is for the service to send
    /// a value unknown to the library. We recommend you update your library to
    /// the latest version.
    case unknownIntValue(Int)
    /// Encodes an unknown string value.
    ///
    /// The most common cause for an unknown values is for the service to send
    /// a value unknown to the library. We recommend you update your library to
    /// the latest version.
    case unknownStringValue(String)

    public init() {
      self = .unspecified
    }

    /// Returns the integer value associated with the enumeration.
    ///
    /// If the enumeration was initialized with an unknown string value, this returns `nil`.
    public var intValue: Int? {
      switch self {
      case .unspecified: return 0
      case .full: return 1
      case .unknownIntValue(let v): return v
      case .unknownStringValue: return nil
      }
    }

    /// Returns the string value (or name) associated with the enumeration.
    ///
    /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
    public var stringValue: Swift.String? {
      switch self {
      case .unspecified: return "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED"
      case .full: return "FULL"
      case .unknownIntValue: return nil
      case .unknownStringValue(let v): return v
      }
    }

    /// Initialize from a string value.
    ///
    /// If the value is unknown, this initializes to [`unknownStringValue`](doc:CryptoKeyVersionView/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED": self = .unspecified
      case "FULL": self = .full
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:CryptoKeyVersionView/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .full
      default: self = .unknownIntValue(intValue)
      }
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.singleValueContainer()
      if let v = try? container.decode(Int.self) {
        self.init(intValue: v)
        return
      }
      if let s = try? container.decode(String.self) {
        if let v = Int(s) {
          self.init(intValue: v)
        } else {
          self.init(stringValue: s)
        }
        return
      }
      throw DecodingError.dataCorruptedError(
        in: container, debugDescription: "Expected enum value, must be integer or string.")
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.singleValueContainer()
      switch self {
      case .unspecified: return try container.encode(0)
      case .full: return try container.encode(1)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
  }
  public init(fromAny any: GoogleCloudWkt.`Any`) throws {
    self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
  }
  public func _pack() throws -> GoogleCloudWkt.Struct {
    return try GoogleCloudWkt._slowAnySerialize(message: self)
  }
}
