// Copyright 2023, the Chromium project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Autogenerated from Pigeon (v25.3.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon

package io.flutter.plugins.firebase.core;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.CLASS;

import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.plugin.common.BasicMessageChannel;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MessageCodec;
import io.flutter.plugin.common.StandardMessageCodec;
import java.io.ByteArrayOutputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/** Generated class from Pigeon. */
@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"})
public class GeneratedAndroidFirebaseCore {

  /** Error class for passing custom error details to Flutter via a thrown PlatformException. */
  public static class FlutterError extends RuntimeException {

    /** The error code. */
    public final String code;

    /** The error details. Must be a datatype supported by the api codec. */
    public final Object details;

    public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) {
      super(message);
      this.code = code;
      this.details = details;
    }
  }

  @NonNull
  protected static ArrayList<Object> wrapError(@NonNull Throwable exception) {
    ArrayList<Object> errorList = new ArrayList<>(3);
    if (exception instanceof FlutterError) {
      FlutterError error = (FlutterError) exception;
      errorList.add(error.code);
      errorList.add(error.getMessage());
      errorList.add(error.details);
    } else {
      errorList.add(exception.toString());
      errorList.add(exception.getClass().getSimpleName());
      errorList.add(
          "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
    }
    return errorList;
  }

  @Target(METHOD)
  @Retention(CLASS)
  @interface CanIgnoreReturnValue {}

  /** Generated class from Pigeon that represents data sent in messages. */
  public static final class CoreFirebaseOptions {
    private @NonNull String apiKey;

    public @NonNull String getApiKey() {
      return apiKey;
    }

    public void setApiKey(@NonNull String setterArg) {
      if (setterArg == null) {
        throw new IllegalStateException("Nonnull field \"apiKey\" is null.");
      }
      this.apiKey = setterArg;
    }

    private @NonNull String appId;

    public @NonNull String getAppId() {
      return appId;
    }

    public void setAppId(@NonNull String setterArg) {
      if (setterArg == null) {
        throw new IllegalStateException("Nonnull field \"appId\" is null.");
      }
      this.appId = setterArg;
    }

    private @NonNull String messagingSenderId;

    public @NonNull String getMessagingSenderId() {
      return messagingSenderId;
    }

    public void setMessagingSenderId(@NonNull String setterArg) {
      if (setterArg == null) {
        throw new IllegalStateException("Nonnull field \"messagingSenderId\" is null.");
      }
      this.messagingSenderId = setterArg;
    }

    private @NonNull String projectId;

    public @NonNull String getProjectId() {
      return projectId;
    }

    public void setProjectId(@NonNull String setterArg) {
      if (setterArg == null) {
        throw new IllegalStateException("Nonnull field \"projectId\" is null.");
      }
      this.projectId = setterArg;
    }

    private @Nullable String authDomain;

    public @Nullable String getAuthDomain() {
      return authDomain;
    }

    public void setAuthDomain(@Nullable String setterArg) {
      this.authDomain = setterArg;
    }

    private @Nullable String databaseURL;

    public @Nullable String getDatabaseURL() {
      return databaseURL;
    }

    public void setDatabaseURL(@Nullable String setterArg) {
      this.databaseURL = setterArg;
    }

    private @Nullable String storageBucket;

    public @Nullable String getStorageBucket() {
      return storageBucket;
    }

    public void setStorageBucket(@Nullable String setterArg) {
      this.storageBucket = setterArg;
    }

    private @Nullable String measurementId;

    public @Nullable String getMeasurementId() {
      return measurementId;
    }

    public void setMeasurementId(@Nullable String setterArg) {
      this.measurementId = setterArg;
    }

    private @Nullable String trackingId;

    public @Nullable String getTrackingId() {
      return trackingId;
    }

    public void setTrackingId(@Nullable String setterArg) {
      this.trackingId = setterArg;
    }

    private @Nullable String deepLinkURLScheme;

    public @Nullable String getDeepLinkURLScheme() {
      return deepLinkURLScheme;
    }

    public void setDeepLinkURLScheme(@Nullable String setterArg) {
      this.deepLinkURLScheme = setterArg;
    }

    private @Nullable String androidClientId;

    public @Nullable String getAndroidClientId() {
      return androidClientId;
    }

    public void setAndroidClientId(@Nullable String setterArg) {
      this.androidClientId = setterArg;
    }

    private @Nullable String iosClientId;

    public @Nullable String getIosClientId() {
      return iosClientId;
    }

    public void setIosClientId(@Nullable String setterArg) {
      this.iosClientId = setterArg;
    }

    private @Nullable String iosBundleId;

    public @Nullable String getIosBundleId() {
      return iosBundleId;
    }

    public void setIosBundleId(@Nullable String setterArg) {
      this.iosBundleId = setterArg;
    }

    private @Nullable String appGroupId;

    public @Nullable String getAppGroupId() {
      return appGroupId;
    }

    public void setAppGroupId(@Nullable String setterArg) {
      this.appGroupId = setterArg;
    }

    /** Constructor is non-public to enforce null safety; use Builder. */
    CoreFirebaseOptions() {}

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      CoreFirebaseOptions that = (CoreFirebaseOptions) o;
      return apiKey.equals(that.apiKey)
          && appId.equals(that.appId)
          && messagingSenderId.equals(that.messagingSenderId)
          && projectId.equals(that.projectId)
          && Objects.equals(authDomain, that.authDomain)
          && Objects.equals(databaseURL, that.databaseURL)
          && Objects.equals(storageBucket, that.storageBucket)
          && Objects.equals(measurementId, that.measurementId)
          && Objects.equals(trackingId, that.trackingId)
          && Objects.equals(deepLinkURLScheme, that.deepLinkURLScheme)
          && Objects.equals(androidClientId, that.androidClientId)
          && Objects.equals(iosClientId, that.iosClientId)
          && Objects.equals(iosBundleId, that.iosBundleId)
          && Objects.equals(appGroupId, that.appGroupId);
    }

    @Override
    public int hashCode() {
      return Objects.hash(
          apiKey,
          appId,
          messagingSenderId,
          projectId,
          authDomain,
          databaseURL,
          storageBucket,
          measurementId,
          trackingId,
          deepLinkURLScheme,
          androidClientId,
          iosClientId,
          iosBundleId,
          appGroupId);
    }

    public static final class Builder {

      private @Nullable String apiKey;

      @CanIgnoreReturnValue
      public @NonNull Builder setApiKey(@NonNull String setterArg) {
        this.apiKey = setterArg;
        return this;
      }

      private @Nullable String appId;

      @CanIgnoreReturnValue
      public @NonNull Builder setAppId(@NonNull String setterArg) {
        this.appId = setterArg;
        return this;
      }

      private @Nullable String messagingSenderId;

      @CanIgnoreReturnValue
      public @NonNull Builder setMessagingSenderId(@NonNull String setterArg) {
        this.messagingSenderId = setterArg;
        return this;
      }

      private @Nullable String projectId;

      @CanIgnoreReturnValue
      public @NonNull Builder setProjectId(@NonNull String setterArg) {
        this.projectId = setterArg;
        return this;
      }

      private @Nullable String authDomain;

      @CanIgnoreReturnValue
      public @NonNull Builder setAuthDomain(@Nullable String setterArg) {
        this.authDomain = setterArg;
        return this;
      }

      private @Nullable String databaseURL;

      @CanIgnoreReturnValue
      public @NonNull Builder setDatabaseURL(@Nullable String setterArg) {
        this.databaseURL = setterArg;
        return this;
      }

      private @Nullable String storageBucket;

      @CanIgnoreReturnValue
      public @NonNull Builder setStorageBucket(@Nullable String setterArg) {
        this.storageBucket = setterArg;
        return this;
      }

      private @Nullable String measurementId;

      @CanIgnoreReturnValue
      public @NonNull Builder setMeasurementId(@Nullable String setterArg) {
        this.measurementId = setterArg;
        return this;
      }

      private @Nullable String trackingId;

      @CanIgnoreReturnValue
      public @NonNull Builder setTrackingId(@Nullable String setterArg) {
        this.trackingId = setterArg;
        return this;
      }

      private @Nullable String deepLinkURLScheme;

      @CanIgnoreReturnValue
      public @NonNull Builder setDeepLinkURLScheme(@Nullable String setterArg) {
        this.deepLinkURLScheme = setterArg;
        return this;
      }

      private @Nullable String androidClientId;

      @CanIgnoreReturnValue
      public @NonNull Builder setAndroidClientId(@Nullable String setterArg) {
        this.androidClientId = setterArg;
        return this;
      }

      private @Nullable String iosClientId;

      @CanIgnoreReturnValue
      public @NonNull Builder setIosClientId(@Nullable String setterArg) {
        this.iosClientId = setterArg;
        return this;
      }

      private @Nullable String iosBundleId;

      @CanIgnoreReturnValue
      public @NonNull Builder setIosBundleId(@Nullable String setterArg) {
        this.iosBundleId = setterArg;
        return this;
      }

      private @Nullable String appGroupId;

      @CanIgnoreReturnValue
      public @NonNull Builder setAppGroupId(@Nullable String setterArg) {
        this.appGroupId = setterArg;
        return this;
      }

      public @NonNull CoreFirebaseOptions build() {
        CoreFirebaseOptions pigeonReturn = new CoreFirebaseOptions();
        pigeonReturn.setApiKey(apiKey);
        pigeonReturn.setAppId(appId);
        pigeonReturn.setMessagingSenderId(messagingSenderId);
        pigeonReturn.setProjectId(projectId);
        pigeonReturn.setAuthDomain(authDomain);
        pigeonReturn.setDatabaseURL(databaseURL);
        pigeonReturn.setStorageBucket(storageBucket);
        pigeonReturn.setMeasurementId(measurementId);
        pigeonReturn.setTrackingId(trackingId);
        pigeonReturn.setDeepLinkURLScheme(deepLinkURLScheme);
        pigeonReturn.setAndroidClientId(androidClientId);
        pigeonReturn.setIosClientId(iosClientId);
        pigeonReturn.setIosBundleId(iosBundleId);
        pigeonReturn.setAppGroupId(appGroupId);
        return pigeonReturn;
      }
    }

    @NonNull
    ArrayList<Object> toList() {
      ArrayList<Object> toListResult = new ArrayList<>(14);
      toListResult.add(apiKey);
      toListResult.add(appId);
      toListResult.add(messagingSenderId);
      toListResult.add(projectId);
      toListResult.add(authDomain);
      toListResult.add(databaseURL);
      toListResult.add(storageBucket);
      toListResult.add(measurementId);
      toListResult.add(trackingId);
      toListResult.add(deepLinkURLScheme);
      toListResult.add(androidClientId);
      toListResult.add(iosClientId);
      toListResult.add(iosBundleId);
      toListResult.add(appGroupId);
      return toListResult;
    }

    static @NonNull CoreFirebaseOptions fromList(@NonNull ArrayList<Object> pigeonVar_list) {
      CoreFirebaseOptions pigeonResult = new CoreFirebaseOptions();
      Object apiKey = pigeonVar_list.get(0);
      pigeonResult.setApiKey((String) apiKey);
      Object appId = pigeonVar_list.get(1);
      pigeonResult.setAppId((String) appId);
      Object messagingSenderId = pigeonVar_list.get(2);
      pigeonResult.setMessagingSenderId((String) messagingSenderId);
      Object projectId = pigeonVar_list.get(3);
      pigeonResult.setProjectId((String) projectId);
      Object authDomain = pigeonVar_list.get(4);
      pigeonResult.setAuthDomain((String) authDomain);
      Object databaseURL = pigeonVar_list.get(5);
      pigeonResult.setDatabaseURL((String) databaseURL);
      Object storageBucket = pigeonVar_list.get(6);
      pigeonResult.setStorageBucket((String) storageBucket);
      Object measurementId = pigeonVar_list.get(7);
      pigeonResult.setMeasurementId((String) measurementId);
      Object trackingId = pigeonVar_list.get(8);
      pigeonResult.setTrackingId((String) trackingId);
      Object deepLinkURLScheme = pigeonVar_list.get(9);
      pigeonResult.setDeepLinkURLScheme((String) deepLinkURLScheme);
      Object androidClientId = pigeonVar_list.get(10);
      pigeonResult.setAndroidClientId((String) androidClientId);
      Object iosClientId = pigeonVar_list.get(11);
      pigeonResult.setIosClientId((String) iosClientId);
      Object iosBundleId = pigeonVar_list.get(12);
      pigeonResult.setIosBundleId((String) iosBundleId);
      Object appGroupId = pigeonVar_list.get(13);
      pigeonResult.setAppGroupId((String) appGroupId);
      return pigeonResult;
    }
  }

  /** Generated class from Pigeon that represents data sent in messages. */
  public static final class CoreInitializeResponse {
    private @NonNull String name;

    public @NonNull String getName() {
      return name;
    }

    public void setName(@NonNull String setterArg) {
      if (setterArg == null) {
        throw new IllegalStateException("Nonnull field \"name\" is null.");
      }
      this.name = setterArg;
    }

    private @NonNull CoreFirebaseOptions options;

    public @NonNull CoreFirebaseOptions getOptions() {
      return options;
    }

    public void setOptions(@NonNull CoreFirebaseOptions setterArg) {
      if (setterArg == null) {
        throw new IllegalStateException("Nonnull field \"options\" is null.");
      }
      this.options = setterArg;
    }

    private @Nullable Boolean isAutomaticDataCollectionEnabled;

    public @Nullable Boolean getIsAutomaticDataCollectionEnabled() {
      return isAutomaticDataCollectionEnabled;
    }

    public void setIsAutomaticDataCollectionEnabled(@Nullable Boolean setterArg) {
      this.isAutomaticDataCollectionEnabled = setterArg;
    }

    private @NonNull Map<String, Object> pluginConstants;

    public @NonNull Map<String, Object> getPluginConstants() {
      return pluginConstants;
    }

    public void setPluginConstants(@NonNull Map<String, Object> setterArg) {
      if (setterArg == null) {
        throw new IllegalStateException("Nonnull field \"pluginConstants\" is null.");
      }
      this.pluginConstants = setterArg;
    }

    /** Constructor is non-public to enforce null safety; use Builder. */
    CoreInitializeResponse() {}

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      CoreInitializeResponse that = (CoreInitializeResponse) o;
      return name.equals(that.name)
          && options.equals(that.options)
          && Objects.equals(isAutomaticDataCollectionEnabled, that.isAutomaticDataCollectionEnabled)
          && pluginConstants.equals(that.pluginConstants);
    }

    @Override
    public int hashCode() {
      return Objects.hash(name, options, isAutomaticDataCollectionEnabled, pluginConstants);
    }

    public static final class Builder {

      private @Nullable String name;

      @CanIgnoreReturnValue
      public @NonNull Builder setName(@NonNull String setterArg) {
        this.name = setterArg;
        return this;
      }

      private @Nullable CoreFirebaseOptions options;

      @CanIgnoreReturnValue
      public @NonNull Builder setOptions(@NonNull CoreFirebaseOptions setterArg) {
        this.options = setterArg;
        return this;
      }

      private @Nullable Boolean isAutomaticDataCollectionEnabled;

      @CanIgnoreReturnValue
      public @NonNull Builder setIsAutomaticDataCollectionEnabled(@Nullable Boolean setterArg) {
        this.isAutomaticDataCollectionEnabled = setterArg;
        return this;
      }

      private @Nullable Map<String, Object> pluginConstants;

      @CanIgnoreReturnValue
      public @NonNull Builder setPluginConstants(@NonNull Map<String, Object> setterArg) {
        this.pluginConstants = setterArg;
        return this;
      }

      public @NonNull CoreInitializeResponse build() {
        CoreInitializeResponse pigeonReturn = new CoreInitializeResponse();
        pigeonReturn.setName(name);
        pigeonReturn.setOptions(options);
        pigeonReturn.setIsAutomaticDataCollectionEnabled(isAutomaticDataCollectionEnabled);
        pigeonReturn.setPluginConstants(pluginConstants);
        return pigeonReturn;
      }
    }

    @NonNull
    ArrayList<Object> toList() {
      ArrayList<Object> toListResult = new ArrayList<>(4);
      toListResult.add(name);
      toListResult.add(options);
      toListResult.add(isAutomaticDataCollectionEnabled);
      toListResult.add(pluginConstants);
      return toListResult;
    }

    static @NonNull CoreInitializeResponse fromList(@NonNull ArrayList<Object> pigeonVar_list) {
      CoreInitializeResponse pigeonResult = new CoreInitializeResponse();
      Object name = pigeonVar_list.get(0);
      pigeonResult.setName((String) name);
      Object options = pigeonVar_list.get(1);
      pigeonResult.setOptions((CoreFirebaseOptions) options);
      Object isAutomaticDataCollectionEnabled = pigeonVar_list.get(2);
      pigeonResult.setIsAutomaticDataCollectionEnabled((Boolean) isAutomaticDataCollectionEnabled);
      Object pluginConstants = pigeonVar_list.get(3);
      pigeonResult.setPluginConstants((Map<String, Object>) pluginConstants);
      return pigeonResult;
    }
  }

  private static class PigeonCodec extends StandardMessageCodec {
    public static final PigeonCodec INSTANCE = new PigeonCodec();

    private PigeonCodec() {}

    @Override
    protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) {
      switch (type) {
        case (byte) 129:
          return CoreFirebaseOptions.fromList((ArrayList<Object>) readValue(buffer));
        case (byte) 130:
          return CoreInitializeResponse.fromList((ArrayList<Object>) readValue(buffer));
        default:
          return super.readValueOfType(type, buffer);
      }
    }

    @Override
    protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) {
      if (value instanceof CoreFirebaseOptions) {
        stream.write(129);
        writeValue(stream, ((CoreFirebaseOptions) value).toList());
      } else if (value instanceof CoreInitializeResponse) {
        stream.write(130);
        writeValue(stream, ((CoreInitializeResponse) value).toList());
      } else {
        super.writeValue(stream, value);
      }
    }
  }

  /** Asynchronous error handling return type for non-nullable API method returns. */
  public interface Result<T> {
    /** Success case callback method for handling returns. */
    void success(@NonNull T result);

    /** Failure case callback method for handling errors. */
    void error(@NonNull Throwable error);
  }
  /** Asynchronous error handling return type for nullable API method returns. */
  public interface NullableResult<T> {
    /** Success case callback method for handling returns. */
    void success(@Nullable T result);

    /** Failure case callback method for handling errors. */
    void error(@NonNull Throwable error);
  }
  /** Asynchronous error handling return type for void API method returns. */
  public interface VoidResult {
    /** Success case callback method for handling returns. */
    void success();

    /** Failure case callback method for handling errors. */
    void error(@NonNull Throwable error);
  }
  /** Generated interface from Pigeon that represents a handler of messages from Flutter. */
  public interface FirebaseCoreHostApi {

    void initializeApp(
        @NonNull String appName,
        @NonNull CoreFirebaseOptions initializeAppRequest,
        @NonNull Result<CoreInitializeResponse> result);

    void initializeCore(@NonNull Result<List<CoreInitializeResponse>> result);

    void optionsFromResource(@NonNull Result<CoreFirebaseOptions> result);

    /** The codec used by FirebaseCoreHostApi. */
    static @NonNull MessageCodec<Object> getCodec() {
      return PigeonCodec.INSTANCE;
    }
    /**
     * Sets up an instance of `FirebaseCoreHostApi` to handle messages through the
     * `binaryMessenger`.
     */
    static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseCoreHostApi api) {
      setUp(binaryMessenger, "", api);
    }

    static void setUp(
        @NonNull BinaryMessenger binaryMessenger,
        @NonNull String messageChannelSuffix,
        @Nullable FirebaseCoreHostApi api) {
      messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix;
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(
                binaryMessenger,
                "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp"
                    + messageChannelSuffix,
                getCodec());
        if (api != null) {
          channel.setMessageHandler(
              (message, reply) -> {
                ArrayList<Object> wrapped = new ArrayList<>();
                ArrayList<Object> args = (ArrayList<Object>) message;
                String appNameArg = (String) args.get(0);
                CoreFirebaseOptions initializeAppRequestArg = (CoreFirebaseOptions) args.get(1);
                Result<CoreInitializeResponse> resultCallback =
                    new Result<CoreInitializeResponse>() {
                      public void success(CoreInitializeResponse result) {
                        wrapped.add(0, result);
                        reply.reply(wrapped);
                      }

                      public void error(Throwable error) {
                        ArrayList<Object> wrappedError = wrapError(error);
                        reply.reply(wrappedError);
                      }
                    };

                api.initializeApp(appNameArg, initializeAppRequestArg, resultCallback);
              });
        } else {
          channel.setMessageHandler(null);
        }
      }
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(
                binaryMessenger,
                "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore"
                    + messageChannelSuffix,
                getCodec());
        if (api != null) {
          channel.setMessageHandler(
              (message, reply) -> {
                ArrayList<Object> wrapped = new ArrayList<>();
                Result<List<CoreInitializeResponse>> resultCallback =
                    new Result<List<CoreInitializeResponse>>() {
                      public void success(List<CoreInitializeResponse> result) {
                        wrapped.add(0, result);
                        reply.reply(wrapped);
                      }

                      public void error(Throwable error) {
                        ArrayList<Object> wrappedError = wrapError(error);
                        reply.reply(wrappedError);
                      }
                    };

                api.initializeCore(resultCallback);
              });
        } else {
          channel.setMessageHandler(null);
        }
      }
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(
                binaryMessenger,
                "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource"
                    + messageChannelSuffix,
                getCodec());
        if (api != null) {
          channel.setMessageHandler(
              (message, reply) -> {
                ArrayList<Object> wrapped = new ArrayList<>();
                Result<CoreFirebaseOptions> resultCallback =
                    new Result<CoreFirebaseOptions>() {
                      public void success(CoreFirebaseOptions result) {
                        wrapped.add(0, result);
                        reply.reply(wrapped);
                      }

                      public void error(Throwable error) {
                        ArrayList<Object> wrappedError = wrapError(error);
                        reply.reply(wrappedError);
                      }
                    };

                api.optionsFromResource(resultCallback);
              });
        } else {
          channel.setMessageHandler(null);
        }
      }
    }
  }
  /** Generated interface from Pigeon that represents a handler of messages from Flutter. */
  public interface FirebaseAppHostApi {

    void setAutomaticDataCollectionEnabled(
        @NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result);

    void setAutomaticResourceManagementEnabled(
        @NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result);

    void delete(@NonNull String appName, @NonNull VoidResult result);

    /** The codec used by FirebaseAppHostApi. */
    static @NonNull MessageCodec<Object> getCodec() {
      return PigeonCodec.INSTANCE;
    }
    /**
     * Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binaryMessenger`.
     */
    static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseAppHostApi api) {
      setUp(binaryMessenger, "", api);
    }

    static void setUp(
        @NonNull BinaryMessenger binaryMessenger,
        @NonNull String messageChannelSuffix,
        @Nullable FirebaseAppHostApi api) {
      messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix;
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(
                binaryMessenger,
                "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled"
                    + messageChannelSuffix,
                getCodec());
        if (api != null) {
          channel.setMessageHandler(
              (message, reply) -> {
                ArrayList<Object> wrapped = new ArrayList<>();
                ArrayList<Object> args = (ArrayList<Object>) message;
                String appNameArg = (String) args.get(0);
                Boolean enabledArg = (Boolean) args.get(1);
                VoidResult resultCallback =
                    new VoidResult() {
                      public void success() {
                        wrapped.add(0, null);
                        reply.reply(wrapped);
                      }

                      public void error(Throwable error) {
                        ArrayList<Object> wrappedError = wrapError(error);
                        reply.reply(wrappedError);
                      }
                    };

                api.setAutomaticDataCollectionEnabled(appNameArg, enabledArg, resultCallback);
              });
        } else {
          channel.setMessageHandler(null);
        }
      }
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(
                binaryMessenger,
                "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled"
                    + messageChannelSuffix,
                getCodec());
        if (api != null) {
          channel.setMessageHandler(
              (message, reply) -> {
                ArrayList<Object> wrapped = new ArrayList<>();
                ArrayList<Object> args = (ArrayList<Object>) message;
                String appNameArg = (String) args.get(0);
                Boolean enabledArg = (Boolean) args.get(1);
                VoidResult resultCallback =
                    new VoidResult() {
                      public void success() {
                        wrapped.add(0, null);
                        reply.reply(wrapped);
                      }

                      public void error(Throwable error) {
                        ArrayList<Object> wrappedError = wrapError(error);
                        reply.reply(wrappedError);
                      }
                    };

                api.setAutomaticResourceManagementEnabled(appNameArg, enabledArg, resultCallback);
              });
        } else {
          channel.setMessageHandler(null);
        }
      }
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(
                binaryMessenger,
                "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete"
                    + messageChannelSuffix,
                getCodec());
        if (api != null) {
          channel.setMessageHandler(
              (message, reply) -> {
                ArrayList<Object> wrapped = new ArrayList<>();
                ArrayList<Object> args = (ArrayList<Object>) message;
                String appNameArg = (String) args.get(0);
                VoidResult resultCallback =
                    new VoidResult() {
                      public void success() {
                        wrapped.add(0, null);
                        reply.reply(wrapped);
                      }

                      public void error(Throwable error) {
                        ArrayList<Object> wrappedError = wrapError(error);
                        reply.reply(wrappedError);
                      }
                    };

                api.delete(appNameArg, resultCallback);
              });
        } else {
          channel.setMessageHandler(null);
        }
      }
    }
  }
}
