import React from "react";
import { Navigate, Route, Routes } from "react-router-dom";
import ScrollToTop from "../components/common/ScrollToTop.jsx";
import Login from "../components/auth/Login.jsx";
import AuthCallback from "../components/auth/AuthCallback.jsx";
import ProtectedRoute from "../components/auth/ProtectedRoute.jsx";
import MasterDashboard from "../components/features/master-dashboard/MasterDashboard.jsx";
import PersonalizedDashboard from "../components/features/master-dashboard/PersonalizedDashboard.jsx";

export default function AppRoutes() {
  return (
    <>
      <ScrollToTop />
      <Routes>
        <Route path="/login" element={<Login />} />
        <Route path="/auth/callback" element={<AuthCallback />} />
        <Route
          path="/"
          element={
            <ProtectedRoute>
              <MasterDashboard />
            </ProtectedRoute>
          }
        />
        <Route
          path="/personalized-dashboard"
          element={
            <ProtectedRoute>
              <PersonalizedDashboard />
            </ProtectedRoute>
          }
        />
        <Route path="*" element={<Navigate to="/" replace />} />
      </Routes>
    </>
  );
}
