import { Routes, Route, Navigate } from 'react-router-dom';
import { useBasketUrlSync } from '../../shared/state/useBasketUrlSync';
import { ProvidersRoute } from './routes/Providers';
import { PackagesRoute } from './routes/Packages';
import { ComparisonRoute } from './routes/Comparison';
import { AppCompareBar } from './AppCompareBar';

export function App() {
  useBasketUrlSync();

  return (
    <>
      <Routes>
        <Route path="/" element={<ProvidersRoute />} />
        <Route path="/providers/:providerId/packages" element={<PackagesRoute />} />
        <Route path="/comparison" element={<ComparisonRoute />} />
        <Route path="*" element={<Navigate to="/" replace />} />
      </Routes>
      <AppCompareBar />
    </>
  );
}
