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

import Login from "@/pages/Login";

import DashboardLayout from "./layouts/DashboardLayout";

// 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";
import Blog from "./pages/Blog";

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

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

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