import { Context, Env, Hono } from "hono";
import { AppLoadContext, RouterContextProvider, ServerBuild, UNSAFE_MiddlewareEnabled } from "react-router";
import { HonoOptions } from "hono/hono-base";
import { BlankEnv } from "hono/types";

//#region src/presets/hono-server.d.ts
type ReactRouterAppLoadContext = UNSAFE_MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext;
type HonoServerOptions<E extends Env = BlankEnv> = {
  configure?: <E extends Env = BlankEnv>(app: Hono<E>) => Promise<void> | void;
  getLoadContext?: (c: Context<E>, options: {
    build: ServerBuild;
    mode?: string;
  }) => Promise<ReactRouterAppLoadContext> | ReactRouterAppLoadContext;
  honoOptions?: HonoOptions<E>;
};
//#endregion
export { HonoServerOptions as t };