import React from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Layout from "../components/layout/Layout";
import Dashboard from "./Dashboard";
import GroupDashboard from "./GroupDashboard";
import CompanyDashboard from "./CompanyDashboard";
import CompanyAdminDashboard from "./CompanyAdminDashboard";
import LoanManagement from "./LoanManagement";
import ProfitSweepManagement from "./ProfitSweepManagement";
import RoleManagement from "./RoleManagement";
import AuditLogs from "./AuditLogs";
import SuperAdminDashboard from "./SuperAdminDashboard";
import SuperAdminBankAccounts from "./SuperAdminBankAccounts";

function AppRoutes() {
  return (
    <Routes>
      <Route
        path="/dashboard"
        element={
          <Layout>
            <Dashboard />
          </Layout>
        }
      />
      <Route
        path="/group-dashboard"
        element={
          <Layout>
            <GroupDashboard />
          </Layout>
        }
      />
      <Route
        path="/super-admin-dashboard"
        element={
          <Layout>
            <SuperAdminDashboard />
          </Layout>
        }
      />
      <Route
        path="/super-admin-bank-accounts"
        element={
          <Layout>
            <SuperAdminBankAccounts />
          </Layout>
        }
      />
      <Route
        path="/company-dashboard"
        element={
          <Layout>
            <CompanyAdminDashboard />
          </Layout>
        }
      />
      <Route
        path="/loans"
        element={
          <Layout>
            <LoanManagement />
          </Layout>
        }
      />
      <Route
        path="/profit-sweeps"
        element={
          <Layout>
            <ProfitSweepManagement />
          </Layout>
        }
      />
      <Route
        path="/roles"
        element={
          <Layout>
            <RoleManagement />
          </Layout>
        }
      />
      <Route
        path="/audit-logs"
        element={
          <Layout>
            <AuditLogs />
          </Layout>
        }
      />
    </Routes>
  );
}

export default function MainApp() {
  return (
    <BrowserRouter>
      <AppRoutes />
    </BrowserRouter>
  );
}
