import { createBrowserRouter } from "react-router-dom";
import AppLayout from "../components/layout/AppLayout";
import AuditLogsPage from "../features/audit/AuditLogsPage";
import AuthPage from "../features/auth/AuthPage";
import DashboardPage from "../features/dashboard/DashboardPage";
import GlobalOverviewPage from "../features/overview/GlobalOverviewPage";
import TenantCreatePage from "../features/tenants/TenantCreatePage";
import TenantDetailPage from "../features/tenants/TenantDetailPage";
import TenantListPage from "../features/tenants/TenantListPage";

export const router = createBrowserRouter(
  [
    {
      path: "/",
      element: <AppLayout />,
      children: [
        { index: true, element: <GlobalOverviewPage /> },
        { path: "dashboard", element: <DashboardPage /> },
        { path: "audit-logs", element: <AuditLogsPage /> },
        { path: "auth", element: <AuthPage /> },
        { path: "tenants", element: <TenantListPage /> },
        { path: "tenants/new", element: <TenantCreatePage /> },
        { path: "tenants/:id", element: <TenantDetailPage /> },
      ],
    },
  ],
  // React Router v7 플래그 사전 적용 (현재 타입 정의에 없어 any 캐스팅)
  {
    future: {
      v7_startTransition: true,
    },
  } as unknown as Parameters<typeof createBrowserRouter>[1],
);
