// 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";

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

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

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

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

export default App;
