// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/photos/library/v1/photos_library.proto

package com.google.photos.library.v1.proto;

/**
 *
 *
 * <pre>
 * Specifies a position in an album.
 * </pre>
 *
 * Protobuf type {@code google.photos.library.v1.AlbumPosition}
 */
public final class AlbumPosition extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.photos.library.v1.AlbumPosition)
    AlbumPositionOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use AlbumPosition.newBuilder() to construct.
  private AlbumPosition(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private AlbumPosition() {
    position_ = 0;
  }

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

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.photos.library.v1.proto.LibraryServiceProto
        .internal_static_google_photos_library_v1_AlbumPosition_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.photos.library.v1.proto.LibraryServiceProto
        .internal_static_google_photos_library_v1_AlbumPosition_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.photos.library.v1.proto.AlbumPosition.class,
            com.google.photos.library.v1.proto.AlbumPosition.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * Possible positions in an album.
   * </pre>
   *
   * Protobuf enum {@code google.photos.library.v1.AlbumPosition.PositionType}
   */
  public enum PositionType implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * Default value if this enum isn't set.
     * </pre>
     *
     * <code>POSITION_TYPE_UNSPECIFIED = 0;</code>
     */
    POSITION_TYPE_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * At the beginning of the album.
     * </pre>
     *
     * <code>FIRST_IN_ALBUM = 1;</code>
     */
    FIRST_IN_ALBUM(1),
    /**
     *
     *
     * <pre>
     * At the end of the album.
     * </pre>
     *
     * <code>LAST_IN_ALBUM = 2;</code>
     */
    LAST_IN_ALBUM(2),
    /**
     *
     *
     * <pre>
     * After a media item.
     * </pre>
     *
     * <code>AFTER_MEDIA_ITEM = 3;</code>
     */
    AFTER_MEDIA_ITEM(3),
    /**
     *
     *
     * <pre>
     * After an enrichment item.
     * </pre>
     *
     * <code>AFTER_ENRICHMENT_ITEM = 4;</code>
     */
    AFTER_ENRICHMENT_ITEM(4),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * Default value if this enum isn't set.
     * </pre>
     *
     * <code>POSITION_TYPE_UNSPECIFIED = 0;</code>
     */
    public static final int POSITION_TYPE_UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * At the beginning of the album.
     * </pre>
     *
     * <code>FIRST_IN_ALBUM = 1;</code>
     */
    public static final int FIRST_IN_ALBUM_VALUE = 1;
    /**
     *
     *
     * <pre>
     * At the end of the album.
     * </pre>
     *
     * <code>LAST_IN_ALBUM = 2;</code>
     */
    public static final int LAST_IN_ALBUM_VALUE = 2;
    /**
     *
     *
     * <pre>
     * After a media item.
     * </pre>
     *
     * <code>AFTER_MEDIA_ITEM = 3;</code>
     */
    public static final int AFTER_MEDIA_ITEM_VALUE = 3;
    /**
     *
     *
     * <pre>
     * After an enrichment item.
     * </pre>
     *
     * <code>AFTER_ENRICHMENT_ITEM = 4;</code>
     */
    public static final int AFTER_ENRICHMENT_ITEM_VALUE = 4;

    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 PositionType 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 PositionType forNumber(int value) {
      switch (value) {
        case 0:
          return POSITION_TYPE_UNSPECIFIED;
        case 1:
          return FIRST_IN_ALBUM;
        case 2:
          return LAST_IN_ALBUM;
        case 3:
          return AFTER_MEDIA_ITEM;
        case 4:
          return AFTER_ENRICHMENT_ITEM;
        default:
          return null;
      }
    }

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

    private static final com.google.protobuf.Internal.EnumLiteMap<PositionType> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<PositionType>() {
          public PositionType findValueByNumber(int number) {
            return PositionType.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 com.google.photos.library.v1.proto.AlbumPosition.getDescriptor().getEnumTypes().get(0);
    }

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

    public static PositionType 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 PositionType(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.photos.library.v1.AlbumPosition.PositionType)
  }

  private int relativeItemCase_ = 0;
  private java.lang.Object relativeItem_;

  public enum RelativeItemCase
      implements
          com.google.protobuf.Internal.EnumLite,
          com.google.protobuf.AbstractMessage.InternalOneOfEnum {
    RELATIVE_MEDIA_ITEM_ID(2),
    RELATIVE_ENRICHMENT_ITEM_ID(3),
    RELATIVEITEM_NOT_SET(0);
    private final int value;

    private RelativeItemCase(int value) {
      this.value = value;
    }
    /**
     * @param value The number of the enum to look for.
     * @return The enum associated with the given number.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static RelativeItemCase valueOf(int value) {
      return forNumber(value);
    }

    public static RelativeItemCase forNumber(int value) {
      switch (value) {
        case 2:
          return RELATIVE_MEDIA_ITEM_ID;
        case 3:
          return RELATIVE_ENRICHMENT_ITEM_ID;
        case 0:
          return RELATIVEITEM_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public RelativeItemCase getRelativeItemCase() {
    return RelativeItemCase.forNumber(relativeItemCase_);
  }

  public static final int POSITION_FIELD_NUMBER = 1;
  private int position_ = 0;
  /**
   *
   *
   * <pre>
   * Type of position, for a media or enrichment item.
   * </pre>
   *
   * <code>.google.photos.library.v1.AlbumPosition.PositionType position = 1;</code>
   *
   * @return The enum numeric value on the wire for position.
   */
  @java.lang.Override
  public int getPositionValue() {
    return position_;
  }
  /**
   *
   *
   * <pre>
   * Type of position, for a media or enrichment item.
   * </pre>
   *
   * <code>.google.photos.library.v1.AlbumPosition.PositionType position = 1;</code>
   *
   * @return The position.
   */
  @java.lang.Override
  public com.google.photos.library.v1.proto.AlbumPosition.PositionType getPosition() {
    com.google.photos.library.v1.proto.AlbumPosition.PositionType result =
        com.google.photos.library.v1.proto.AlbumPosition.PositionType.forNumber(position_);
    return result == null
        ? com.google.photos.library.v1.proto.AlbumPosition.PositionType.UNRECOGNIZED
        : result;
  }

  public static final int RELATIVE_MEDIA_ITEM_ID_FIELD_NUMBER = 2;
  /**
   *
   *
   * <pre>
   * The media item to which the position is relative to.
   * Only used when position type is AFTER_MEDIA_ITEM.
   * </pre>
   *
   * <code>string relative_media_item_id = 2;</code>
   *
   * @return Whether the relativeMediaItemId field is set.
   */
  public boolean hasRelativeMediaItemId() {
    return relativeItemCase_ == 2;
  }
  /**
   *
   *
   * <pre>
   * The media item to which the position is relative to.
   * Only used when position type is AFTER_MEDIA_ITEM.
   * </pre>
   *
   * <code>string relative_media_item_id = 2;</code>
   *
   * @return The relativeMediaItemId.
   */
  public java.lang.String getRelativeMediaItemId() {
    java.lang.Object ref = "";
    if (relativeItemCase_ == 2) {
      ref = relativeItem_;
    }
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (relativeItemCase_ == 2) {
        relativeItem_ = s;
      }
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The media item to which the position is relative to.
   * Only used when position type is AFTER_MEDIA_ITEM.
   * </pre>
   *
   * <code>string relative_media_item_id = 2;</code>
   *
   * @return The bytes for relativeMediaItemId.
   */
  public com.google.protobuf.ByteString getRelativeMediaItemIdBytes() {
    java.lang.Object ref = "";
    if (relativeItemCase_ == 2) {
      ref = relativeItem_;
    }
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      if (relativeItemCase_ == 2) {
        relativeItem_ = b;
      }
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int RELATIVE_ENRICHMENT_ITEM_ID_FIELD_NUMBER = 3;
  /**
   *
   *
   * <pre>
   * The enrichment item to which the position is relative to.
   * Only used when position type is AFTER_ENRICHMENT_ITEM.
   * </pre>
   *
   * <code>string relative_enrichment_item_id = 3;</code>
   *
   * @return Whether the relativeEnrichmentItemId field is set.
   */
  public boolean hasRelativeEnrichmentItemId() {
    return relativeItemCase_ == 3;
  }
  /**
   *
   *
   * <pre>
   * The enrichment item to which the position is relative to.
   * Only used when position type is AFTER_ENRICHMENT_ITEM.
   * </pre>
   *
   * <code>string relative_enrichment_item_id = 3;</code>
   *
   * @return The relativeEnrichmentItemId.
   */
  public java.lang.String getRelativeEnrichmentItemId() {
    java.lang.Object ref = "";
    if (relativeItemCase_ == 3) {
      ref = relativeItem_;
    }
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (relativeItemCase_ == 3) {
        relativeItem_ = s;
      }
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The enrichment item to which the position is relative to.
   * Only used when position type is AFTER_ENRICHMENT_ITEM.
   * </pre>
   *
   * <code>string relative_enrichment_item_id = 3;</code>
   *
   * @return The bytes for relativeEnrichmentItemId.
   */
  public com.google.protobuf.ByteString getRelativeEnrichmentItemIdBytes() {
    java.lang.Object ref = "";
    if (relativeItemCase_ == 3) {
      ref = relativeItem_;
    }
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      if (relativeItemCase_ == 3) {
        relativeItem_ = b;
      }
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  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 (position_
        != com.google.photos.library.v1.proto.AlbumPosition.PositionType.POSITION_TYPE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(1, position_);
    }
    if (relativeItemCase_ == 2) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, relativeItem_);
    }
    if (relativeItemCase_ == 3) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, relativeItem_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (position_
        != com.google.photos.library.v1.proto.AlbumPosition.PositionType.POSITION_TYPE_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, position_);
    }
    if (relativeItemCase_ == 2) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, relativeItem_);
    }
    if (relativeItemCase_ == 3) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, relativeItem_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.photos.library.v1.proto.AlbumPosition)) {
      return super.equals(obj);
    }
    com.google.photos.library.v1.proto.AlbumPosition other =
        (com.google.photos.library.v1.proto.AlbumPosition) obj;

    if (position_ != other.position_) return false;
    if (!getRelativeItemCase().equals(other.getRelativeItemCase())) return false;
    switch (relativeItemCase_) {
      case 2:
        if (!getRelativeMediaItemId().equals(other.getRelativeMediaItemId())) return false;
        break;
      case 3:
        if (!getRelativeEnrichmentItemId().equals(other.getRelativeEnrichmentItemId()))
          return false;
        break;
      case 0:
      default:
    }
    if (!getUnknownFields().equals(other.getUnknownFields())) 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) + POSITION_FIELD_NUMBER;
    hash = (53 * hash) + position_;
    switch (relativeItemCase_) {
      case 2:
        hash = (37 * hash) + RELATIVE_MEDIA_ITEM_ID_FIELD_NUMBER;
        hash = (53 * hash) + getRelativeMediaItemId().hashCode();
        break;
      case 3:
        hash = (37 * hash) + RELATIVE_ENRICHMENT_ITEM_ID_FIELD_NUMBER;
        hash = (53 * hash) + getRelativeEnrichmentItemId().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.photos.library.v1.proto.AlbumPosition parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition 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 com.google.photos.library.v1.proto.AlbumPosition parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition 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 com.google.photos.library.v1.proto.AlbumPosition parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.photos.library.v1.proto.AlbumPosition 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(com.google.photos.library.v1.proto.AlbumPosition 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>
   * Specifies a position in an album.
   * </pre>
   *
   * Protobuf type {@code google.photos.library.v1.AlbumPosition}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.photos.library.v1.AlbumPosition)
      com.google.photos.library.v1.proto.AlbumPositionOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.photos.library.v1.proto.LibraryServiceProto
          .internal_static_google_photos_library_v1_AlbumPosition_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.photos.library.v1.proto.LibraryServiceProto
          .internal_static_google_photos_library_v1_AlbumPosition_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.photos.library.v1.proto.AlbumPosition.class,
              com.google.photos.library.v1.proto.AlbumPosition.Builder.class);
    }

    // Construct using com.google.photos.library.v1.proto.AlbumPosition.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      position_ = 0;
      relativeItemCase_ = 0;
      relativeItem_ = null;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.photos.library.v1.proto.LibraryServiceProto
          .internal_static_google_photos_library_v1_AlbumPosition_descriptor;
    }

    @java.lang.Override
    public com.google.photos.library.v1.proto.AlbumPosition getDefaultInstanceForType() {
      return com.google.photos.library.v1.proto.AlbumPosition.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.photos.library.v1.proto.AlbumPosition build() {
      com.google.photos.library.v1.proto.AlbumPosition result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.photos.library.v1.proto.AlbumPosition buildPartial() {
      com.google.photos.library.v1.proto.AlbumPosition result =
          new com.google.photos.library.v1.proto.AlbumPosition(this);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      buildPartialOneofs(result);
      onBuilt();
      return result;
    }

    private void buildPartial0(com.google.photos.library.v1.proto.AlbumPosition result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.position_ = position_;
      }
    }

    private void buildPartialOneofs(com.google.photos.library.v1.proto.AlbumPosition result) {
      result.relativeItemCase_ = relativeItemCase_;
      result.relativeItem_ = this.relativeItem_;
    }

    @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 com.google.photos.library.v1.proto.AlbumPosition) {
        return mergeFrom((com.google.photos.library.v1.proto.AlbumPosition) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.photos.library.v1.proto.AlbumPosition other) {
      if (other == com.google.photos.library.v1.proto.AlbumPosition.getDefaultInstance())
        return this;
      if (other.position_ != 0) {
        setPositionValue(other.getPositionValue());
      }
      switch (other.getRelativeItemCase()) {
        case RELATIVE_MEDIA_ITEM_ID:
          {
            relativeItemCase_ = 2;
            relativeItem_ = other.relativeItem_;
            onChanged();
            break;
          }
        case RELATIVE_ENRICHMENT_ITEM_ID:
          {
            relativeItemCase_ = 3;
            relativeItem_ = other.relativeItem_;
            onChanged();
            break;
          }
        case RELATIVEITEM_NOT_SET:
          {
            break;
          }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      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 {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 8:
              {
                position_ = input.readEnum();
                bitField0_ |= 0x00000001;
                break;
              } // case 8
            case 18:
              {
                java.lang.String s = input.readStringRequireUtf8();
                relativeItemCase_ = 2;
                relativeItem_ = s;
                break;
              } // case 18
            case 26:
              {
                java.lang.String s = input.readStringRequireUtf8();
                relativeItemCase_ = 3;
                relativeItem_ = s;
                break;
              } // case 26
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int relativeItemCase_ = 0;
    private java.lang.Object relativeItem_;

    public RelativeItemCase getRelativeItemCase() {
      return RelativeItemCase.forNumber(relativeItemCase_);
    }

    public Builder clearRelativeItem() {
      relativeItemCase_ = 0;
      relativeItem_ = null;
      onChanged();
      return this;
    }

    private int bitField0_;

    private int position_ = 0;
    /**
     *
     *
     * <pre>
     * Type of position, for a media or enrichment item.
     * </pre>
     *
     * <code>.google.photos.library.v1.AlbumPosition.PositionType position = 1;</code>
     *
     * @return The enum numeric value on the wire for position.
     */
    @java.lang.Override
    public int getPositionValue() {
      return position_;
    }
    /**
     *
     *
     * <pre>
     * Type of position, for a media or enrichment item.
     * </pre>
     *
     * <code>.google.photos.library.v1.AlbumPosition.PositionType position = 1;</code>
     *
     * @param value The enum numeric value on the wire for position to set.
     * @return This builder for chaining.
     */
    public Builder setPositionValue(int value) {
      position_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Type of position, for a media or enrichment item.
     * </pre>
     *
     * <code>.google.photos.library.v1.AlbumPosition.PositionType position = 1;</code>
     *
     * @return The position.
     */
    @java.lang.Override
    public com.google.photos.library.v1.proto.AlbumPosition.PositionType getPosition() {
      com.google.photos.library.v1.proto.AlbumPosition.PositionType result =
          com.google.photos.library.v1.proto.AlbumPosition.PositionType.forNumber(position_);
      return result == null
          ? com.google.photos.library.v1.proto.AlbumPosition.PositionType.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * Type of position, for a media or enrichment item.
     * </pre>
     *
     * <code>.google.photos.library.v1.AlbumPosition.PositionType position = 1;</code>
     *
     * @param value The position to set.
     * @return This builder for chaining.
     */
    public Builder setPosition(
        com.google.photos.library.v1.proto.AlbumPosition.PositionType value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000001;
      position_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Type of position, for a media or enrichment item.
     * </pre>
     *
     * <code>.google.photos.library.v1.AlbumPosition.PositionType position = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearPosition() {
      bitField0_ = (bitField0_ & ~0x00000001);
      position_ = 0;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The media item to which the position is relative to.
     * Only used when position type is AFTER_MEDIA_ITEM.
     * </pre>
     *
     * <code>string relative_media_item_id = 2;</code>
     *
     * @return Whether the relativeMediaItemId field is set.
     */
    @java.lang.Override
    public boolean hasRelativeMediaItemId() {
      return relativeItemCase_ == 2;
    }
    /**
     *
     *
     * <pre>
     * The media item to which the position is relative to.
     * Only used when position type is AFTER_MEDIA_ITEM.
     * </pre>
     *
     * <code>string relative_media_item_id = 2;</code>
     *
     * @return The relativeMediaItemId.
     */
    @java.lang.Override
    public java.lang.String getRelativeMediaItemId() {
      java.lang.Object ref = "";
      if (relativeItemCase_ == 2) {
        ref = relativeItem_;
      }
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (relativeItemCase_ == 2) {
          relativeItem_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The media item to which the position is relative to.
     * Only used when position type is AFTER_MEDIA_ITEM.
     * </pre>
     *
     * <code>string relative_media_item_id = 2;</code>
     *
     * @return The bytes for relativeMediaItemId.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getRelativeMediaItemIdBytes() {
      java.lang.Object ref = "";
      if (relativeItemCase_ == 2) {
        ref = relativeItem_;
      }
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        if (relativeItemCase_ == 2) {
          relativeItem_ = b;
        }
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The media item to which the position is relative to.
     * Only used when position type is AFTER_MEDIA_ITEM.
     * </pre>
     *
     * <code>string relative_media_item_id = 2;</code>
     *
     * @param value The relativeMediaItemId to set.
     * @return This builder for chaining.
     */
    public Builder setRelativeMediaItemId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      relativeItemCase_ = 2;
      relativeItem_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The media item to which the position is relative to.
     * Only used when position type is AFTER_MEDIA_ITEM.
     * </pre>
     *
     * <code>string relative_media_item_id = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearRelativeMediaItemId() {
      if (relativeItemCase_ == 2) {
        relativeItemCase_ = 0;
        relativeItem_ = null;
        onChanged();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The media item to which the position is relative to.
     * Only used when position type is AFTER_MEDIA_ITEM.
     * </pre>
     *
     * <code>string relative_media_item_id = 2;</code>
     *
     * @param value The bytes for relativeMediaItemId to set.
     * @return This builder for chaining.
     */
    public Builder setRelativeMediaItemIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      relativeItemCase_ = 2;
      relativeItem_ = value;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The enrichment item to which the position is relative to.
     * Only used when position type is AFTER_ENRICHMENT_ITEM.
     * </pre>
     *
     * <code>string relative_enrichment_item_id = 3;</code>
     *
     * @return Whether the relativeEnrichmentItemId field is set.
     */
    @java.lang.Override
    public boolean hasRelativeEnrichmentItemId() {
      return relativeItemCase_ == 3;
    }
    /**
     *
     *
     * <pre>
     * The enrichment item to which the position is relative to.
     * Only used when position type is AFTER_ENRICHMENT_ITEM.
     * </pre>
     *
     * <code>string relative_enrichment_item_id = 3;</code>
     *
     * @return The relativeEnrichmentItemId.
     */
    @java.lang.Override
    public java.lang.String getRelativeEnrichmentItemId() {
      java.lang.Object ref = "";
      if (relativeItemCase_ == 3) {
        ref = relativeItem_;
      }
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (relativeItemCase_ == 3) {
          relativeItem_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The enrichment item to which the position is relative to.
     * Only used when position type is AFTER_ENRICHMENT_ITEM.
     * </pre>
     *
     * <code>string relative_enrichment_item_id = 3;</code>
     *
     * @return The bytes for relativeEnrichmentItemId.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getRelativeEnrichmentItemIdBytes() {
      java.lang.Object ref = "";
      if (relativeItemCase_ == 3) {
        ref = relativeItem_;
      }
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        if (relativeItemCase_ == 3) {
          relativeItem_ = b;
        }
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The enrichment item to which the position is relative to.
     * Only used when position type is AFTER_ENRICHMENT_ITEM.
     * </pre>
     *
     * <code>string relative_enrichment_item_id = 3;</code>
     *
     * @param value The relativeEnrichmentItemId to set.
     * @return This builder for chaining.
     */
    public Builder setRelativeEnrichmentItemId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      relativeItemCase_ = 3;
      relativeItem_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The enrichment item to which the position is relative to.
     * Only used when position type is AFTER_ENRICHMENT_ITEM.
     * </pre>
     *
     * <code>string relative_enrichment_item_id = 3;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearRelativeEnrichmentItemId() {
      if (relativeItemCase_ == 3) {
        relativeItemCase_ = 0;
        relativeItem_ = null;
        onChanged();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The enrichment item to which the position is relative to.
     * Only used when position type is AFTER_ENRICHMENT_ITEM.
     * </pre>
     *
     * <code>string relative_enrichment_item_id = 3;</code>
     *
     * @param value The bytes for relativeEnrichmentItemId to set.
     * @return This builder for chaining.
     */
    public Builder setRelativeEnrichmentItemIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      relativeItemCase_ = 3;
      relativeItem_ = value;
      onChanged();
      return this;
    }

    @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:google.photos.library.v1.AlbumPosition)
  }

  // @@protoc_insertion_point(class_scope:google.photos.library.v1.AlbumPosition)
  private static final com.google.photos.library.v1.proto.AlbumPosition DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.photos.library.v1.proto.AlbumPosition();
  }

  public static com.google.photos.library.v1.proto.AlbumPosition getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<AlbumPosition> PARSER =
      new com.google.protobuf.AbstractParser<AlbumPosition>() {
        @java.lang.Override
        public AlbumPosition parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

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

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

  @java.lang.Override
  public com.google.photos.library.v1.proto.AlbumPosition getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
