import LoginLayout from "@/LoginLayout";
import Banners from "@/pages/Banners";
import Categories from "@/pages/Categories";
import Faq from "@/pages/Faq";
import HomePage from "@/pages/Home";
import Orders from "@/pages/Orders";
import PriceType from "@/pages/PriceType";
import Product from "@/pages/Product";
import Questionnaire from "@/pages/Questionnaire";
import Units from "@/pages/Units";
import Users from "@/pages/Users";
import routesConfig from "@/providers/routing/config";
import { Navigate, useRoutes } from "react-router-dom";

const AppRouter = () => {
  const routes = useRoutes([
    routesConfig,
    {
      path: "*",
      element: <Navigate to="/" />,
    },
    {
      path: "/dashboard",
      element: (
        <LoginLayout>
          <HomePage />
        </LoginLayout>
      ),
    },
    {
      path: "/dashboard/products",
      element: <Product />,
    },
    {
      path: "/dashboard/categories",
      element: <Categories />,
    },
    {
      path: "/dashboard/units",
      element: <Units />,
    },
    {
      path: "/dashboard/banners",
      element: <Banners />,
    },
    {
      path: "/dashboard/orders",
      element: <Orders />,
    },
    {
      path: "/dashboard/users",
      element: <Users />,
    },
    {
      path: "/dashboard/faq",
      element: <Faq />,
    },
    {
      path: "/dashboard/questionnaire",
      element: <Questionnaire />,
    },
    {
      path: "/dashboard/price-type",
      element: <PriceType />,
    },
  ]);

  return routes;
};

export default AppRouter;
