/*
 * Copyright 2020 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.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/devtools/containeranalysis/v1beta1/attestation/attestation.proto

package io.grafeas.v1beta1.attestation;

/**
 *
 *
 * <pre>
 * An attestation wrapper that uses the Grafeas `Signature` message.
 * This attestation must define the `serialized_payload` that the `signatures`
 * verify and any metadata necessary to interpret that plaintext.  The
 * signatures should always be over the `serialized_payload` bytestring.
 * </pre>
 *
 * Protobuf type {@code grafeas.v1beta1.attestation.GenericSignedAttestation}
 */
public final class GenericSignedAttestation extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:grafeas.v1beta1.attestation.GenericSignedAttestation)
    GenericSignedAttestationOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use GenericSignedAttestation.newBuilder() to construct.
  private GenericSignedAttestation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private GenericSignedAttestation() {
    contentType_ = 0;
    serializedPayload_ = com.google.protobuf.ByteString.EMPTY;
    signatures_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new GenericSignedAttestation();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  private GenericSignedAttestation(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 8:
            {
              int rawValue = input.readEnum();

              contentType_ = rawValue;
              break;
            }
          case 18:
            {
              serializedPayload_ = input.readBytes();
              break;
            }
          case 26:
            {
              if (!((mutable_bitField0_ & 0x00000001) != 0)) {
                signatures_ = new java.util.ArrayList<io.grafeas.v1beta1.common.Signature>();
                mutable_bitField0_ |= 0x00000001;
              }
              signatures_.add(
                  input.readMessage(
                      io.grafeas.v1beta1.common.Signature.parser(), extensionRegistry));
              break;
            }
          default:
            {
              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000001) != 0)) {
        signatures_ = java.util.Collections.unmodifiableList(signatures_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return io.grafeas.v1beta1.attestation.AttestationOuterClass
        .internal_static_grafeas_v1beta1_attestation_GenericSignedAttestation_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return io.grafeas.v1beta1.attestation.AttestationOuterClass
        .internal_static_grafeas_v1beta1_attestation_GenericSignedAttestation_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            io.grafeas.v1beta1.attestation.GenericSignedAttestation.class,
            io.grafeas.v1beta1.attestation.GenericSignedAttestation.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * Type of the attestation plaintext that was signed.
   * </pre>
   *
   * Protobuf enum {@code grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType}
   */
  public enum ContentType implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * `ContentType` is not set.
     * </pre>
     *
     * <code>CONTENT_TYPE_UNSPECIFIED = 0;</code>
     */
    CONTENT_TYPE_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * Atomic format attestation signature. See
     * https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md
     * The payload extracted in `plaintext` is a JSON blob conforming to the
     * linked schema.
     * </pre>
     *
     * <code>SIMPLE_SIGNING_JSON = 1;</code>
     */
    SIMPLE_SIGNING_JSON(1),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * `ContentType` is not set.
     * </pre>
     *
     * <code>CONTENT_TYPE_UNSPECIFIED = 0;</code>
     */
    public static final int CONTENT_TYPE_UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * Atomic format attestation signature. See
     * https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md
     * The payload extracted in `plaintext` is a JSON blob conforming to the
     * linked schema.
     * </pre>
     *
     * <code>SIMPLE_SIGNING_JSON = 1;</code>
     */
    public static final int SIMPLE_SIGNING_JSON_VALUE = 1;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static ContentType valueOf(int value) {
      return forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static ContentType forNumber(int value) {
      switch (value) {
        case 0:
          return CONTENT_TYPE_UNSPECIFIED;
        case 1:
          return SIMPLE_SIGNING_JSON;
        default:
          return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<ContentType> internalGetValueMap() {
      return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<ContentType> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<ContentType>() {
          public ContentType findValueByNumber(int number) {
            return ContentType.forNumber(number);
          }
        };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalStateException(
            "Can't get the descriptor of an unrecognized enum value.");
      }
      return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
      return getDescriptor();
    }

    public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
      return io.grafeas.v1beta1.attestation.GenericSignedAttestation.getDescriptor()
          .getEnumTypes()
          .get(0);
    }

    private static final ContentType[] VALUES = values();

    public static ContentType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private ContentType(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType)
  }

  public static final int CONTENT_TYPE_FIELD_NUMBER = 1;
  private int contentType_;
  /**
   *
   *
   * <pre>
   * Type (for example schema) of the attestation payload that was signed.
   * The verifier must ensure that the provided type is one that the verifier
   * supports, and that the attestation payload is a valid instantiation of that
   * type (for example by validating a JSON schema).
   * </pre>
   *
   * <code>.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType content_type = 1;
   * </code>
   *
   * @return The enum numeric value on the wire for contentType.
   */
  @java.lang.Override
  public int getContentTypeValue() {
    return contentType_;
  }
  /**
   *
   *
   * <pre>
   * Type (for example schema) of the attestation payload that was signed.
   * The verifier must ensure that the provided type is one that the verifier
   * supports, and that the attestation payload is a valid instantiation of that
   * type (for example by validating a JSON schema).
   * </pre>
   *
   * <code>.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType content_type = 1;
   * </code>
   *
   * @return The contentType.
   */
  @java.lang.Override
  public io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType getContentType() {
    @SuppressWarnings("deprecation")
    io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType result =
        io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType.valueOf(contentType_);
    return result == null
        ? io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType.UNRECOGNIZED
        : result;
  }

  public static final int SERIALIZED_PAYLOAD_FIELD_NUMBER = 2;
  private com.google.protobuf.ByteString serializedPayload_;
  /**
   *
   *
   * <pre>
   * The serialized payload that is verified by one or more `signatures`.
   * The encoding and semantic meaning of this payload must match what is set in
   * `content_type`.
   * </pre>
   *
   * <code>bytes serialized_payload = 2;</code>
   *
   * @return The serializedPayload.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getSerializedPayload() {
    return serializedPayload_;
  }

  public static final int SIGNATURES_FIELD_NUMBER = 3;
  private java.util.List<io.grafeas.v1beta1.common.Signature> signatures_;
  /**
   *
   *
   * <pre>
   * One or more signatures over `serialized_payload`.  Verifier implementations
   * should consider this attestation message verified if at least one
   * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
   * for more details on signature structure and verification.
   * </pre>
   *
   * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
   */
  @java.lang.Override
  public java.util.List<io.grafeas.v1beta1.common.Signature> getSignaturesList() {
    return signatures_;
  }
  /**
   *
   *
   * <pre>
   * One or more signatures over `serialized_payload`.  Verifier implementations
   * should consider this attestation message verified if at least one
   * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
   * for more details on signature structure and verification.
   * </pre>
   *
   * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
   */
  @java.lang.Override
  public java.util.List<? extends io.grafeas.v1beta1.common.SignatureOrBuilder>
      getSignaturesOrBuilderList() {
    return signatures_;
  }
  /**
   *
   *
   * <pre>
   * One or more signatures over `serialized_payload`.  Verifier implementations
   * should consider this attestation message verified if at least one
   * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
   * for more details on signature structure and verification.
   * </pre>
   *
   * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
   */
  @java.lang.Override
  public int getSignaturesCount() {
    return signatures_.size();
  }
  /**
   *
   *
   * <pre>
   * One or more signatures over `serialized_payload`.  Verifier implementations
   * should consider this attestation message verified if at least one
   * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
   * for more details on signature structure and verification.
   * </pre>
   *
   * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
   */
  @java.lang.Override
  public io.grafeas.v1beta1.common.Signature getSignatures(int index) {
    return signatures_.get(index);
  }
  /**
   *
   *
   * <pre>
   * One or more signatures over `serialized_payload`.  Verifier implementations
   * should consider this attestation message verified if at least one
   * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
   * for more details on signature structure and verification.
   * </pre>
   *
   * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
   */
  @java.lang.Override
  public io.grafeas.v1beta1.common.SignatureOrBuilder getSignaturesOrBuilder(int index) {
    return signatures_.get(index);
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (contentType_
        != io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType
            .CONTENT_TYPE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(1, contentType_);
    }
    if (!serializedPayload_.isEmpty()) {
      output.writeBytes(2, serializedPayload_);
    }
    for (int i = 0; i < signatures_.size(); i++) {
      output.writeMessage(3, signatures_.get(i));
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (contentType_
        != io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType
            .CONTENT_TYPE_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, contentType_);
    }
    if (!serializedPayload_.isEmpty()) {
      size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, serializedPayload_);
    }
    for (int i = 0; i < signatures_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, signatures_.get(i));
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof io.grafeas.v1beta1.attestation.GenericSignedAttestation)) {
      return super.equals(obj);
    }
    io.grafeas.v1beta1.attestation.GenericSignedAttestation other =
        (io.grafeas.v1beta1.attestation.GenericSignedAttestation) obj;

    if (contentType_ != other.contentType_) return false;
    if (!getSerializedPayload().equals(other.getSerializedPayload())) return false;
    if (!getSignaturesList().equals(other.getSignaturesList())) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + CONTENT_TYPE_FIELD_NUMBER;
    hash = (53 * hash) + contentType_;
    hash = (37 * hash) + SERIALIZED_PAYLOAD_FIELD_NUMBER;
    hash = (53 * hash) + getSerializedPayload().hashCode();
    if (getSignaturesCount() > 0) {
      hash = (37 * hash) + SIGNATURES_FIELD_NUMBER;
      hash = (53 * hash) + getSignaturesList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(
      io.grafeas.v1beta1.attestation.GenericSignedAttestation prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * An attestation wrapper that uses the Grafeas `Signature` message.
   * This attestation must define the `serialized_payload` that the `signatures`
   * verify and any metadata necessary to interpret that plaintext.  The
   * signatures should always be over the `serialized_payload` bytestring.
   * </pre>
   *
   * Protobuf type {@code grafeas.v1beta1.attestation.GenericSignedAttestation}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:grafeas.v1beta1.attestation.GenericSignedAttestation)
      io.grafeas.v1beta1.attestation.GenericSignedAttestationOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return io.grafeas.v1beta1.attestation.AttestationOuterClass
          .internal_static_grafeas_v1beta1_attestation_GenericSignedAttestation_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return io.grafeas.v1beta1.attestation.AttestationOuterClass
          .internal_static_grafeas_v1beta1_attestation_GenericSignedAttestation_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              io.grafeas.v1beta1.attestation.GenericSignedAttestation.class,
              io.grafeas.v1beta1.attestation.GenericSignedAttestation.Builder.class);
    }

    // Construct using io.grafeas.v1beta1.attestation.GenericSignedAttestation.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
        getSignaturesFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      contentType_ = 0;

      serializedPayload_ = com.google.protobuf.ByteString.EMPTY;

      if (signaturesBuilder_ == null) {
        signatures_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
      } else {
        signaturesBuilder_.clear();
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return io.grafeas.v1beta1.attestation.AttestationOuterClass
          .internal_static_grafeas_v1beta1_attestation_GenericSignedAttestation_descriptor;
    }

    @java.lang.Override
    public io.grafeas.v1beta1.attestation.GenericSignedAttestation getDefaultInstanceForType() {
      return io.grafeas.v1beta1.attestation.GenericSignedAttestation.getDefaultInstance();
    }

    @java.lang.Override
    public io.grafeas.v1beta1.attestation.GenericSignedAttestation build() {
      io.grafeas.v1beta1.attestation.GenericSignedAttestation result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public io.grafeas.v1beta1.attestation.GenericSignedAttestation buildPartial() {
      io.grafeas.v1beta1.attestation.GenericSignedAttestation result =
          new io.grafeas.v1beta1.attestation.GenericSignedAttestation(this);
      int from_bitField0_ = bitField0_;
      result.contentType_ = contentType_;
      result.serializedPayload_ = serializedPayload_;
      if (signaturesBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          signatures_ = java.util.Collections.unmodifiableList(signatures_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.signatures_ = signatures_;
      } else {
        result.signatures_ = signaturesBuilder_.build();
      }
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof io.grafeas.v1beta1.attestation.GenericSignedAttestation) {
        return mergeFrom((io.grafeas.v1beta1.attestation.GenericSignedAttestation) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(io.grafeas.v1beta1.attestation.GenericSignedAttestation other) {
      if (other == io.grafeas.v1beta1.attestation.GenericSignedAttestation.getDefaultInstance())
        return this;
      if (other.contentType_ != 0) {
        setContentTypeValue(other.getContentTypeValue());
      }
      if (other.getSerializedPayload() != com.google.protobuf.ByteString.EMPTY) {
        setSerializedPayload(other.getSerializedPayload());
      }
      if (signaturesBuilder_ == null) {
        if (!other.signatures_.isEmpty()) {
          if (signatures_.isEmpty()) {
            signatures_ = other.signatures_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureSignaturesIsMutable();
            signatures_.addAll(other.signatures_);
          }
          onChanged();
        }
      } else {
        if (!other.signatures_.isEmpty()) {
          if (signaturesBuilder_.isEmpty()) {
            signaturesBuilder_.dispose();
            signaturesBuilder_ = null;
            signatures_ = other.signatures_;
            bitField0_ = (bitField0_ & ~0x00000001);
            signaturesBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getSignaturesFieldBuilder()
                    : null;
          } else {
            signaturesBuilder_.addAllMessages(other.signatures_);
          }
        }
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      io.grafeas.v1beta1.attestation.GenericSignedAttestation parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage =
            (io.grafeas.v1beta1.attestation.GenericSignedAttestation) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int bitField0_;

    private int contentType_ = 0;
    /**
     *
     *
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType content_type = 1;
     * </code>
     *
     * @return The enum numeric value on the wire for contentType.
     */
    @java.lang.Override
    public int getContentTypeValue() {
      return contentType_;
    }
    /**
     *
     *
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType content_type = 1;
     * </code>
     *
     * @param value The enum numeric value on the wire for contentType to set.
     * @return This builder for chaining.
     */
    public Builder setContentTypeValue(int value) {

      contentType_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType content_type = 1;
     * </code>
     *
     * @return The contentType.
     */
    @java.lang.Override
    public io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType getContentType() {
      @SuppressWarnings("deprecation")
      io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType result =
          io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType.valueOf(contentType_);
      return result == null
          ? io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType content_type = 1;
     * </code>
     *
     * @param value The contentType to set.
     * @return This builder for chaining.
     */
    public Builder setContentType(
        io.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType value) {
      if (value == null) {
        throw new NullPointerException();
      }

      contentType_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.GenericSignedAttestation.ContentType content_type = 1;
     * </code>
     *
     * @return This builder for chaining.
     */
    public Builder clearContentType() {

      contentType_ = 0;
      onChanged();
      return this;
    }

    private com.google.protobuf.ByteString serializedPayload_ =
        com.google.protobuf.ByteString.EMPTY;
    /**
     *
     *
     * <pre>
     * The serialized payload that is verified by one or more `signatures`.
     * The encoding and semantic meaning of this payload must match what is set in
     * `content_type`.
     * </pre>
     *
     * <code>bytes serialized_payload = 2;</code>
     *
     * @return The serializedPayload.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getSerializedPayload() {
      return serializedPayload_;
    }
    /**
     *
     *
     * <pre>
     * The serialized payload that is verified by one or more `signatures`.
     * The encoding and semantic meaning of this payload must match what is set in
     * `content_type`.
     * </pre>
     *
     * <code>bytes serialized_payload = 2;</code>
     *
     * @param value The serializedPayload to set.
     * @return This builder for chaining.
     */
    public Builder setSerializedPayload(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }

      serializedPayload_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The serialized payload that is verified by one or more `signatures`.
     * The encoding and semantic meaning of this payload must match what is set in
     * `content_type`.
     * </pre>
     *
     * <code>bytes serialized_payload = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearSerializedPayload() {

      serializedPayload_ = getDefaultInstance().getSerializedPayload();
      onChanged();
      return this;
    }

    private java.util.List<io.grafeas.v1beta1.common.Signature> signatures_ =
        java.util.Collections.emptyList();

    private void ensureSignaturesIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        signatures_ = new java.util.ArrayList<io.grafeas.v1beta1.common.Signature>(signatures_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            io.grafeas.v1beta1.common.Signature,
            io.grafeas.v1beta1.common.Signature.Builder,
            io.grafeas.v1beta1.common.SignatureOrBuilder>
        signaturesBuilder_;

    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public java.util.List<io.grafeas.v1beta1.common.Signature> getSignaturesList() {
      if (signaturesBuilder_ == null) {
        return java.util.Collections.unmodifiableList(signatures_);
      } else {
        return signaturesBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public int getSignaturesCount() {
      if (signaturesBuilder_ == null) {
        return signatures_.size();
      } else {
        return signaturesBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public io.grafeas.v1beta1.common.Signature getSignatures(int index) {
      if (signaturesBuilder_ == null) {
        return signatures_.get(index);
      } else {
        return signaturesBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder setSignatures(int index, io.grafeas.v1beta1.common.Signature value) {
      if (signaturesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSignaturesIsMutable();
        signatures_.set(index, value);
        onChanged();
      } else {
        signaturesBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder setSignatures(
        int index, io.grafeas.v1beta1.common.Signature.Builder builderForValue) {
      if (signaturesBuilder_ == null) {
        ensureSignaturesIsMutable();
        signatures_.set(index, builderForValue.build());
        onChanged();
      } else {
        signaturesBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder addSignatures(io.grafeas.v1beta1.common.Signature value) {
      if (signaturesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSignaturesIsMutable();
        signatures_.add(value);
        onChanged();
      } else {
        signaturesBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder addSignatures(int index, io.grafeas.v1beta1.common.Signature value) {
      if (signaturesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSignaturesIsMutable();
        signatures_.add(index, value);
        onChanged();
      } else {
        signaturesBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder addSignatures(io.grafeas.v1beta1.common.Signature.Builder builderForValue) {
      if (signaturesBuilder_ == null) {
        ensureSignaturesIsMutable();
        signatures_.add(builderForValue.build());
        onChanged();
      } else {
        signaturesBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder addSignatures(
        int index, io.grafeas.v1beta1.common.Signature.Builder builderForValue) {
      if (signaturesBuilder_ == null) {
        ensureSignaturesIsMutable();
        signatures_.add(index, builderForValue.build());
        onChanged();
      } else {
        signaturesBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder addAllSignatures(
        java.lang.Iterable<? extends io.grafeas.v1beta1.common.Signature> values) {
      if (signaturesBuilder_ == null) {
        ensureSignaturesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, signatures_);
        onChanged();
      } else {
        signaturesBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder clearSignatures() {
      if (signaturesBuilder_ == null) {
        signatures_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        signaturesBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public Builder removeSignatures(int index) {
      if (signaturesBuilder_ == null) {
        ensureSignaturesIsMutable();
        signatures_.remove(index);
        onChanged();
      } else {
        signaturesBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public io.grafeas.v1beta1.common.Signature.Builder getSignaturesBuilder(int index) {
      return getSignaturesFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public io.grafeas.v1beta1.common.SignatureOrBuilder getSignaturesOrBuilder(int index) {
      if (signaturesBuilder_ == null) {
        return signatures_.get(index);
      } else {
        return signaturesBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public java.util.List<? extends io.grafeas.v1beta1.common.SignatureOrBuilder>
        getSignaturesOrBuilderList() {
      if (signaturesBuilder_ != null) {
        return signaturesBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(signatures_);
      }
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public io.grafeas.v1beta1.common.Signature.Builder addSignaturesBuilder() {
      return getSignaturesFieldBuilder()
          .addBuilder(io.grafeas.v1beta1.common.Signature.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public io.grafeas.v1beta1.common.Signature.Builder addSignaturesBuilder(int index) {
      return getSignaturesFieldBuilder()
          .addBuilder(index, io.grafeas.v1beta1.common.Signature.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * One or more signatures over `serialized_payload`.  Verifier implementations
     * should consider this attestation message verified if at least one
     * `signature` verifies `serialized_payload`.  See `Signature` in common.proto
     * for more details on signature structure and verification.
     * </pre>
     *
     * <code>repeated .grafeas.v1beta1.Signature signatures = 3;</code>
     */
    public java.util.List<io.grafeas.v1beta1.common.Signature.Builder> getSignaturesBuilderList() {
      return getSignaturesFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            io.grafeas.v1beta1.common.Signature,
            io.grafeas.v1beta1.common.Signature.Builder,
            io.grafeas.v1beta1.common.SignatureOrBuilder>
        getSignaturesFieldBuilder() {
      if (signaturesBuilder_ == null) {
        signaturesBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                io.grafeas.v1beta1.common.Signature,
                io.grafeas.v1beta1.common.Signature.Builder,
                io.grafeas.v1beta1.common.SignatureOrBuilder>(
                signatures_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
        signatures_ = null;
      }
      return signaturesBuilder_;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:grafeas.v1beta1.attestation.GenericSignedAttestation)
  }

  // @@protoc_insertion_point(class_scope:grafeas.v1beta1.attestation.GenericSignedAttestation)
  private static final io.grafeas.v1beta1.attestation.GenericSignedAttestation DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new io.grafeas.v1beta1.attestation.GenericSignedAttestation();
  }

  public static io.grafeas.v1beta1.attestation.GenericSignedAttestation getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<GenericSignedAttestation> PARSER =
      new com.google.protobuf.AbstractParser<GenericSignedAttestation>() {
        @java.lang.Override
        public GenericSignedAttestation parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          return new GenericSignedAttestation(input, extensionRegistry);
        }
      };

  public static com.google.protobuf.Parser<GenericSignedAttestation> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<GenericSignedAttestation> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public io.grafeas.v1beta1.attestation.GenericSignedAttestation getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
