import { ReactElement } from 'react';
import { Navigate, Route, Routes } from 'react-router';
import { AccountUserProfilePage } from '@/pages/account';
import { AuthPage } from '@/auth';
import { RequireAuth } from '@/auth/RequireAuth';
import { Demo2Layout } from '@/layouts/demo2';
import { ErrorsRouting } from '@/errors';

import DashboardHomePage from '@/pages/dashboards/home/DashboardHomePage';
import ManageUserPage from '@/pages/settings/user/manage-user/ManageUserPage';
import Transaction from '@/pages/transaction/history-transaction/Transaction';
import ApprovalTransaction from '@/pages/transaction/approval-transaction/ApprovalTransaction';
import TransactionTopup from '@/pages/transaction/topup/TransactionTopup';
import TransactionDisbursement from '@/pages/transaction/disbursement-saldo/TransactionDisbursement';
import LogActivityPage from '@/pages/settings/user/log-activity/LogActivityPage';
import ManagePositionPage from '@/pages/settings/user/manage-position/ManagePositionPage';
import ManageAccount from '@/pages/account/manage-account/ManageAccount';
import ManageGroups from '@/pages/groups/ManageGroups';
import ManageMembers from '@/pages/members/manage-members/ManageMembers';
import ManageKycDeletion from '@/pages/members/kyc-delete-member/ManageKycDeletion';
import Kyc from '@/pages/members/kyc/Kyc';
import AccessType from '@/pages/access/access-type/AccessType';
import MemberCredential from '@/pages/access/member-credentials/MemberCredentials';
import ManageCurrency from '@/pages/account/manage-currency/ManageCurrency';
import ManageNotification from '@/pages/notification/ManageNotification';
import ManageMenu from '@/pages/menu/manage-menu/ManageMenu';
import Welcome from '@/pages/menu/welcome/Welcome';
import Inbox from '@/pages/message/Inbox';
import ManageWebServices from '@/pages/webservice/ManageWebServices';
import TransferType from '@/pages/transfer/transfertype/TransferType';
import MasterData from '@/pages/master/MasterData';
import PostoAdmsMaster from '@/pages/master/postoadms/PostoAdmsMaster';
import SucosMaster from '@/pages/master/sucos/SucosMaster';
import AldeiasMaster from '@/pages/master/aldeias/AldeiasMaster';
import Municipios from '@/pages/master/municipios/Municipios';
import ProfessionMaster from '@/pages/master/profession/ProfessionMaster';
import ProductsMaster from '@/pages/master/products/ProductsMaster';
import ProviderMaster from '@/pages/master/provider/ProviderMaster';
import ConversionMaster from '@/pages/master/conversion/ConversionMaster';
import RewardMaster from '@/pages/master/reward/RewardMaster';
import WalletRuleMaster from '@/pages/master/walletRule/WalletRuleMaster';
import WalletHistory from '@/pages/wallet/wallet-history/WalletHistory';
import WalletMaster from '@/pages/master/wallet/WalletMaster';
import CurrencyMaster from '@/pages/master/currency/CurrencyMaster';

// DISBURSEMENT
import HistoryTransactionDisbursement from '@/pages/disbursement/history-transaction/HistoryTransaction'
// DISBURSEMENT

const AppRoutingSetup = (): ReactElement => {
  return (
    <Routes>
      <Route element={<RequireAuth />}>
        <Route element={<Demo2Layout />}>
          <Route path="/" element={<DashboardHomePage />} />

          <Route path="/master-data" element={<MasterData />} />
          <Route path="/master-data/municipios" element={<Municipios />} />
          <Route path="/master-data/postoadms" element={<PostoAdmsMaster />} />
          <Route path="/master-data/sucos" element={<SucosMaster />} />
          <Route path="/master-data/aldeias" element={<AldeiasMaster />} />
          <Route path="/master-data/profession" element={<ProfessionMaster />} />
          <Route path="/master-data/products" element={<ProductsMaster />} />
          <Route path="/master-data/provider" element={<ProviderMaster />} />
          <Route
            path="/master-data/municipios/postoadms/:municipioId"
            element={<PostoAdmsMaster />}
          />
          <Route path="/master-data/conversion" element={<ConversionMaster />} />

          <Route path="/master-data/currency/" element={<CurrencyMaster />} />

          <Route path="/master-data/reward/" element={<RewardMaster />} />

          <Route path="/master-data/wallet" element={<WalletMaster />} />

          <Route path="/master-data/wallet-rule" element={<WalletRuleMaster />} />

          <Route path="/account/home/user-profile" element={<AccountUserProfilePage />} />

          <Route path="/groups/group-management" element={<ManageGroups />} />

          <Route path="/members/kyc" element={<Kyc />} />
          <Route path="/members/member-management" element={<ManageMembers />} />
          <Route path="/members/kyc-delete-member" element={<ManageKycDeletion />} />
          <Route path="/members/create-member-credential" element={<MemberCredential />} />

          <Route path="/access/access-type-management" element={<AccessType />} />

          <Route path="/accounts/account-management" element={<ManageAccount />} />
          <Route path="/accounts/currency-management" element={<ManageCurrency />} />

          <Route path="/transfer-type/transfer-type-management" element={<TransferType />} />

          <Route path="/wallet/wallet-history" element={<WalletHistory />} />

          <Route path="/notification/notification-management" element={<ManageNotification />} />

          <Route path="/transaction" element={<Transaction />} />
          <Route path="/approval-transaction" element={<ApprovalTransaction />} />
          <Route path="/transaction/topup" element={<TransactionTopup/>} />
          <Route path="/transaction/disbursement-saldo" element={<TransactionDisbursement/>} />
          <Route path="/menu/menu-management" element={<ManageMenu />} />
          <Route path="/menu/welcome" element={<Welcome />} />
          <Route path="/message/inbox" element={<Inbox />} />
          <Route path="/webservice/webservice-management" element={<ManageWebServices />} />
          <Route path="/settings/user-management/manage-user" element={<ManageUserPage />} />
          <Route path="/settings/user-management/log-activity" element={<LogActivityPage />} />
          <Route
            path="/settings/user-management/manage-position"
            element={<ManagePositionPage />}
          />

          {/* DISBURSEMENT  */}
          <Route path="/disbursement/transaction-history" element={<HistoryTransactionDisbursement />} />
          {/* DISBURSEMENT */}

        </Route>
      </Route>
      <Route path="error/*" element={<ErrorsRouting />} />
      <Route path="auth/*" element={<AuthPage />} />
      <Route path="*" element={<Navigate to="/error/404" />} />
    </Routes>
  );
};

export { AppRoutingSetup };
