import { BrowserRouter as Router, Routes, Route, Link, Outlet } 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";


export default function App() {
  return (
    <Router>
      <UserContextProvider>
      
        {/* Layout route */}
        <Route path="/" element={<HomeLayout />}>
          <Route index element={<Home />} />
          <Route path="downloader" element={<Downloader />} />
        </Route>

        <Route element={<PrivateRoute />}>
          {/* Protected routes go here */}
          <Route path="/" element={<HomeLayout />} >
            <Route path="protected-downloader" element={<Downloader />} />
          </Route>

        </Route>

      </UserContextProvider>
    </Router>
  )
}