/* eslint-disable react-hooks/rules-of-hooks */
import ResetPassword from '@/components/Authentication/ResetPassword'
import BasePage from '@/components/BasePage/BasePage'
import ProtectedRoute from '@/components/ProtectedRoute/ProtectedRoute'
import AllProfiles from '@/pages/AllProfiles/AllProfiles'
import Allocation from '@/pages/Allocation/Allocation'
import PageLogin from '@/pages/Auth/Login/Login'
import Document from '@/pages/Document/Document'
import LeaveManagement from '@/pages/LeaveManagement/LeaveManagement'
import PageNotFound from '@/pages/NotFound/NotFound'
import OrganizationSettings from '@/pages/OrganizationSettings/OrganizationSettings'
import Profile from '@/pages/Profile/Profile'
import SprintReview from '@/pages/SprintReview/SprintReview'
import StaffEvaluation from '@/pages/StaffEvaluation/StaffEvaluation'
import TestReport from '@/pages/TestReport/TestReport'
import Tickets from '@/pages/Tickets/Tickets'
import TicketsManagement from '@/pages/TicketsManagement/TicketsManagement'
import Timekeeping from '@/pages/Timekeeping/Timekeeping'
import Tracking from '@/pages/Tracking/Tracking'
import UsersManagement from '@/pages/UsersManagement/UsersManagement'
import PageWelcome from '@/pages/Welcome/Welcome'
import Worklogs from '@/pages/Worklogs/Worklogs'
import { Navigate } from 'react-router-dom'

const mainRoutes = [
  {
    path: '/',
    // element: <ProtectedRoute mode="home"><PageHome /></ProtectedRoute>,
    element: (
      <ProtectedRoute mode="home" permission="staff">
        <Navigate to="/timekeeping"></Navigate>
      </ProtectedRoute>
    ),
  },
  {
    path: '/welcome',
    element: (
      <ProtectedRoute mode="route" permission="staff">
        <PageWelcome />
      </ProtectedRoute>
    ),
  },
  {
    path: '/tracking',
    element: (
      <ProtectedRoute mode="home" permission="admin,hr">
        <BasePage
          main={
            <>
              <Tracking />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  // {
  //   path: '/jira',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <Jira />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  {
    path: '/worklogs',
    element: (
      <ProtectedRoute mode="home" permission="staff">
        <BasePage
          main={
            <>
              <Worklogs />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/documents',
    element: (
      <ProtectedRoute mode="home" permission="admin">
        <BasePage
          main={
            <>
              <Document />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/timekeeping',
    element: (
      <ProtectedRoute mode="home" permission="staff,accountant">
        <BasePage
          main={
            <>
              <Timekeeping />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/leave-management',
    element: (
      <ProtectedRoute mode="home" permission="staff,accountant">
        <BasePage
          main={
            <>
              <LeaveManagement />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/tickets',
    element: (
      <ProtectedRoute mode="route" permission="staff">
        <BasePage
          main={
            <>
              <Tickets />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/tickets-management',
    element: (
      <ProtectedRoute mode="route" permission="admin,hr">
        <BasePage
          main={
            <>
              <TicketsManagement />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/users',
    element: (
      <ProtectedRoute mode="route" permission="admin,hr">
        <BasePage
          main={
            <>
              <UsersManagement />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/sprint-review',
    element: (
      <ProtectedRoute mode="route" permission="admin">
        <BasePage
          main={
            <>
              <SprintReview />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/test-report',
    element: (
      <ProtectedRoute mode="route" permission="admin,tester">
        <BasePage
          main={
            <>
              <TestReport />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/allocation',
    element: (
      <ProtectedRoute mode="route" permission="staff">
        <BasePage
          main={
            <>
              <Allocation />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/profile',
    element: (
      <ProtectedRoute mode="route" permission="staff,admin,hr,tester">
        <BasePage
          main={
            <>
              <Profile />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/staff-avaluation',
    element: (
      <ProtectedRoute mode="route" permission="admin">
        <BasePage
          main={
            <>
              <StaffEvaluation />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/organization-settings',
    element: (
      <ProtectedRoute mode="route" permission="admin">
        <BasePage
          main={
            <>
              <OrganizationSettings />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  {
    path: '/profiles',
    element: (
      <ProtectedRoute mode="route" permission="admin,accountant">
        <BasePage
          main={
            <>
              <AllProfiles />
            </>
          }
        ></BasePage>
      </ProtectedRoute>
    ),
  },
  // {
  //   path: '/packages',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <Package />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  // {
  //   path: '/discounts',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <Discounts />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  // {
  //   path: '/client',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <Clients />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  // {
  //   path: '/banner',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <Banner />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  // {
  //   path: '/order',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <Orders />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  // {
  //   path: '/sn-check-history',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <CheckHistory />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  // {
  //   path: '/contacts',
  //   element: (
  //     <ProtectedRoute mode="home" permission="staff">
  //       <BasePage
  //         main={
  //           <>
  //             <Contacts />
  //           </>
  //         }
  //       ></BasePage>
  //     </ProtectedRoute>
  //   ),
  // },
  {
    path: '/login',
    element: (
      <ProtectedRoute mode="login" permission="staff">
        <PageLogin />
      </ProtectedRoute>
    ),
  },
  {
    path: '/forgot/*',
    element: <ResetPassword />,
  },
  {
    path: '/*',
    element: <PageNotFound />,
  },
]

export default mainRoutes
