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

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

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

public final class HeartbeatConfig extends Message {

  public static final Boolean DEFAULT_UPLOAD_STAT = false;
  public static final String DEFAULT_IP = "";
  public static final Integer DEFAULT_INTERVAL_MS = 0;

  @ProtoField(tag = 1, type = BOOL)
  public final Boolean upload_stat;

  @ProtoField(tag = 2, type = STRING)
  public final String ip;

  @ProtoField(tag = 3, type = INT32)
  public final Integer interval_ms;

  public HeartbeatConfig(Boolean upload_stat, String ip, Integer interval_ms) {
    this.upload_stat = upload_stat;
    this.ip = ip;
    this.interval_ms = interval_ms;
  }

  private HeartbeatConfig(Builder builder) {
    this(builder.upload_stat, builder.ip, builder.interval_ms);
    setBuilder(builder);
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) return true;
    if (!(other instanceof HeartbeatConfig)) return false;
    HeartbeatConfig o = (HeartbeatConfig) other;
    return equals(upload_stat, o.upload_stat)
        && equals(ip, o.ip)
        && equals(interval_ms, o.interval_ms);
  }

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

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

    public Boolean upload_stat;
    public String ip;
    public Integer interval_ms;

    public Builder() {
    }

    public Builder(HeartbeatConfig message) {
      super(message);
      if (message == null) return;
      this.upload_stat = message.upload_stat;
      this.ip = message.ip;
      this.interval_ms = message.interval_ms;
    }

    public Builder upload_stat(Boolean upload_stat) {
      this.upload_stat = upload_stat;
      return this;
    }

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

    public Builder interval_ms(Integer interval_ms) {
      this.interval_ms = interval_ms;
      return this;
    }

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