import { createBrowserRouter, Navigate } from 'react-router-dom';
import { MainPage } from '../../modules/main/pages';
import { NewsDetailsPage, NewsFeedPage } from '../../modules/news/pages';
import { ServiceDetailsPage, ServicesListPage } from '../../modules/services/pages';
import { AdminLoginPage } from '../../modules/admin/pages/login.tsx';
import { AdminDashboardPage } from '../../modules/admin/pages/dashboard.tsx';
import { AdminNewsEditPage } from '../../modules/admin/pages/news-edit.tsx';
import { AdminNewsCreatePage } from '../../modules/admin/pages/news-create.tsx';
import { AdminDashboardNews } from '../../modules/admin/components/news/dashboard-news.tsx';
import { AdminDashboardServices } from '../../modules/admin/components/services/dashboard-services.tsx';
import { AdminDashboardLeads } from '../../modules/admin/components/leads/dashboard-leads.tsx';
import { AdminDashboardAdmins } from '../../modules/admin/components/admins/dashboard-admins.tsx';
import { AdminDashboardServiceCategories } from '../../modules/admin/components/service-categories/dashboard-service-categories.tsx';
import { AdminServiceCreatePage } from '../../modules/admin/pages/service-create.tsx';
import { AdminServiceEditPage } from '../../modules/admin/pages/service-edit.tsx';
import { AdminServiceCategoryCreatePage } from '../../modules/admin/pages/service-category-create.tsx';
import { AdminServiceCategoryEditPage } from '../../modules/admin/pages/service-category-edit.tsx';

export const router = createBrowserRouter([
  {
    path: '/',
    element: <MainPage />,
  },
  {
    path: '/news',
    element: <NewsFeedPage />,
  },
  {
    path: '/news/:slug',
    element: <NewsDetailsPage />,
  },
  {
    path: '/about',
    element: <AboutPage />,
  },
  {
    path: '/services',
    element: <ServicesListPage />,
  },
  {
    path: '/services/:slug',
    element: <ServiceDetailsPage />,
  },
  {
    path: '/admin',
    element: <AdminLoginPage />,
  },
  {
    path: '/admin/dashboard',
    element: <AdminDashboardPage />,
    children: [
      { index: true, element: <Navigate to="news" replace /> },
      { path: 'news/new', element: <AdminNewsCreatePage /> },
      { path: 'news', element: <AdminDashboardNews /> },
      { path: 'news/:slug/edit', element: <AdminNewsEditPage /> },
      { path: 'services/new', element: <AdminServiceCreatePage /> },
      { path: 'services', element: <AdminDashboardServices /> },
      { path: 'services/:serviceId/edit', element: <AdminServiceEditPage /> },
      { path: 'categories/new', element: <AdminServiceCategoryCreatePage /> },
      { path: 'categories', element: <AdminDashboardServiceCategories /> },
      { path: 'categories/:categoryId/edit', element: <AdminServiceCategoryEditPage /> },
      { path: 'leads', element: <AdminDashboardLeads /> },
      { path: 'admins', element: <AdminDashboardAdmins /> },
    ],
  },
]);
import { AboutPage } from '../../modules/about/pages/about.tsx';
