import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Home from "./pages/home/home";
import HomeLayout from "./layouts/HomeLayout";
import Downloader from "./pages/downloader/Downloader";
import PrivateRoute from "./routes/PrivateRoute";
import { UserContextProvider } from "./context/UserContext";

// Pages
import PortfolioPage from "./pages/portfolio/PortfolioPage";
import SkillsPage from "./pages/skills/SkillsPage";
import HostingSecurityPage from "./pages/hosting/HostingSecurityPage";
import DonateShopPage from "./pages/donate/DonateShopPage";
import ContactPage from "./pages/contact/ContactPage";
import ScrollToTop from "./components/common/ScrollToTop";

export default function App() {
  return (
    <Router>
      <UserContextProvider>
        <ScrollToTop />
        <Routes>
          {/* Public routes */}
          <Route path="/" element={<HomeLayout />}>
            <Route index element={<Home />} />
            <Route path="portfolio" element={<PortfolioPage />} />
            <Route path="skills" element={<SkillsPage />} />
            <Route path="hosting-security" element={<HostingSecurityPage />} />
            <Route path="donate" element={<DonateShopPage />} />
            <Route path="contact" element={<ContactPage />} />

            {/* Utilities */}
            <Route path="downloader" element={<Downloader />} />
          </Route>

          {/* Example protected route group (kept for future use) */}
          <Route element={<PrivateRoute />}>
            <Route path="/" element={<HomeLayout />}>
              <Route path="protected-downloader" element={<Downloader />} />
            </Route>
          </Route>
        </Routes>
      </UserContextProvider>
    </Router>
  );
}