import { Routes, Route, Navigate } from 'react-router-dom'
import AuthGate from './components/AuthGate'
import Layout from './components/Layout'
import Bookability from './pages/Bookability'
import MarketView from './pages/MarketView'
import DirectRates from './pages/DirectRates'
import RateAnalysis from './pages/RateAnalysis'
import Settings from './pages/Settings'

export default function App() {
  return (
    <AuthGate>
      <Layout>
        <Routes>
          <Route path="/" element={<Navigate to="/bookability" replace />} />
          <Route path="/bookability" element={<Bookability />} />
          <Route path="/market" element={<MarketView />} />
          <Route path="/direct" element={<DirectRates />} />
          <Route path="/direct/:hotelId" element={<DirectRates />} />
          <Route path="/analysis" element={<RateAnalysis />} />
          <Route path="/settings" element={<Settings />} />
          <Route path="/settings/:tab" element={<Settings />} />
          <Route path="*" element={<Navigate to="/bookability" replace />} />
        </Routes>
      </Layout>
    </AuthGate>
  )
}
