import React, { ReactNode } from 'react';
import { getAppRouter } from './nativePlatform';

type AppRouterProps = {
  children: ReactNode;
};

/**
 * Single place that chooses BrowserRouter (web) vs HashRouter (Capacitor).
 * Avoids sprinkling Capacitor.isNativePlatform() through the route tree (#24).
 */
const AppRouter = ({ children }: AppRouterProps): JSX.Element => {
  const Router = getAppRouter();
  return <Router>{children}</Router>;
};

export default AppRouter;
