/*
 * 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.contentwarehouse.v1.model;

/**
 * Represents a principal who possesses a signing key corresponding to the verification key or
 * keyset described here.
 *
 * <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 Document AI Warehouse 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 SecurityCredentialsSigningKeyPossessorProto extends com.google.api.client.json.GenericJson {

  /**
   * This value must be from the KeyMetadata.Type enum in keymaster.proto.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer keymasterKeyType;

  /**
   * The actual verification key bytes corresponding to the above type.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String serializedVerificationKey;

  /**
   * The binary serialized Keymaster SerializedReader of a public keyset. The keyset must contain
   * exactly one key. N.B.: If this field is populated, serialized_verification_key should be set to
   * the empty string and keymaster_key_type should be set to zero.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String serializedVerificationKeyset;

  /**
   * This value must be from the KeyMetadata.Type enum in keymaster.proto.
   * @return value or {@code null} for none
   */
  public java.lang.Integer getKeymasterKeyType() {
    return keymasterKeyType;
  }

  /**
   * This value must be from the KeyMetadata.Type enum in keymaster.proto.
   * @param keymasterKeyType keymasterKeyType or {@code null} for none
   */
  public SecurityCredentialsSigningKeyPossessorProto setKeymasterKeyType(java.lang.Integer keymasterKeyType) {
    this.keymasterKeyType = keymasterKeyType;
    return this;
  }

  /**
   * The actual verification key bytes corresponding to the above type.
   * @see #decodeSerializedVerificationKey()
   * @return value or {@code null} for none
   */
  public java.lang.String getSerializedVerificationKey() {
    return serializedVerificationKey;
  }

  /**
   * The actual verification key bytes corresponding to the above type.
   * @see #getSerializedVerificationKey()
   * @return Base64 decoded value or {@code null} for none
   *
   * @since 1.14
   */
  public byte[] decodeSerializedVerificationKey() {
    return com.google.api.client.util.Base64.decodeBase64(serializedVerificationKey);
  }

  /**
   * The actual verification key bytes corresponding to the above type.
   * @see #encodeSerializedVerificationKey()
   * @param serializedVerificationKey serializedVerificationKey or {@code null} for none
   */
  public SecurityCredentialsSigningKeyPossessorProto setSerializedVerificationKey(java.lang.String serializedVerificationKey) {
    this.serializedVerificationKey = serializedVerificationKey;
    return this;
  }

  /**
   * The actual verification key bytes corresponding to the above type.
   * @see #setSerializedVerificationKey()
   *
   * <p>
   * The value is encoded Base64 or {@code null} for none.
   * </p>
   *
   * @since 1.14
   */
  public SecurityCredentialsSigningKeyPossessorProto encodeSerializedVerificationKey(byte[] serializedVerificationKey) {
    this.serializedVerificationKey = com.google.api.client.util.Base64.encodeBase64URLSafeString(serializedVerificationKey);
    return this;
  }

  /**
   * The binary serialized Keymaster SerializedReader of a public keyset. The keyset must contain
   * exactly one key. N.B.: If this field is populated, serialized_verification_key should be set to
   * the empty string and keymaster_key_type should be set to zero.
   * @see #decodeSerializedVerificationKeyset()
   * @return value or {@code null} for none
   */
  public java.lang.String getSerializedVerificationKeyset() {
    return serializedVerificationKeyset;
  }

  /**
   * The binary serialized Keymaster SerializedReader of a public keyset. The keyset must contain
   * exactly one key. N.B.: If this field is populated, serialized_verification_key should be set to
   * the empty string and keymaster_key_type should be set to zero.
   * @see #getSerializedVerificationKeyset()
   * @return Base64 decoded value or {@code null} for none
   *
   * @since 1.14
   */
  public byte[] decodeSerializedVerificationKeyset() {
    return com.google.api.client.util.Base64.decodeBase64(serializedVerificationKeyset);
  }

  /**
   * The binary serialized Keymaster SerializedReader of a public keyset. The keyset must contain
   * exactly one key. N.B.: If this field is populated, serialized_verification_key should be set to
   * the empty string and keymaster_key_type should be set to zero.
   * @see #encodeSerializedVerificationKeyset()
   * @param serializedVerificationKeyset serializedVerificationKeyset or {@code null} for none
   */
  public SecurityCredentialsSigningKeyPossessorProto setSerializedVerificationKeyset(java.lang.String serializedVerificationKeyset) {
    this.serializedVerificationKeyset = serializedVerificationKeyset;
    return this;
  }

  /**
   * The binary serialized Keymaster SerializedReader of a public keyset. The keyset must contain
   * exactly one key. N.B.: If this field is populated, serialized_verification_key should be set to
   * the empty string and keymaster_key_type should be set to zero.
   * @see #setSerializedVerificationKeyset()
   *
   * <p>
   * The value is encoded Base64 or {@code null} for none.
   * </p>
   *
   * @since 1.14
   */
  public SecurityCredentialsSigningKeyPossessorProto encodeSerializedVerificationKeyset(byte[] serializedVerificationKeyset) {
    this.serializedVerificationKeyset = com.google.api.client.util.Base64.encodeBase64URLSafeString(serializedVerificationKeyset);
    return this;
  }

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

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

}
