content: // Copyright (c) 2019 Alibaba Group. All rights reserved.
  // Use of this source code is governed by a MIT license that can be
  // found in the LICENSE file.
  // Autogenerated from Pigeon (v3.2.9), do not edit directly.
  // See also: https://pub.dev/packages/pigeon
  
  package com.idlefish.flutterboost;
  
  import android.util.Log;
  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.nio.ByteBuffer;
  import java.util.Arrays;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Map;
  import java.util.HashMap;
  
  /** Generated class from Pigeon. */
  @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
  public class Messages {
  
    /** Generated class from Pigeon that represents data sent in messages. */
    public static class CommonParams {
      private Boolean opaque;
      public Boolean getOpaque() { return opaque; }
      public void setOpaque(Boolean setterArg) {
        this.opaque = setterArg;
      }
  
      private String key;
      public String getKey() { return key; }
      public void setKey(String setterArg) {
        this.key = setterArg;
      }
  
      private String pageName;
      public String getPageName() { return pageName; }
      public void setPageName(String setterArg) {
        this.pageName = setterArg;
      }
  
      private String uniqueId;
      public String getUniqueId() { return uniqueId; }
      public void setUniqueId(String setterArg) {
        this.uniqueId = setterArg;
      }
  
      private Map<String, Object> arguments;
      public Map<String, Object> getArguments() { return arguments; }
      public void setArguments(Map<String, Object> setterArg) {
        this.arguments = setterArg;
      }
  
      public static final class Builder {
        private Boolean opaque;
        public Builder setOpaque(Boolean setterArg) {
          this.opaque = setterArg;
          return this;
        }
        private String key;
        public Builder setKey(String setterArg) {
          this.key = setterArg;
          return this;
        }
        private String pageName;
        public Builder setPageName(String setterArg) {
          this.pageName = setterArg;
          return this;
        }
        private String uniqueId;
        public Builder setUniqueId(String setterArg) {
          this.uniqueId = setterArg;
          return this;
        }
        private Map<String, Object> arguments;
        public Builder setArguments(Map<String, Object> setterArg) {
          this.arguments = setterArg;
          return this;
        }
        public CommonParams build() {
          CommonParams pigeonReturn = new CommonParams();
          pigeonReturn.setOpaque(opaque);
          pigeonReturn.setKey(key);
          pigeonReturn.setPageName(pageName);
          pigeonReturn.setUniqueId(uniqueId);
          pigeonReturn.setArguments(arguments);
          return pigeonReturn;
        }
      }
      Map<String, Object> toMap() {
        Map<String, Object> toMapResult = new HashMap<>();
        toMapResult.put("opaque", opaque);
        toMapResult.put("key", key);
        toMapResult.put("pageName", pageName);
        toMapResult.put("uniqueId", uniqueId);
        toMapResult.put("arguments", arguments);
        return toMapResult;
      }
      static CommonParams fromMap(Map<String, Object> map) {
        CommonParams pigeonResult = new CommonParams();
        Object opaque = map.get("opaque");
        pigeonResult.setOpaque((Boolean)opaque);
        Object key = map.get("key");
        pigeonResult.setKey((String)key);
        Object pageName = map.get("pageName");
        pigeonResult.setPageName((String)pageName);
        Object uniqueId = map.get("uniqueId");
        pigeonResult.setUniqueId((String)uniqueId);
        Object arguments = map.get("arguments");
        pigeonResult.setArguments((Map<String, Object>)arguments);
        return pigeonResult;
      }
    }
  
    /** Generated class from Pigeon that represents data sent in messages. */
    public static class StackInfo {
      private List<String> ids;
      public List<String> getIds() { return ids; }
      public void setIds(List<String> setterArg) {
        this.ids = setterArg;
      }
  
      private Map<String, FlutterContainer> containers;
      public Map<String, FlutterContainer> getContainers() { return containers; }
      public void setContainers(Map<String, FlutterContainer> setterArg) {
        this.containers = setterArg;
      }
  
      public static final class Builder {
        private List<String> ids;
        public Builder setIds(List<String> setterArg) {
          this.ids = setterArg;
          return this;
        }
        private Map<String, FlutterContainer> containers;
        public Builder setContainers(Map<String, FlutterContainer> setterArg) {
          this.containers = setterArg;
          return this;
        }
        public StackInfo build() {
          StackInfo pigeonReturn = new StackInfo();
          pigeonReturn.setIds(ids);
          pigeonReturn.setContainers(containers);
          return pigeonReturn;
        }
      }
      Map<String, Object> toMap() {
        Map<String, Object> toMapResult = new HashMap<>();
        toMapResult.put("ids", ids);
        toMapResult.put("containers", containers);
        return toMapResult;
      }
      static StackInfo fromMap(Map<String, Object> map) {
        StackInfo pigeonResult = new StackInfo();
        Object ids = map.get("ids");
        pigeonResult.setIds((List<String>)ids);
        Object containers = map.get("containers");
        pigeonResult.setContainers((Map<String, FlutterContainer>)containers);
        return pigeonResult;
      }
    }
  
    /** Generated class from Pigeon that represents data sent in messages. */
    public static class FlutterContainer {
      private List<FlutterPage> pages;
      public List<FlutterPage> getPages() { return pages; }
      public void setPages(List<FlutterPage> setterArg) {
        this.pages = setterArg;
      }
  
      public static final class Builder {
        private List<FlutterPage> pages;
        public Builder setPages(List<FlutterPage> setterArg) {
          this.pages = setterArg;
          return this;
        }
        public FlutterContainer build() {
          FlutterContainer pigeonReturn = new FlutterContainer();
          pigeonReturn.setPages(pages);
          return pigeonReturn;
        }
      }
      Map<String, Object> toMap() {
        Map<String, Object> toMapResult = new HashMap<>();
        toMapResult.put("pages", pages);
        return toMapResult;
      }
      static FlutterContainer fromMap(Map<String, Object> map) {
        FlutterContainer pigeonResult = new FlutterContainer();
        Object pages = map.get("pages");
        pigeonResult.setPages((List<FlutterPage>)pages);
        return pigeonResult;
      }
    }
  
    /** Generated class from Pigeon that represents data sent in messages. */
    public static class FlutterPage {
      private Boolean withContainer;
      public Boolean getWithContainer() { return withContainer; }
      public void setWithContainer(Boolean setterArg) {
        this.withContainer = setterArg;
      }
  
      private String pageName;
      public String getPageName() { return pageName; }
      public void setPageName(String setterArg) {
        this.pageName = setterArg;
      }
  
      private String uniqueId;
      public String getUniqueId() { return uniqueId; }
      public void setUniqueId(String setterArg) {
        this.uniqueId = setterArg;
      }
  
      private Map<String, Object> arguments;
      public Map<String, Object> getArguments() { return arguments; }
      public void setArguments(Map<String, Object> setterArg) {
        this.arguments = setterArg;
      }
  
      public static final class Builder {
        private Boolean withContainer;
        public Builder setWithContainer(Boolean setterArg) {
          this.withContainer = setterArg;
          return this;
        }
        private String pageName;
        public Builder setPageName(String setterArg) {
          this.pageName = setterArg;
          return this;
        }
        private String uniqueId;
        public Builder setUniqueId(String setterArg) {
          this.uniqueId = setterArg;
          return this;
        }
        private Map<String, Object> arguments;
        public Builder setArguments(Map<String, Object> setterArg) {
          this.arguments = setterArg;
          return this;
        }
        public FlutterPage build() {
          FlutterPage pigeonReturn = new FlutterPage();
          pigeonReturn.setWithContainer(withContainer);
          pigeonReturn.setPageName(pageName);
          pigeonReturn.setUniqueId(uniqueId);
          pigeonReturn.setArguments(arguments);
          return pigeonReturn;
        }
      }
      Map<String, Object> toMap() {
        Map<String, Object> toMapResult = new HashMap<>();
        toMapResult.put("withContainer", withContainer);
        toMapResult.put("pageName", pageName);
        toMapResult.put("uniqueId", uniqueId);
        toMapResult.put("arguments", arguments);
        return toMapResult;
      }
      static FlutterPage fromMap(Map<String, Object> map) {
        FlutterPage pigeonResult = new FlutterPage();
        Object withContainer = map.get("withContainer");
        pigeonResult.setWithContainer((Boolean)withContainer);
        Object pageName = map.get("pageName");
        pigeonResult.setPageName((String)pageName);
        Object uniqueId = map.get("uniqueId");
        pigeonResult.setUniqueId((String)uniqueId);
        Object arguments = map.get("arguments");
        pigeonResult.setArguments((Map<String, Object>)arguments);
        return pigeonResult;
      }
    }
  
    public interface Result<T> {
      void success(T result);
      void error(Throwable error);
    }
    private static class NativeRouterApiCodec extends StandardMessageCodec {
      public static final NativeRouterApiCodec INSTANCE = new NativeRouterApiCodec();
      private NativeRouterApiCodec() {}
      @Override
      protected Object readValueOfType(byte type, ByteBuffer buffer) {
        switch (type) {
          case (byte)128:
            return CommonParams.fromMap((Map<String, Object>) readValue(buffer));
  
          case (byte)129:
            return FlutterContainer.fromMap((Map<String, Object>) readValue(buffer));
  
          case (byte)130:
            return FlutterPage.fromMap((Map<String, Object>) readValue(buffer));
  
          case (byte)131:
            return StackInfo.fromMap((Map<String, Object>) readValue(buffer));
  
          default:
            return super.readValueOfType(type, buffer);
  
        }
      }
      @Override
      protected void writeValue(ByteArrayOutputStream stream, Object value)     {
        if (value instanceof CommonParams) {
          stream.write(128);
          writeValue(stream, ((CommonParams) value).toMap());
        } else
        if (value instanceof FlutterContainer) {
          stream.write(129);
          writeValue(stream, ((FlutterContainer) value).toMap());
        } else
        if (value instanceof FlutterPage) {
          stream.write(130);
          writeValue(stream, ((FlutterPage) value).toMap());
        } else
        if (value instanceof StackInfo) {
          stream.write(131);
          writeValue(stream, ((StackInfo) value).toMap());
        } else
  {
          super.writeValue(stream, value);
        }
      }
    }
  
    /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
    public interface NativeRouterApi {
      void pushNativeRoute(CommonParams param);
      void pushFlutterRoute(CommonParams param);
      void popRoute(CommonParams param, Result<Void> result);
      StackInfo getStackFromHost();
      void saveStackToHost(StackInfo stack);
      void sendEventToNative(CommonParams params);
  
      /** The codec used by NativeRouterApi. */
      static MessageCodec<Object> getCodec() {
        return NativeRouterApiCodec.INSTANCE;
      }
  
      /** Sets up an instance of `NativeRouterApi` to handle messages through the `binaryMessenger`. */
      static void setup(BinaryMessenger binaryMessenger, NativeRouterApi api) {
        {
          BasicMessageChannel<Object> channel =
              new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.NativeRouterApi.pushNativeRoute", getCodec());
          if (api != null) {
            channel.setMessageHandler((message, reply) -> {
              Map<String, Object> wrapped = new HashMap<>();
              try {
                ArrayList<Object> args = (ArrayList<Object>)message;
                CommonParams paramArg = (CommonParams)args.get(0);
                if (paramArg == null) {
                  throw new NullPointerException("paramArg unexpectedly null.");
                }
                api.pushNativeRoute(paramArg);
                wrapped.put("result", null);
              }
              catch (Error | RuntimeException exception) {
                wrapped.put("error", wrapError(exception));
              }
              reply.reply(wrapped);
            });
          } else {
            channel.setMessageHandler(null);
          }
        }
        {
          BasicMessageChannel<Object> channel =
              new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.NativeRouterApi.pushFlutterRoute", getCodec());
          if (api != null) {
            channel.setMessageHandler((message, reply) -> {
              Map<String, Object> wrapped = new HashMap<>();
              try {
                ArrayList<Object> args = (ArrayList<Object>)message;
                CommonParams paramArg = (CommonParams)args.get(0);
                if (paramArg == null) {
                  throw new NullPointerException("paramArg unexpectedly null.");
                }
                api.pushFlutterRoute(paramArg);
                wrapped.put("result", null);
              }
              catch (Error | RuntimeException exception) {
                wrapped.put("error", wrapError(exception));
              }
              reply.reply(wrapped);
            });
          } else {
            channel.setMessageHandler(null);
          }
        }
        {
          BasicMessageChannel<Object> channel =
              new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.NativeRouterApi.popRoute", getCodec());
          if (api != null) {
            channel.setMessageHandler((message, reply) -> {
              Map<String, Object> wrapped = new HashMap<>();
              try {
                ArrayList<Object> args = (ArrayList<Object>)message;
                CommonParams paramArg = (CommonParams)args.get(0);
                if (paramArg == null) {
                  throw new NullPointerException("paramArg unexpectedly null.");
                }
                Result<Void> resultCallback = new Result<Void>() {
                  public void success(Void result) {
                    wrapped.put("result", null);
                    reply.reply(wrapped);
                  }
                  public void error(Throwable error) {
                    wrapped.put("error", wrapError(error));
                    reply.reply(wrapped);
                  }
                };
  
                api.popRoute(paramArg, resultCallback);
              }
              catch (Error | RuntimeException exception) {
                wrapped.put("error", wrapError(exception));
                reply.reply(wrapped);
              }
            });
          } else {
            channel.setMessageHandler(null);
          }
        }
        {
          BasicMessageChannel<Object> channel =
              new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.NativeRouterApi.getStackFromHost", getCodec());
          if (api != null) {
            channel.setMessageHandler((message, reply) -> {
              Map<String, Object> wrapped = new HashMap<>();
              try {
                StackInfo output = api.getStackFromHost();
                wrapped.put("result", output);
              }
              catch (Error | RuntimeException exception) {
                wrapped.put("error", wrapError(exception));
              }
              reply.reply(wrapped);
            });
          } else {
            channel.setMessageHandler(null);
          }
        }
        {
          BasicMessageChannel<Object> channel =
              new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.NativeRouterApi.saveStackToHost", getCodec());
          if (api != null) {
            channel.setMessageHandler((message, reply) -> {
              Map<String, Object> wrapped = new HashMap<>();
              try {
                ArrayList<Object> args = (ArrayList<Object>)message;
                StackInfo stackArg = (StackInfo)args.get(0);
                if (stackArg == null) {
                  throw new NullPointerException("stackArg unexpectedly null.");
                }
                api.saveStackToHost(stackArg);
                wrapped.put("result", null);
              }
              catch (Error | RuntimeException exception) {
                wrapped.put("error", wrapError(exception));
              }
              reply.reply(wrapped);
            });
          } else {
            channel.setMessageHandler(null);
          }
        }
        {
          BasicMessageChannel<Object> channel =
              new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.NativeRouterApi.sendEventToNative", getCodec());
          if (api != null) {
            channel.setMessageHandler((message, reply) -> {
              Map<String, Object> wrapped = new HashMap<>();
              try {
                ArrayList<Object> args = (ArrayList<Object>)message;
                CommonParams paramsArg = (CommonParams)args.get(0);
                if (paramsArg == null) {
                  throw new NullPointerException("paramsArg unexpectedly null.");
                }
                api.sendEventToNative(paramsArg);
                wrapped.put("result", null);
              }
              catch (Error | RuntimeException exception) {
                wrapped.put("error", wrapError(exception));
              }
              reply.reply(wrapped);
            });
          } else {
            channel.setMessageHandler(null);
          }
        }
      }
    }
    private static class FlutterRouterApiCodec extends StandardMessageCodec {
      public static final FlutterRouterApiCodec INSTANCE = new FlutterRouterApiCodec();
      private FlutterRouterApiCodec() {}
      @Override
      protected Object readValueOfType(byte type, ByteBuffer buffer) {
        switch (type) {
          case (byte)128:
            return CommonParams.fromMap((Map<String, Object>) readValue(buffer));
  
          default:
            return super.readValueOfType(type, buffer);
  
        }
      }
      @Override
      protected void writeValue(ByteArrayOutputStream stream, Object value)     {
        if (value instanceof CommonParams) {
          stream.write(128);
          writeValue(stream, ((CommonParams) value).toMap());
        } else
  {
          super.writeValue(stream, value);
        }
      }
    }
  
    /** Generated class from Pigeon that represents Flutter messages that can be called from Java.*/
    public static class FlutterRouterApi {
      private final BinaryMessenger binaryMessenger;
      public FlutterRouterApi(BinaryMessenger argBinaryMessenger){
        this.binaryMessenger = argBinaryMessenger;
      }
      public interface Reply<T> {
        void reply(T reply);
      }
      static MessageCodec<Object> getCodec() {
        return FlutterRouterApiCodec.INSTANCE;
      }
  
      public void pushRoute(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.pushRoute", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void popRoute(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.popRoute", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void removeRoute(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.removeRoute", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void onForeground(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.onForeground", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void onBackground(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.onBackground", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void onNativeResult(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.onNativeResult", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void onContainerShow(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.onContainerShow", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void onContainerHide(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.onContainerHide", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void sendEventToFlutter(CommonParams paramArg, Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.sendEventToFlutter", getCodec());
        channel.send(new ArrayList<Object>(Arrays.asList(paramArg)), channelReply -> {
          callback.reply(null);
        });
      }
      public void onBackPressed(Reply<Void> callback) {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterRouterApi.onBackPressed", getCodec());
        channel.send(null, channelReply -> {
          callback.reply(null);
        });
      }
    }
    private static Map<String, Object> wrapError(Throwable exception) {
      Map<String, Object> errorMap = new HashMap<>();
      errorMap.put("message", exception.toString());
      errorMap.put("code", exception.getClass().getSimpleName());
      errorMap.put("details", "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
      return errorMap;
    }
  }
  