// project import
import Routes from 'routes';
import ThemeCustomization from 'themes';
import Locales from 'components/Locales';
// import RTLLayout from 'components/RTLLayout';
import ScrollTop from 'components/ScrollTop';
import Snackbar from 'components/@extended/Snackbar';
import Notistack from 'components/third-party/Notistack';

// to remove cosole in production
import './utils/suppressConsole';

// auth-provider
import { JWTProvider as AuthProvider } from 'contexts/JWTContext';
import { useEffect } from 'react';
import InternetStatus from 'components/nearle_components/updateNetworkStatus';
import { generateToken, initFirebaseNotificationListener } from 'firebase_notification/notification';

// ==============================|| APP - THEME, ROUTER, LOCAL  ||============================== //

const App = () => {
  useEffect(() => {
    generateToken();
    initFirebaseNotificationListener(); // foreground message listener
  }, []);

  useEffect(() => {
    localStorage.setItem('loginstatus', 0);
  }, []);

  return (
    <>
      <ThemeCustomization>
        <InternetStatus />
        {/* <RTLLayout> */}
        <Locales>
          <ScrollTop>
            <AuthProvider>
              <>
                <Notistack>
                  <Routes />
                  <Snackbar />
                </Notistack>
              </>
            </AuthProvider>
          </ScrollTop>
        </Locales>
        {/* </RTLLayout> */}
      </ThemeCustomization>
    </>
  );
};
export default App;
