import { Navigate, Route, Routes } from 'react-router-dom'

import { Toaster } from '@renderer/components/ui/sonner'
import { AppLayout } from '@renderer/layouts/AppLayout'
import { ClassPage } from '@renderer/pages/ClassPage'
import { StudentPage } from '@renderer/pages/StudentPage'
import { PlaceholderPage } from '@renderer/pages/PlaceholderPage'
import { SettingsPage } from '@renderer/pages/SettingsPage'
import { ToolsPage } from '@renderer/pages/ToolsPage'
import { TemplatePage } from '@renderer/pages/TemplatePage'
import { ReportPage } from '@renderer/pages/ReportPage'

function App(): React.JSX.Element {
  return (
    <>
      <Routes>
        <Route element={<AppLayout />}>
          <Route index element={<Navigate to="/student/list" replace />} />
          <Route path="tools" element={<Navigate to="/tools/comments" replace />} />
          <Route path="tools/image-paths" element={<PlaceholderPage title="生成图片路径" />} />
          <Route path="tools/comments" element={<ToolsPage />} />
          <Route path="tools/reports" element={<PlaceholderPage title="生成报告" />} />
          <Route path="tools/convert" element={<PlaceholderPage title="格式转换" />} />
          <Route path="tools/signature" element={<PlaceholderPage title="园长签名" />} />
          <Route path="student" element={<Navigate to="/student/list" replace />} />
          <Route path="student/list" element={<StudentPage />} />
          <Route path="student/classes" element={<ClassPage />} />
          <Route path="student/templates" element={<TemplatePage />} />
          <Route path="student/reports" element={<ReportPage />} />
          <Route path="student/backup" element={<PlaceholderPage title="备份恢复" />} />
          <Route path="settings" element={<SettingsPage />} />
          <Route path="*" element={<Navigate to="/student/list" replace />} />
        </Route>
      </Routes>
      <Toaster />
    </>
  )
}

export default App
