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

import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;
import java.util.Collections;
import java.util.List;

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

public final class ConsentData extends Message {

  public static final List<ScopeDetails> DEFAULT_SCOPES = Collections.emptyList();

  @ProtoField(tag = 1)
  public final AppDetails app;

  @ProtoField(tag = 2, label = REPEATED, messageType = ScopeDetails.class)
  public final List<ScopeDetails> scopes;

  public ConsentData(AppDetails app, List<ScopeDetails> scopes) {
    this.app = app;
    this.scopes = immutableCopyOf(scopes);
  }

  private ConsentData(Builder builder) {
    this(builder.app, builder.scopes);
    setBuilder(builder);
  }

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

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

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

    public AppDetails app;
    public List<ScopeDetails> scopes;

    public Builder() {
    }

    public Builder(ConsentData message) {
      super(message);
      if (message == null) return;
      this.app = message.app;
      this.scopes = copyOf(message.scopes);
    }

    public Builder app(AppDetails app) {
      this.app = app;
      return this;
    }

    public Builder scopes(List<ScopeDetails> scopes) {
      this.scopes = checkForNulls(scopes);
      return this;
    }

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

  public static final class AppDetails extends Message {

    public static final String DEFAULT_TITLE = "";
    public static final String DEFAULT_EMAIL = "";

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

    @ProtoField(tag = 3, type = STRING)
    public final String email;

    public AppDetails(String title, String email) {
      this.title = title;
      this.email = email;
    }

    private AppDetails(Builder builder) {
      this(builder.title, builder.email);
      setBuilder(builder);
    }

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

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

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

      public String title;
      public String email;

      public Builder() {
      }

      public Builder(AppDetails message) {
        super(message);
        if (message == null) return;
        this.title = message.title;
        this.email = message.email;
      }

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

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

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

  public static final class ScopeDetails extends Message {

    public static final String DEFAULT_TITLE = "";
    public static final String DEFAULT_DESCRIPTION = "";
    public static final String DEFAULT_ID = "";

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

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

    @ProtoField(tag = 6, type = STRING)
    public final String id;

    public ScopeDetails(String title, String description, String id) {
      this.title = title;
      this.description = description;
      this.id = id;
    }

    private ScopeDetails(Builder builder) {
      this(builder.title, builder.description, builder.id);
      setBuilder(builder);
    }

    @Override
    public boolean equals(Object other) {
      if (other == this) return true;
      if (!(other instanceof ScopeDetails)) return false;
      ScopeDetails o = (ScopeDetails) other;
      return equals(title, o.title)
          && equals(description, o.description)
          && equals(id, o.id);
    }

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

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

      public String title;
      public String description;
      public String id;

      public Builder() {
      }

      public Builder(ScopeDetails message) {
        super(message);
        if (message == null) return;
        this.title = message.title;
        this.description = message.description;
        this.id = message.id;
      }

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

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

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

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