import {BrowserRouter, Routes, Route, Navigate} from "react-router-dom";

import Login from "@/pages/Login";

import DashboardLayout from "./layouts/DashboardLayout";
import Blog from "./pages/Blog";

// import ProtectedRoute from "./components/ProtectedRoutes/ProtectedRoutes";

import ProtectedRoute from "./auth/ProtectedRoute";
import PublicRoute from "./auth/PublicRoute";
import {AuthProvider} from "./context/AuthContext";
import Department from "./pages/Department";
import Doctor from "./pages/Doctor";

export default function App() {
	return (
		<BrowserRouter>
			<AuthProvider>
				<Routes>
					<Route element={<PublicRoute />}>
						<Route path="/" element={<Login />} />
					</Route>

					<Route element={<ProtectedRoute />}>
						<Route element={<DashboardLayout />}>
							<Route path="/blog" element={<Blog />} />
							<Route path="/department" element={<Department />} />
							<Route path="/doctor" element={<Doctor />} />
						</Route>
					</Route>

					<Route path="*" element={<Navigate to="/department" replace />} />
				</Routes>
			</AuthProvider>
		</BrowserRouter>
	);
}
