import type {RouteObject} from 'react-router-dom'
import { Navigate } from 'react-router-dom'
import AboutPage from './pages/AboutPage'
import AdminPage from './pages/AdminPage'
import AdminContestsPage from './pages/AdminContestsPage'
import AdminNewsPage from './pages/AdminNewsPage'
import AdminEvaluationPage from './pages/AdminEvaluationPage'
import AdminUsersPage from './pages/AdminUsersPage'
import LoginPage from './pages/LoginPage'
import ContestsIndexPage from "./pages/ContestsIndexPage";
import ContestDetailPage from "./pages/ContestDetailPage";
import RoundDetailPage from "./pages/RoundDetailPage";
import LogDetailPage from "./pages/LogDetailPage";
import TwoPaneLayout from "@/layouts/TwoPaneLayout";
import ContestsLeftPanel from '@/components/layout/ContestsLeftPanel'
import AppBreadcrumbs from "@/components/AppBreadcrumbs";
// https://reactrouter.com/start/declarative/routing

const routes: RouteObject[] = [
  {
    path: '/',
    element: <Navigate to="/contests" replace />,
  },
  {
    path: '/about',
    element: <AboutPage />,
  },
  {
    path: '/admin',
    element: <AdminPage />,
  },
  {
    path: '/admin/contests',
    element: <AdminContestsPage />,
  },
  {
    path: '/admin/news',
    element: <AdminNewsPage />,
  },
  {
    path: '/admin/evaluation-rule-sets',
    element: <AdminEvaluationPage />,
  },
  {
    path: '/admin/users',
    element: <AdminUsersPage />,
  },
  {
    path: '/login',
    element: <LoginPage />,
  },
  {
    path: "/contests",
    element: (
      <TwoPaneLayout
        value={{
          left: <ContestsLeftPanel />,
          rightTop: <AppBreadcrumbs />,
        }}
      />
    ),
    children: [
      { index: true, element: <ContestsIndexPage /> }, // /contests
      { path: ":contestId", element: <ContestDetailPage /> }, // /contests/:contestId
      { path: ":contestId/rounds/:roundId", element: <RoundDetailPage /> }, // /contests/:contestId/rounds/:roundId
      { path: ":contestId/rounds/:roundId/logs/:logId", element: <LogDetailPage /> }, // detail logu
    ],
  },
]

export default routes
