import { lazy } from "react";

import { NavigationPath } from "./navigation";
import type { NavigationRoutes } from "./types";

const HomeViewBase = lazy(() => import("@/pages/home/HomeViewBase"));
const DashboardPage = lazy(() => import("@/pages/dashboard/DashboardPage"));
const SupplementsPage = lazy(() => import("@/pages/supplements/SupplementsPage"));
const WorkPage = lazy(() => import("@/pages/work/WorkPage"));

const LoginPage = lazy(() => import("@/pages/login/LoginPage"));

const routes: NavigationRoutes = {
  private: [
    {
      path: NavigationPath.Root,
      redirectTo: NavigationPath.Home.Base,
    },
    {
      Component: HomeViewBase,
      path: NavigationPath.Home.Base,
      subroutes: [
        {
          path: NavigationPath.Home.Root,
          redirectTo: NavigationPath.Home.Dashboard,
        },
        {
          Component: DashboardPage,
          path: NavigationPath.Home.Dashboard,
        },
        {
          Component: SupplementsPage,
          path: NavigationPath.Home.Supplements,
        },
        {
          Component: WorkPage,
          path: NavigationPath.Home.Work,
        },
      ],
    },
  ],
  public: [
    {
      Component: LoginPage,
      path: NavigationPath.Login,
    },
  ],
};

export default routes;
