import { Route } from 'react-router-dom';
import Welcome from '@/pages/Welcome';
import Dashboard from '@/pages/Dashboard';
import ScanPage from '@/pages/ScanPage';
import DevicesPage from '@/pages/DevicesPage';
import ConfigPage from '@/pages/ConfigPage';

/**
 * 路由
 * @type {[{path: string, element: JSX.Element},{path: string, element: JSX.Element}]}
 */
const routeList = [
  { path: '/', element: <Welcome /> },
  { path: '/dashboard', element: <Dashboard /> },
  { path: '/dashboard/scan', element: <ScanPage /> },
  { path: '/dashboard/devices', element: <DevicesPage /> },
  { path: '/dashboard/config', element: <ConfigPage /> },
];

const buildRoutes = () =>
  routeList.map(({ path, element }) => <Route key={path} path={path} element={element} />);

export default buildRoutes;
