import { type FC } from 'react'
import SideBar from '../shared/SideBar'
import Header from '../shared/Header'
import { Route, Routes } from 'react-router-dom'
import Footer from '../shared/Footer'
import { clx } from '../helpers/utils'
import { useSharedStore } from '../shared/store/sharedStore'
import FoodsList from '@/pages/food/List'
import { Pages } from '@/config/Pages'
import CreateFood from '@/pages/food/Create'
import CategoryFood from '@/pages/food/Category'
import CustomersList from '@/pages/customers/List'
import CustomerDetails from '@/pages/customers/Details'
import CreateCustomer from '@/pages/customers/Create'
import OrdersList from '@/pages/orders/List'
const MainRouter: FC = () => {

    const { hasSubMenu } = useSharedStore()

    return (
        <div className='p-4 overflow-hidden'>
            <SideBar />
            <Header />
            <div className={clx(
                'flex-1 xl:ms-[269px] mt-[68px] xl:mt-[81px]',
                hasSubMenu && 'xl:ms-[305px]',
            )}>
                <div className={clx(
                    `overflow-auto w-[${window.innerWidth}] max-h-[calc(100vh-113px)]`,
                )}>
                    <div className='pb-20'>
                        <Routes>
                            <Route path={Pages.foods.list} element={<FoodsList />} />
                            <Route path={Pages.foods.add} element={<CreateFood />} />
                            <Route path={Pages.foods.category} element={<CategoryFood />} />
                            <Route path={Pages.customers.list} element={<CustomersList />} />
                            <Route path={Pages.customers.detail + ':id'} element={<CustomerDetails />} />
                            <Route path={Pages.customers.add} element={<CreateCustomer />} />
                            <Route path={Pages.orders.list} element={<OrdersList />} />
                        </Routes>
                    </div>
                </div>
            </div>
            <Footer />
        </div>
    )
}

export default MainRouter