import type { RouteObject } from "react-router";
import LandingPage from "./pages";
import { lazy } from "react";

const LoginPage = lazy(() => import("./pages/login"));
const RegisterPage = lazy(() => import("./pages/register"));
const ProtectedLayout = lazy(() => import("./pages/protected-layout"));
const DashboardPage = lazy(() => import("./pages/dashboard/index"));
const TransactionsPage = lazy(() => import("./pages/dashboard/transactions"));
const CategoriesPage = lazy(() => import("./pages/dashboard/categories"));
const BudgetsPage = lazy(() => import("./pages/dashboard/budgets"));
const GoalsPage = lazy(() => import("./pages/dashboard/goals"));
const RecommendationsPage = lazy(
  () => import("./pages/dashboard/recommendations"),
);
const AnalyticsPage = lazy(() => import("./pages/dashboard/analytics"));
const SettingsPage = lazy(() => import("./pages/dashboard/settings"));

export const routes: RouteObject[] = [
  {
    element: <LandingPage />,
    path: "/",
  },
  {
    element: <LoginPage />,
    path: "/auth/login",
  },
  {
    element: <RegisterPage />,
    path: "/auth/register",
  },

  {
    path: "/dashboard",
    element: <ProtectedLayout />,
    children: [
      { index: true, element: <DashboardPage /> },
      { path: "transactions", element: <TransactionsPage /> },
      { path: "categories", element: <CategoriesPage /> },
      { path: "budgets", element: <BudgetsPage /> },
      { path: "goals", element: <GoalsPage /> },
      { path: "recommendations", element: <RecommendationsPage /> },
      { path: "analytics", element: <AnalyticsPage /> },
      { path: "settings", element: <SettingsPage /> },
    ],
  },
];

export default routes;
