// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: protos-repo/databundle.proto
package org.microg.gms.wearable.databundle;

import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;

import static com.squareup.wire.Message.Datatype.STRING;

public final class DataBundleEntry extends Message {

  public static final String DEFAULT_KEY = "";

  @ProtoField(tag = 1, type = STRING)
  public final String key;

  @ProtoField(tag = 2)
  public final DataBundleTypedValue typedValue;

  public DataBundleEntry(String key, DataBundleTypedValue typedValue) {
    this.key = key;
    this.typedValue = typedValue;
  }

  private DataBundleEntry(Builder builder) {
    this(builder.key, builder.typedValue);
    setBuilder(builder);
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) return true;
    if (!(other instanceof DataBundleEntry)) return false;
    DataBundleEntry o = (DataBundleEntry) other;
    return equals(key, o.key)
        && equals(typedValue, o.typedValue);
  }

  @Override
  public int hashCode() {
    int result = hashCode;
    if (result == 0) {
      result = key != null ? key.hashCode() : 0;
      result = result * 37 + (typedValue != null ? typedValue.hashCode() : 0);
      hashCode = result;
    }
    return result;
  }

  public static final class Builder extends Message.Builder<DataBundleEntry> {

    public String key;
    public DataBundleTypedValue typedValue;

    public Builder() {
    }

    public Builder(DataBundleEntry message) {
      super(message);
      if (message == null) return;
      this.key = message.key;
      this.typedValue = message.typedValue;
    }

    public Builder key(String key) {
      this.key = key;
      return this;
    }

    public Builder typedValue(DataBundleTypedValue typedValue) {
      this.typedValue = typedValue;
      return this;
    }

    @Override
    public DataBundleEntry build() {
      return new DataBundleEntry(this);
    }
  }
}
