import { createBrowserRouter } from 'react-router-dom'
import { AppLayout } from '@/components/layout/AppLayout'
import { Login } from '@/pages/Login'
import { Dashboard } from '@/pages/Dashboard'
import { Feed } from '@/pages/Feed'
import { Watchlist } from '@/pages/Watchlist'
import { AdminLayout } from '@/pages/admin/AdminLayout'
import { AIProviders } from '@/pages/admin/AIProviders'
import { Credentials } from '@/pages/admin/Credentials'
import { Sources } from '@/pages/admin/Sources'
import { Jobs } from '@/pages/admin/Jobs'
import { AdminUsers } from '@/pages/admin/AdminUsers'
import { AdminSettings } from '@/pages/admin/AdminSettings'
import { Schedule } from '@/pages/admin/Schedule'
import { Reports } from '@/pages/Reports'

export const router = createBrowserRouter([
  { path: '/login', element: <Login /> },
  {
    element: <AppLayout />,
    children: [
      { path: '/', element: <Dashboard /> },
      { path: '/feed', element: <Feed /> },
      { path: '/watchlist', element: <Watchlist /> },
      { path: '/reports', element: <Reports /> },
      {
        path: '/admin',
        element: <AdminLayout />,
        children: [
          { index: true, element: <AIProviders /> },
          { path: 'ai', element: <AIProviders /> },
          { path: 'credentials', element: <Credentials /> },
          { path: 'sources', element: <Sources /> },
          { path: 'jobs', element: <Jobs /> },
          { path: 'users', element: <AdminUsers /> },
          { path: 'settings', element: <AdminSettings /> },
          { path: 'schedule', element: <Schedule /> },
        ],
      },
    ],
  },
])
