import { Toaster } from "@/components/ui/toaster";
import { Toaster as Sonner } from "@/components/ui/sonner";
import { TooltipProvider } from "@/components/ui/tooltip";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { AuthProvider } from "@/hooks/useAuth";
import { CartProvider } from "@/contexts/CartContext";
import Index from "./pages/Index";
import Auth from "./pages/Auth";
import Products from "./pages/Products";
import ProductDetail from "./pages/ProductDetail";
import Checkout from "./pages/Checkout";
import Bootcamp from "./pages/Bootcamp";
import Events from "./pages/Events";
import ConsultingBooking from "./pages/ConsultingBooking";
import NotFound from "./pages/NotFound";

// Member pages
import MemberDashboard from "./pages/member/MemberDashboard";
import MemberAccess from "./pages/member/MemberAccess";
import MemberOrders from "./pages/member/MemberOrders";
import MemberProfile from "./pages/member/MemberProfile";

// Admin pages
import AdminDashboard from "./pages/admin/AdminDashboard";
import AdminProducts from "./pages/admin/AdminProducts";
import AdminBootcamp from "./pages/admin/AdminBootcamp";
import AdminOrders from "./pages/admin/AdminOrders";
import AdminMembers from "./pages/admin/AdminMembers";
import AdminEvents from "./pages/admin/AdminEvents";
import AdminSettings from "./pages/admin/AdminSettings";
import AdminConsulting from "./pages/admin/AdminConsulting";

const queryClient = new QueryClient();

const App = () => (
  <QueryClientProvider client={queryClient}>
    <TooltipProvider>
      <AuthProvider>
        <CartProvider>
          <Toaster />
          <Sonner />
          <BrowserRouter>
            <Routes>
              <Route path="/" element={<Index />} />
              <Route path="/auth" element={<Auth />} />
              <Route path="/products" element={<Products />} />
              <Route path="/products/:slug" element={<ProductDetail />} />
              <Route path="/checkout" element={<Checkout />} />
              <Route path="/events" element={<Events />} />
              <Route path="/bootcamp/:slug" element={<Bootcamp />} />
              <Route path="/consulting" element={<ConsultingBooking />} />
              
              {/* Member routes */}
              <Route path="/dashboard" element={<MemberDashboard />} />
              <Route path="/access" element={<MemberAccess />} />
              <Route path="/orders" element={<MemberOrders />} />
              <Route path="/profile" element={<MemberProfile />} />
              
              {/* Admin routes */}
              <Route path="/admin" element={<AdminDashboard />} />
              <Route path="/admin/products" element={<AdminProducts />} />
              <Route path="/admin/bootcamp" element={<AdminBootcamp />} />
              <Route path="/admin/orders" element={<AdminOrders />} />
              <Route path="/admin/members" element={<AdminMembers />} />
              <Route path="/admin/events" element={<AdminEvents />} />
              <Route path="/admin/settings" element={<AdminSettings />} />
              <Route path="/admin/consulting" element={<AdminConsulting />} />
              
              <Route path="*" element={<NotFound />} />
            </Routes>
          </BrowserRouter>
        </CartProvider>
      </AuthProvider>
    </TooltipProvider>
  </QueryClientProvider>
);

export default App;
