import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import Login from './components/Login';
import Register from './components/Register';
import Dashboard from './components/Dashboard';
import EmployeeForm from './components/EmployeeForm';
import DepartmentForm from './components/DepartmentForm';
import SalaryForm from './components/SalaryForm';
import Reports from './components/Reports';
import PrivateRoute from './components/PrivateRoute';

function App() {
  return (
    <Router>
      <Routes>
        <Route path="/login" element={<Login />} />
        <Route path="/register" element={<Register />} />
        <Route path="/" element={<PrivateRoute><Dashboard /></PrivateRoute>} />
        <Route path="/employees" element={<PrivateRoute><EmployeeForm /></PrivateRoute>} />
        <Route path="/departments" element={<PrivateRoute><DepartmentForm /></PrivateRoute>} />
        <Route path="/salaries" element={<PrivateRoute><SalaryForm /></PrivateRoute>} />
        <Route path="/reports" element={<PrivateRoute><Reports /></PrivateRoute>} />
      </Routes>
    </Router>
  );
}

export default App;