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

import ProtectedRoute from './components/ProtectedRoute';

import DashboardLayout from './components/DashboardLayout';

import Login from './pages/Login';

import Register from './pages/Register';

import DashboardHome from './pages/DashboardHome';

import Items from './pages/Items';

import Report from './pages/Report';

import Profile from './pages/Profile';



function App() {

  return (

    <Routes>

      <Route path="/login" element={<Login />} />

      <Route path="/register" element={<Register />} />



      <Route

        path="/dashboard"

        element={

          <ProtectedRoute>

            <DashboardLayout />

          </ProtectedRoute>

        }

      >

        {/* dashboard routes — add a <Route> here when you add a new <Link> in DashboardLayout.jsx */}

        <Route index element={<DashboardHome />} />

        <Route path="items" element={<Items />} />

        <Route path="report" element={<Report />} />

        <Route path="profile" element={<Profile />} />

      </Route>



      <Route path="/items" element={<Navigate to="/dashboard/items" replace />} />

      <Route path="/" element={<Navigate to="/dashboard" replace />} />

      <Route path="*" element={<Navigate to="/dashboard" replace />} />

    </Routes>

  );

}



export default App;

