import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
import AuthGate from './components/AuthGate'
import Layout from './components/Layout'
import Summary from './pages/Summary'
import HistoryPage from './pages/History'
import Assets from './pages/Assets'
import Contractors from './pages/Contractors'
import Recurring from './pages/Recurring'
import Locations from './pages/Locations'
import Settings from './pages/Settings'

export default function App() {
  return (
    <BrowserRouter basename="/maintenance">
      <AuthGate>
        <Layout>
          <Routes>
            <Route path="/" element={<Navigate to="/summary" replace />} />
            <Route path="/summary" element={<Summary />} />
            <Route path="/history" element={<HistoryPage />} />
            <Route path="/assets" element={<Assets />} />
            <Route path="/contractors" element={<Contractors />} />
            <Route path="/recurring" element={<Recurring />} />
            <Route path="/locations" element={<Locations />} />
            <Route path="/settings" element={<Settings />} />
            <Route path="*" element={<Navigate to="/summary" replace />} />
          </Routes>
        </Layout>
      </AuthGate>
    </BrowserRouter>
  )
}
