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

/**
 * MobileSettings class.
 * "u:f", "u:b", "u:s" - multi user devices reporting foreground, background
 * and stopped users.
 * hbping: heatbeat ping interval
 * rmq2v: include explicit stream IDs
 */
public final class Setting extends Message {

  public static final String DEFAULT_NAME = "";
  public static final String DEFAULT_VALUE = "";

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

  @ProtoField(tag = 2, type = STRING, label = REQUIRED)
  public final String value;

  public Setting(String name, String value) {
    this.name = name;
    this.value = value;
  }

  private Setting(Builder builder) {
    this(builder.name, builder.value);
    setBuilder(builder);
  }

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

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

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

    public String name;
    public String value;

    public Builder() {
    }

    public Builder(Setting message) {
      super(message);
      if (message == null) return;
      this.name = message.name;
      this.value = message.value;
    }

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

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

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