// Code generated by Wire protocol buffer compiler, do not edit.
// Source: squareup.proto3.Pizza in pizza.proto
package squareup.proto3;

import com.squareup.wire.Message;
import com.squareup.wire.ProtoAdapter;
import com.squareup.wire.Syntax;
import com.squareup.wire.WireField;
import com.squareup.wire.internal.Internal;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.List;
import okio.ByteString;

public final class Pizza extends Message<Pizza, Pizza.Builder> {
  public static final ProtoAdapter<Pizza> ADAPTER = ProtoAdapter.newMessageAdapter(Pizza.class, "type.googleapis.com/squareup.proto3.Pizza", Syntax.PROTO_3);

  private static final long serialVersionUID = 0L;

  @WireField(
      tag = 1,
      adapter = "com.squareup.wire.ProtoAdapter#STRING",
      label = WireField.Label.REPEATED
  )
  public final List<String> toppings;

  public Pizza(List<String> toppings) {
    this(toppings, ByteString.EMPTY);
  }

  public Pizza(List<String> toppings, ByteString unknownFields) {
    super(ADAPTER, unknownFields);
    this.toppings = Internal.immutableCopyOf("toppings", toppings);
  }

  @Override
  public Builder newBuilder() {
    Builder builder = new Builder();
    builder.toppings = Internal.copyOf(toppings);
    builder.addUnknownFields(unknownFields());
    return builder;
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) return true;
    if (!(other instanceof Pizza)) return false;
    Pizza o = (Pizza) other;
    return unknownFields().equals(o.unknownFields())
        && toppings.equals(o.toppings);
  }

  @Override
  public int hashCode() {
    int result = super.hashCode;
    if (result == 0) {
      result = unknownFields().hashCode();
      result = result * 37 + toppings.hashCode();
      super.hashCode = result;
    }
    return result;
  }

  public static final class Builder extends Message.Builder<Pizza, Builder> {
    public List<String> toppings;

    public Builder() {
      toppings = Internal.newMutableList();
    }

    public Builder toppings(List<String> toppings) {
      Internal.checkElementsNotNull(toppings);
      this.toppings = toppings;
      return this;
    }

    @Override
    public Pizza build() {
      return new Pizza(toppings, super.buildUnknownFields());
    }
  }
}
