import { createBrowserRouter } from 'react-router-dom';
import { AppShell } from '@/components/layout/app-shell';
import { RequireAuth } from '@/components/layout/require-auth';
import { LoginRoute } from '@/routes/login';
import { IndexRoute } from '@/routes/index';
import { CompaniesRoute } from '@/routes/companies';
import { SourcesRoute } from '@/routes/sources';
import { TelegramRoute } from '@/routes/telegram';
import { TailRoute } from '@/routes/tail';
import { DLQRoute } from '@/routes/dlq';
import { AuditRoute } from '@/routes/audit';
import { NotFoundRoute } from '@/routes/not-found';
import { ForbiddenRoute } from '@/routes/forbidden';

export const router = createBrowserRouter([
  { path: '/login', element: <LoginRoute /> },
  { path: '/forbidden', element: <ForbiddenRoute /> },
  {
    element: (
      <RequireAuth>
        <AppShell />
      </RequireAuth>
    ),
    children: [
      { path: '/', element: <IndexRoute /> },
      { path: '/companies/*', element: <CompaniesRoute /> },
      { path: '/sources/*', element: <SourcesRoute /> },
      { path: '/telegram/*', element: <TelegramRoute /> },
      { path: '/tail', element: <TailRoute /> },
      { path: '/dlq', element: <DLQRoute /> },
      { path: '/audit', element: <AuditRoute /> },
    ],
  },
  { path: '*', element: <NotFoundRoute /> },
]);
