import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { HomePage } from '@pages/home'
import { WalletPage } from '@pages/wallet'
import { SwapPage } from '@pages/swap'
import { BridgePage } from '@pages/bridge'
import { ProfilePage } from '@pages/profile'
import { LoginPage } from '@pages/login'
import { RegisterPage } from '@pages/register'
import { ConverterPage } from '@pages/converter'
import { SeedPhrasePage } from '@pages/seed-phrase'
import { KycPage } from '@pages/kyc'
import { ROUTES } from '@shared/config/routes'
import { ScrollToTop } from './ScrollToTop'
import { ProtectedRoute } from './ProtectedRoute'
import { GuestRoute } from './GuestRoute'

export function RouterProvider() {
  return (
    <BrowserRouter>
      <ScrollToTop />
      <Routes>
        <Route path={ROUTES.HOME} element={<HomePage />} />

        <Route element={<GuestRoute />}>
          <Route path={ROUTES.LOGIN} element={<LoginPage />} />
          <Route path={ROUTES.REGISTER} element={<RegisterPage />} />
        </Route>

        <Route path={ROUTES.CONVERTER} element={<ConverterPage />} />

        <Route element={<ProtectedRoute />}>
          <Route path={ROUTES.WALLET} element={<WalletPage />} />
          <Route path={ROUTES.SWAP} element={<SwapPage />} />
          <Route path={ROUTES.BRIDGE} element={<BridgePage />} />
          <Route path={ROUTES.PROFILE} element={<ProfilePage />} />
          <Route path={ROUTES.SEED_PHRASE} element={<SeedPhrasePage />} />
          <Route path={ROUTES.KYC} element={<KycPage />} />
        </Route>
      </Routes>
    </BrowserRouter>
  )
}
