import FaJson from "@/langs/fa.json";
import { AuthProvider } from "@/context/AuthContext";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import i18next from "i18next";
import { type FC } from "react";
import { I18nextProvider } from "react-i18next";
import "react-multi-date-picker/styles/layouts/mobile.css";
import { BrowserRouter } from "react-router-dom";
import "./assets/fonts/irancell/style.css";
import "./assets/fonts/irancell/fonts-editor/fonts.css";
import ToastContainer from "./components/Toast";
import MainRouter from "./router/MainRouter";

i18next.init({
  interpolation: { escapeValue: false },
  lng: "fa",
  resources: {
    fa: {
      global: FaJson,
    },
  },
});

const queryClient = new QueryClient();

const App: FC = () => {
  return (
    <BrowserRouter>
      <AuthProvider>
        <I18nextProvider i18n={i18next}>
          <QueryClientProvider client={queryClient}>
            <MainRouter />
            <ToastContainer />
          </QueryClientProvider>
        </I18nextProvider>
      </AuthProvider>
    </BrowserRouter>
  );
};

export default App;
