import localFont from 'next/font/local';
import './globals.css';
import { useLocale } from 'next-intl';
// import { notFound } from 'next/navigation';
import { AntdRegistry } from '@ant-design/nextjs-registry';
import { ConfigProvider } from 'antd';
import theme from '@/theme/themeConfig';
import { ToastContainer, Bounce } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import StoreProvider from '@/app/storeProvider';
import { Suspense } from 'react';
import IntlProvider from './IntlProvider';
import AppLoading from '@/components/ui/loading';

const geistSans = localFont({
  src: './fonts/GeistVF.woff',
  variable: '--font-geist-sans',
  weight: '100 900',
});

const geistMono = localFont({
  src: './fonts/GeistMonoVF.woff',
  variable: '--font-geist-mono',
  weight: '100 900',
});
declare global {
  interface Window {
    BEObj?: {
      getContentsURL: (params: any) => string;
      openContent: (params: any) => void;
      startAppWithCustomAuth: (param: any) => void
      hosts_staging: any
    };
    opera?: any;
    Multipayment: any;
  }
}
type PropsType = Readonly<{ children: React.ReactNode }>

export default function RootLayout({ children }: PropsType) {
  const locale = useLocale();

  return (
    <html lang={locale}>
      <head>
        <script type="text/javascript" src="https://bookend.keyring.net/js/beobj.js" async defer> </script>
        <script type="text/javascript" src="https://stg.static.mul-pay.jp/ext/js/token.js" async defer></script>
        <script src="https://accounts.google.com/gsi/client" async defer></script>
      </head>
      <body
        className={`${geistSans.variable} ${geistMono.variable} font-sans`}
        suppressHydrationWarning
      >
        <Suspense fallback={<AppLoading/>}>
          <StoreProvider>
            <AntdRegistry>
              <ConfigProvider theme={theme}>
                <IntlProvider>
                  {children}
                </IntlProvider>
              </ConfigProvider>
            </AntdRegistry>
            <ToastContainer
              position="top-right"
              autoClose={5000}
              hideProgressBar
              newestOnTop
              closeOnClick
              rtl={false}
              pauseOnFocusLoss
              draggable
              pauseOnHover
              theme="colored"
              transition={Bounce}
            />
          </StoreProvider>
        </Suspense>
      </body>
    </html>
  );
}
