 import React from "react";
import { HashRouter, Routes, Route } from "react-router-dom";
import Navbar from "./components/Navbar";
import Login from "./pages/Login";
import Register from "./pages/Register";
import Dashboard from "./pages/Dashboard";
import Cars from "./pages/Cars";
import ServiceRecords from "./pages/ServiceRecords";
import Payments from "./pages/Payments";
import Reports from "./pages/Reports";




const ProtectedRoute = ({ children }) => {
  if (!localStorage.getItem('token')) {
    return <Navigate to="/login" />
  }
  return children
}

function App() {


  return (
    <div className="min-h-screen bg-slate-950 font-sans antialiased text-slate-200">
      <HashRouter>
        {/* The Navbar will automatically show or hide links based on localStorage */}
        <Navbar />
        
        {/* Main Content Layout Container */}
        <div className="transition-all duration-300">
          <Routes>
            <Route path="/" element={<Login />} />
            <Route path="/login" element={<Login />} />
            <Route path="/register" element={<Register />} />
            <Route path="/dashboard" element={<Dashboard />} />
            <Route path="/car" element={<Cars />} />
            <Route path="/servicerecord" element={<ServiceRecords />} />
            <Route path="/payment" element={<Payments />} />
            <Route path="/reports" element={<Reports />} />
          </Routes>
        </div>
      </HashRouter>
    </div>
  );
}

export default App;
