import { Routes, Route, Navigate } from 'react-router-dom'
import LoginPage from '@/pages/Login'
import Dashboard from '@/pages/Dashboard'
import UsersPage from '@/pages/UsersPage'
import DashboardLayout from '@/layouts/DashboardLayout'
import CorsPage from '@/pages/CorsPage'
import RateLimitPage from '@/pages/RateLimitPage'
import TagsPage from '@/pages/TagsPage'
import HomesPage from '@/pages/HomesPage'
import ContactsPage from '@/pages/ContactsPage'
import AboutPage from '@/pages/AboutPage'
import ServicesPage from '@/pages/ServicesPage'
import ResumePage from '@/pages/ResumePage'
import { MainMenuList } from "@/features/main-menu/components/MainMenuList"
import SiteSettingsPage from '@/pages/SiteSettingsPage'
import { ProtectedRoute } from '@/components/ProtectedRoute'
import PostCategoriesPage from './pages/blog/PostCategoriesPage'
import PostTagsPage from './pages/blog/PostTagsPage'
import PostsPage from './pages/blog/PostsPage'
import PostCommentsPage from './pages/blog/PostCommentsPage'
import PostCategoryViewsPage from './pages/blog/PostCategoryViewsPage'
import './App.css'
import { Toaster } from '@/components/ui/toaster'

// ... existing imports

function App() {
  return (
    <>
      <Routes>
        <Route path="/login" element={<LoginPage />} />

        <Route element={<ProtectedRoute />}>
          <Route element={<DashboardLayout />}>
            <Route path="/" element={<Dashboard />} />
            <Route path="/users" element={<UsersPage />} />
            <Route path="/cors" element={<CorsPage />} />
            <Route path="/ratelimit" element={<RateLimitPage />} />
            <Route path="/tags" element={<TagsPage />} />
            <Route path="/homes" element={<HomesPage />} />
            <Route path="/about" element={<AboutPage />} />
            <Route path="/services" element={<ServicesPage />} />
            <Route path="/contacts" element={<ContactsPage />} />
            <Route path="/resumes" element={<ResumePage />} />
            <Route path="/main-menu" element={<MainMenuList />} />
            <Route path="/settings" element={<SiteSettingsPage />} />

            {/* Blog Routes */}
            <Route path="/blog/categories" element={<PostCategoriesPage />} />
            <Route path="/blog/tags" element={<PostTagsPage />} />
            <Route path="/blog/posts" element={<PostsPage />} />
            <Route path="/blog/comments" element={<PostCommentsPage />} />
            <Route path="/blog/views" element={<PostCategoryViewsPage />} />
          </Route>

        </Route>

        <Route path="*" element={<Navigate to="/" replace />} />
      </Routes>
      <Toaster />
    </>
  )
}

export default App
