import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import Layout from './components/Layout';
import { AdminAuthProvider } from './context/AdminAuthContext';
import { AuthProvider } from './context/AuthContext';
import AdminLayout from './pages/admin/AdminLayout';
import AdminLoginPage from './pages/admin/AdminLoginPage';
import AdminPage from './pages/admin/AdminPage';
import AdminSchedulePage from './pages/admin/AdminSchedulePage';
import AdminStorePage from './pages/admin/AdminStorePage';
import AdminThemeEditPage from './pages/admin/AdminThemeEditPage';
import AdminThemePage from './pages/admin/AdminThemePage';
import HomePage from '@_pages/HomePage';
import LoginPage from '@_pages/LoginPage';
import MyReservationPage from '@_pages/MyReservationPage';
import ReservationFormPage from '@_pages/ReservationFormPage';
import ReservationStep1Page from '@_pages/ReservationStep1Page';
import ReservationStep2Page from '@_pages/ReservationStep2Page';
import ReservationSuccessPage from '@_pages/ReservationSuccessPage';
import SignupPage from '@_pages/SignupPage';

function App() {
    return (
        <AuthProvider>
            <Router>
                <Routes>
                    <Route path="/admin/*" element={
                        <AdminAuthProvider>
                            <Routes>
                                <Route path="/login" element={<AdminLoginPage />} />
                                <Route path="/*" element={
                                    <AdminLayout>
                                        <Routes>
                                            <Route path="/" element={<AdminPage />} />
                                            <Route path="/theme" element={<AdminThemePage />} />
                                            <Route path="/theme/edit/:themeId" element={<AdminThemeEditPage />} />
                                            <Route path="/store" element={<AdminStorePage />} />
                                            <Route path="/schedule" element={<AdminSchedulePage />} />
                                        </Routes>
                                    </AdminLayout>
                                } />
                            </Routes>
                        </AdminAuthProvider>
                    } />
                    <Route path="/*" element={
                        <Layout>
                            <Routes>
                                <Route path="/" element={<HomePage/>} />
                                <Route path="/login" element={<LoginPage />} />
                                <Route path="/signup" element={<SignupPage />} />
                                <Route path="/reservation" element={<ReservationStep1Page />} />
                                <Route path="/reservation/form" element={<ReservationFormPage />} />
                                <Route path="/reservation/payment" element={<ReservationStep2Page />} />
                                <Route path="/reservation/success" element={<ReservationSuccessPage />} />
                                <Route path="/my-reservation" element={<MyReservationPage />} />
                            </Routes>
                        </Layout>
                    } />
                </Routes>
            </Router>
        </AuthProvider>
    );
}

export default App;
