/*
 * 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
 *
 * http://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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.cloudkms.v1.model;

/**
 * Request message for KeyManagementService.RawDecrypt.
 *
 * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Key Management Service (KMS) API. For a
 * detailed explanation see:
 * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
 * </p>
 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class RawDecryptRequest extends com.google.api.client.json.GenericJson {

  /**
   * Optional. Optional data that must match the data originally supplied in
   * RawEncryptRequest.additional_authenticated_data.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String additionalAuthenticatedData;

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.additional_authenticated_data.
   * If specified, KeyManagementService will verify the integrity of the received
   * additional_authenticated_data using this checksum. KeyManagementService will report an error if
   * the checksum verification fails. If you receive a checksum error, your client should verify
   * that CRC32C(additional_authenticated_data) is equal to additional_authenticated_data_crc32c,
   * and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in
   * your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of
   * compatibility across different languages. However, it is a non-negative integer, which will
   * never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this
   * type.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key @com.google.api.client.json.JsonString
  private java.lang.Long additionalAuthenticatedDataCrc32c;

  /**
   * Required. The encrypted data originally returned in RawEncryptResponse.ciphertext.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String ciphertext;

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.ciphertext. If specified,
   * KeyManagementService will verify the integrity of the received ciphertext using this checksum.
   * KeyManagementService will report an error if the checksum verification fails. If you receive a
   * checksum error, your client should verify that CRC32C(ciphertext) is equal to
   * ciphertext_crc32c, and if so, perform a limited number of retries. A persistent mismatch may
   * indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as
   * int64 for reasons of compatibility across different languages. However, it is a non-negative
   * integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages
   * that support this type.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key @com.google.api.client.json.JsonString
  private java.lang.Long ciphertextCrc32c;

  /**
   * Required. The initialization vector (IV) used during encryption, which must match the data
   * originally provided in RawEncryptResponse.initialization_vector.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String initializationVector;

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.initialization_vector. If
   * specified, KeyManagementService will verify the integrity of the received initialization_vector
   * using this checksum. KeyManagementService will report an error if the checksum verification
   * fails. If you receive a checksum error, your client should verify that
   * CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and if so, perform a
   * limited number of retries. A persistent mismatch may indicate an issue in your computation of
   * the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across
   * different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and
   * can be safely downconverted to uint32 in languages that support this type.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key @com.google.api.client.json.JsonString
  private java.lang.Long initializationVectorCrc32c;

  /**
   * The length of the authentication tag that is appended to the end of the ciphertext. If
   * unspecified (0), the default value for the key's algorithm will be used (for AES-GCM, the
   * default value is 16).
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer tagLength;

  /**
   * Optional. Optional data that must match the data originally supplied in
   * RawEncryptRequest.additional_authenticated_data.
   * @see #decodeAdditionalAuthenticatedData()
   * @return value or {@code null} for none
   */
  public java.lang.String getAdditionalAuthenticatedData() {
    return additionalAuthenticatedData;
  }

  /**
   * Optional. Optional data that must match the data originally supplied in
   * RawEncryptRequest.additional_authenticated_data.
   * @see #getAdditionalAuthenticatedData()
   * @return Base64 decoded value or {@code null} for none
   *
   * @since 1.14
   */
  public byte[] decodeAdditionalAuthenticatedData() {
    return com.google.api.client.util.Base64.decodeBase64(additionalAuthenticatedData);
  }

  /**
   * Optional. Optional data that must match the data originally supplied in
   * RawEncryptRequest.additional_authenticated_data.
   * @see #encodeAdditionalAuthenticatedData()
   * @param additionalAuthenticatedData additionalAuthenticatedData or {@code null} for none
   */
  public RawDecryptRequest setAdditionalAuthenticatedData(java.lang.String additionalAuthenticatedData) {
    this.additionalAuthenticatedData = additionalAuthenticatedData;
    return this;
  }

  /**
   * Optional. Optional data that must match the data originally supplied in
   * RawEncryptRequest.additional_authenticated_data.
   * @see #setAdditionalAuthenticatedData()
   *
   * <p>
   * The value is encoded Base64 or {@code null} for none.
   * </p>
   *
   * @since 1.14
   */
  public RawDecryptRequest encodeAdditionalAuthenticatedData(byte[] additionalAuthenticatedData) {
    this.additionalAuthenticatedData = com.google.api.client.util.Base64.encodeBase64URLSafeString(additionalAuthenticatedData);
    return this;
  }

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.additional_authenticated_data.
   * If specified, KeyManagementService will verify the integrity of the received
   * additional_authenticated_data using this checksum. KeyManagementService will report an error if
   * the checksum verification fails. If you receive a checksum error, your client should verify
   * that CRC32C(additional_authenticated_data) is equal to additional_authenticated_data_crc32c,
   * and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in
   * your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of
   * compatibility across different languages. However, it is a non-negative integer, which will
   * never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this
   * type.
   * @return value or {@code null} for none
   */
  public java.lang.Long getAdditionalAuthenticatedDataCrc32c() {
    return additionalAuthenticatedDataCrc32c;
  }

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.additional_authenticated_data.
   * If specified, KeyManagementService will verify the integrity of the received
   * additional_authenticated_data using this checksum. KeyManagementService will report an error if
   * the checksum verification fails. If you receive a checksum error, your client should verify
   * that CRC32C(additional_authenticated_data) is equal to additional_authenticated_data_crc32c,
   * and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in
   * your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of
   * compatibility across different languages. However, it is a non-negative integer, which will
   * never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this
   * type.
   * @param additionalAuthenticatedDataCrc32c additionalAuthenticatedDataCrc32c or {@code null} for none
   */
  public RawDecryptRequest setAdditionalAuthenticatedDataCrc32c(java.lang.Long additionalAuthenticatedDataCrc32c) {
    this.additionalAuthenticatedDataCrc32c = additionalAuthenticatedDataCrc32c;
    return this;
  }

  /**
   * Required. The encrypted data originally returned in RawEncryptResponse.ciphertext.
   * @see #decodeCiphertext()
   * @return value or {@code null} for none
   */
  public java.lang.String getCiphertext() {
    return ciphertext;
  }

  /**
   * Required. The encrypted data originally returned in RawEncryptResponse.ciphertext.
   * @see #getCiphertext()
   * @return Base64 decoded value or {@code null} for none
   *
   * @since 1.14
   */
  public byte[] decodeCiphertext() {
    return com.google.api.client.util.Base64.decodeBase64(ciphertext);
  }

  /**
   * Required. The encrypted data originally returned in RawEncryptResponse.ciphertext.
   * @see #encodeCiphertext()
   * @param ciphertext ciphertext or {@code null} for none
   */
  public RawDecryptRequest setCiphertext(java.lang.String ciphertext) {
    this.ciphertext = ciphertext;
    return this;
  }

  /**
   * Required. The encrypted data originally returned in RawEncryptResponse.ciphertext.
   * @see #setCiphertext()
   *
   * <p>
   * The value is encoded Base64 or {@code null} for none.
   * </p>
   *
   * @since 1.14
   */
  public RawDecryptRequest encodeCiphertext(byte[] ciphertext) {
    this.ciphertext = com.google.api.client.util.Base64.encodeBase64URLSafeString(ciphertext);
    return this;
  }

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.ciphertext. If specified,
   * KeyManagementService will verify the integrity of the received ciphertext using this checksum.
   * KeyManagementService will report an error if the checksum verification fails. If you receive a
   * checksum error, your client should verify that CRC32C(ciphertext) is equal to
   * ciphertext_crc32c, and if so, perform a limited number of retries. A persistent mismatch may
   * indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as
   * int64 for reasons of compatibility across different languages. However, it is a non-negative
   * integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages
   * that support this type.
   * @return value or {@code null} for none
   */
  public java.lang.Long getCiphertextCrc32c() {
    return ciphertextCrc32c;
  }

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.ciphertext. If specified,
   * KeyManagementService will verify the integrity of the received ciphertext using this checksum.
   * KeyManagementService will report an error if the checksum verification fails. If you receive a
   * checksum error, your client should verify that CRC32C(ciphertext) is equal to
   * ciphertext_crc32c, and if so, perform a limited number of retries. A persistent mismatch may
   * indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as
   * int64 for reasons of compatibility across different languages. However, it is a non-negative
   * integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages
   * that support this type.
   * @param ciphertextCrc32c ciphertextCrc32c or {@code null} for none
   */
  public RawDecryptRequest setCiphertextCrc32c(java.lang.Long ciphertextCrc32c) {
    this.ciphertextCrc32c = ciphertextCrc32c;
    return this;
  }

  /**
   * Required. The initialization vector (IV) used during encryption, which must match the data
   * originally provided in RawEncryptResponse.initialization_vector.
   * @see #decodeInitializationVector()
   * @return value or {@code null} for none
   */
  public java.lang.String getInitializationVector() {
    return initializationVector;
  }

  /**
   * Required. The initialization vector (IV) used during encryption, which must match the data
   * originally provided in RawEncryptResponse.initialization_vector.
   * @see #getInitializationVector()
   * @return Base64 decoded value or {@code null} for none
   *
   * @since 1.14
   */
  public byte[] decodeInitializationVector() {
    return com.google.api.client.util.Base64.decodeBase64(initializationVector);
  }

  /**
   * Required. The initialization vector (IV) used during encryption, which must match the data
   * originally provided in RawEncryptResponse.initialization_vector.
   * @see #encodeInitializationVector()
   * @param initializationVector initializationVector or {@code null} for none
   */
  public RawDecryptRequest setInitializationVector(java.lang.String initializationVector) {
    this.initializationVector = initializationVector;
    return this;
  }

  /**
   * Required. The initialization vector (IV) used during encryption, which must match the data
   * originally provided in RawEncryptResponse.initialization_vector.
   * @see #setInitializationVector()
   *
   * <p>
   * The value is encoded Base64 or {@code null} for none.
   * </p>
   *
   * @since 1.14
   */
  public RawDecryptRequest encodeInitializationVector(byte[] initializationVector) {
    this.initializationVector = com.google.api.client.util.Base64.encodeBase64URLSafeString(initializationVector);
    return this;
  }

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.initialization_vector. If
   * specified, KeyManagementService will verify the integrity of the received initialization_vector
   * using this checksum. KeyManagementService will report an error if the checksum verification
   * fails. If you receive a checksum error, your client should verify that
   * CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and if so, perform a
   * limited number of retries. A persistent mismatch may indicate an issue in your computation of
   * the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across
   * different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and
   * can be safely downconverted to uint32 in languages that support this type.
   * @return value or {@code null} for none
   */
  public java.lang.Long getInitializationVectorCrc32c() {
    return initializationVectorCrc32c;
  }

  /**
   * Optional. An optional CRC32C checksum of the RawDecryptRequest.initialization_vector. If
   * specified, KeyManagementService will verify the integrity of the received initialization_vector
   * using this checksum. KeyManagementService will report an error if the checksum verification
   * fails. If you receive a checksum error, your client should verify that
   * CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and if so, perform a
   * limited number of retries. A persistent mismatch may indicate an issue in your computation of
   * the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across
   * different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and
   * can be safely downconverted to uint32 in languages that support this type.
   * @param initializationVectorCrc32c initializationVectorCrc32c or {@code null} for none
   */
  public RawDecryptRequest setInitializationVectorCrc32c(java.lang.Long initializationVectorCrc32c) {
    this.initializationVectorCrc32c = initializationVectorCrc32c;
    return this;
  }

  /**
   * The length of the authentication tag that is appended to the end of the ciphertext. If
   * unspecified (0), the default value for the key's algorithm will be used (for AES-GCM, the
   * default value is 16).
   * @return value or {@code null} for none
   */
  public java.lang.Integer getTagLength() {
    return tagLength;
  }

  /**
   * The length of the authentication tag that is appended to the end of the ciphertext. If
   * unspecified (0), the default value for the key's algorithm will be used (for AES-GCM, the
   * default value is 16).
   * @param tagLength tagLength or {@code null} for none
   */
  public RawDecryptRequest setTagLength(java.lang.Integer tagLength) {
    this.tagLength = tagLength;
    return this;
  }

  @Override
  public RawDecryptRequest set(String fieldName, Object value) {
    return (RawDecryptRequest) super.set(fieldName, value);
  }

  @Override
  public RawDecryptRequest clone() {
    return (RawDecryptRequest) super.clone();
  }

}
