/**
 * BoostMedia AI Content Generator Admin - Main App Component
 *
 * @package BoostMedia_AI
 * @license GPL-2.0-or-later
 */

import { Routes, Route, Navigate } from 'react-router-dom'
import { DataLanguageProvider } from './lib/DataLanguageContext'
import { TranslationProvider } from './lib/TranslationContext'
import { OnboardingProvider } from './hooks/useOnboarding'
import Layout from './components/layout/Layout'
import Dashboard from './pages/Dashboard'
import PostTypesList from './pages/PostTypesList'
import ContentGenerator from './pages/ContentGenerator'
import GeneratedContentPage from './pages/GeneratedContentPage'
import LogsPage from './pages/LogsPage'
import UsagePage from './pages/UsagePage'
import UpdatesPage from './pages/UpdatesPage'
import SettingsPage from './pages/SettingsPage'
import LinksPage from './pages/LinksPage'
import ReportersPage from './pages/ReportersPage'
import ContentPlansPage from './pages/ContentPlansPage'
import JobsPage from './pages/JobsPage'

function App() {
  return (
    <TranslationProvider>
      <OnboardingProvider>
        <DataLanguageProvider>
          <Routes>
            <Route path="/" element={<Layout />}>
              <Route index element={<Dashboard />} />
              <Route path="dashboard" element={<Dashboard />} />
              <Route path="post-types" element={<PostTypesList />} />
              <Route path="generate" element={<ContentGenerator />} />
              <Route path="plans" element={<ContentPlansPage />} />
              <Route path="jobs" element={<JobsPage />} />
              <Route path="generated" element={<GeneratedContentPage />} />
              <Route path="links" element={<LinksPage />} />
              <Route path="reporters" element={<ReportersPage />} />
              <Route path="logs" element={
                (window as any).bmaiSettings?.debugMode
                  ? <LogsPage />
                  : <Navigate to="/dashboard" replace />
              } />
              <Route path="usage" element={<UsagePage />} />
              <Route path="updates" element={<UpdatesPage />} />
              <Route path="settings" element={<SettingsPage />} />
            </Route>
          </Routes>
        </DataLanguageProvider>
      </OnboardingProvider>
    </TranslationProvider>
  )
}

export default App
