import React from 'react'
import { BrowserRouter, Routes, Route } from 'react-router-dom'
import { AppQueryProvider } from './lib/queries'
import { ErrorBoundary } from './components/ErrorBoundary'
import { NavBar } from './components/NavBar'
import { LTTPage } from './pages/LTTPage'
import { RAGDatabasePage } from './pages/RAGDatabasePage'
import { SystemPromptsPage } from './pages/SystemPromptsPage'
import { HistoryPage } from './pages/HistoryPage'
import { PdfViewerPage } from './pages/PdfViewerPage'

export default function App(): JSX.Element {
  return (
    <BrowserRouter>
      <AppQueryProvider>
        <ErrorBoundary>
          <Routes>
            <Route path="/pdf-viewer" element={<PdfViewerPage />} />
            <Route path="*" element={
              <div className="h-screen flex flex-col">
                <NavBar />
                <div className="flex-1 overflow-auto">
                  <Routes>
                    <Route path="/" element={<LTTPage />} />
                    <Route path="/rag-database" element={<RAGDatabasePage />} />
                    <Route path="/system-prompts" element={<SystemPromptsPage />} />
                    <Route path="/history" element={<HistoryPage />} />
                  </Routes>
                </div>
              </div>
            } />
          </Routes>
        </ErrorBoundary>
      </AppQueryProvider>
    </BrowserRouter>
  )
}
