// 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;
import static com.squareup.wire.Message.Label.REQUIRED;

public final class HeartbeatStat extends Message {

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

  @ProtoField(tag = 1, type = STRING, label = REQUIRED)
  public final String ip;

  @ProtoField(tag = 2, type = BOOL, label = REQUIRED)
  public final Boolean timeout;

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

  public HeartbeatStat(String ip, Boolean timeout, Integer interval_ms) {
    this.ip = ip;
    this.timeout = timeout;
    this.interval_ms = interval_ms;
  }

  private HeartbeatStat(Builder builder) {
    this(builder.ip, builder.timeout, builder.interval_ms);
    setBuilder(builder);
  }

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

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

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

    public String ip;
    public Boolean timeout;
    public Integer interval_ms;

    public Builder() {
    }

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

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

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

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

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