import ReactDOM from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import App from "./App";
import Landing from "./pages/Landing";
import Home from "./pages/Home";
import ErrorPage from "./pages/404";
import Login from "./pages/Login";
import AuthCallback from "./pages/AuthCallback";
import { AuthProvider } from "./context/AuthContext";
import Boutique from "./pages/Boutique";
import Achievements from "./pages/Achievements";
import Legal from "./pages/Legal";
import Cookie from "./pages/Cookie";

const router = createBrowserRouter([
  {
    path: "/",
    element: <App />,
    children: [
      {
        path: "/",
        element: <Landing />,
      },
      {
        path: "/jeu",
        element: <Home />,
      },
      {
        path: "/boutique",
        element: <Boutique />,
      },
      {
        path: "/achievements",
        element: <Achievements />,
      },
      {
        path: "/mentionslegales",
        element: <Legal />,
      },
      {
        path: "/cookies",
        element: <Cookie />,
      },
      {
        path: "/login",
        element: <Login />,
      },
      {
        path: "/callback",
        element: <AuthCallback />,
      },
      {
        path: "*",
        element: <ErrorPage />,
      },
    ],
  },
]);

const root = ReactDOM.createRoot(document.getElementById("root"));

root.render(
  <AuthProvider>
    <RouterProvider router={router} />
  </AuthProvider>
);
