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";
import { RaceDayPage } from "../pages/RaceDayPage";

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