import { createBrowserRouter } from "react-router-dom";
import { AppLayout } from "./layouts/AppLayout";
import { DashboardPage } from "../pages/DashboardPage";
import { RacesPage } from "../pages/RacesPage";
import { RaceDetailsPage } from "../pages/RaceDetailsPage";
import { RaceFormPage } from "../pages/RaceFormPage";

export const appRouter = createBrowserRouter([
  {
    path: "/",
    element: <AppLayout />,
    children: [
      { index: true, element: <DashboardPage /> },
      { path: "races", element: <RacesPage /> },
      { path: "races/new", element: <RaceFormPage /> },
      { path: "races/:raceId", element: <RaceDetailsPage /> },
      { path: "races/:raceId/edit", element: <RaceFormPage /> },
    ],
  },
]);
