import { createBrowserRouter, Navigate } from 'react-router-dom';
import LoginPage from '../pages/login/LoginPage';
import RequireAuth from './RequireAuth';

function UsersPlaceholder() {
  return <div data-testid="users-placeholder">users placeholder</div>;
}

export const router = createBrowserRouter([
  { path: '/login', element: <LoginPage /> },
  {
    path: '/users',
    element: (
      <RequireAuth>
        <UsersPlaceholder />
      </RequireAuth>
    ),
  },
  { path: '*', element: <Navigate to="/users" replace /> },
]);
