import { RouteObject } from "react-router-dom";
import App from "../App";
import LoginPage from "../pages/LoginPage";
import MainOverlayPage from "../pages/MainOverlayPage";
import NotFound_404 from "../pages/NotFound_404";
import OrdersPage from "../pages/OrdersPage";

// ----- ROUTES CONFIGURATION -----
// Configuration of the application's route structure
const routes: RouteObject[] = [
	{
		path: "/",
		element: <App />,
		children: [
			{
				element: <MainOverlayPage />,
				children: [
					{
						path: "/orders",
						element: <OrdersPage />,
						loader: () =>
							fetch("https://dummyjson.com/users").then((res) => res.json()),
					},
				],
			},
			{
				path: "/login",
				element: <LoginPage />,
			},
		],
	},
	{
		path: "*",
		element: <NotFound_404 />,
	},
];
export default routes;
