import { type FC } from "react";
import { Route, Routes } from "react-router-dom";
import Home from "../pages/home/Home";
import SideBar from "../shared/Sidebar";
import Header from "../shared/Header";
import { Paths } from "@/config/Paths";
import ProformaInvoice from "@/pages/invoice/ProformaInvoice";
import CreateInvoice from "@/pages/invoice/Create";
import RequestList from "@/pages/requests/RequestList";
import ProductList from "@/pages/product/List";
import OrdersList from "@/pages/order/List";
import FeaturesList from "@/pages/Features/List";
import CreateProduct from "@/pages/product/Create";
import CreateFeature from "@/pages/Features/Create";
import PrintService from "@/pages/service/PrintService";
import DetailPerfomaInvoice from "@/pages/invoice/DetailPerfomaInvoice";
import UpdateInvoice from "@/pages/invoice/Update";
import AnnouncementList from "@/pages/annoncement/List";
import AnnouncementUpdate from "@/pages/annoncement/Update";
import AnnouncementCreate from "@/pages/annoncement/Create";
import CriticismsList from "@/pages/criticisms/List";
import CriticismsDetail from "@/pages/criticisms/Detail";
import LearningList from "@/pages/learning/List";
import LearningCreate from "@/pages/learning/Create";
import LearningCategory from "@/pages/learning/Category";
import CategoryList from "@/pages/product/category/List";
import CreateCategory from "@/pages/product/category/Create";
import UpdateCategory from "@/pages/product/category/Update";
import UpdateProduct from "@/pages/product/Update";
import CreateAttribute from "@/pages/product/attribute/Create";
import AttributeList from "@/pages/product/attribute/List";
import UpdateAttribute from "@/pages/product/attribute/Update";
import AttributeValues from "@/pages/product/attribute/AttributeValues";
import FormBuilderList from "@/pages/formBuilder/List";
import FormBuilderCreate from "@/pages/formBuilder/Create";
import FormBuilderUpdate from "@/pages/formBuilder/Update";
import FormBuilderValues from "@/pages/formBuilder/AttributeValues";
import OrderDetail from "@/pages/order/OrderDetail";
import NewOrder from "@/pages/order/NewOrder";
import EditOrder from "@/pages/order/EditOrder";
import SectionList from "@/pages/print/List";
import CreateSection from "@/pages/print/Create";
import UpdateSection from "@/pages/print/Update";
import PrintForm from "@/pages/print/Form";
import UsersList from "@/pages/user/List";
import AdminList from "@/pages/admin/List";
import CreateAdmin from "@/pages/admin/Create";
import EditAdmin from "@/pages/admin/Update";
import RequestDetail from "@/pages/requests/Detail";
import ConvertToOrders from "@/pages/order/ConvertToOrders";

const MainRouter: FC = () => {
    return (
        <div className="p-4 overflow-hidden">
            <Header />
            <SideBar />
            <div className="flex-1 xl:ms-[269px] mt-[68px] xl:mt-[81px]">
                <div
                    className={`overflow-auto w-[${window.innerWidth}] max-h-[calc(100vh-113px)]`}
                >
                    <div className="xl:pb-20 pb-32">
                        <Routes>
                            <Route path="/" element={<Home />} />
                            <Route path={Paths.home} element={<Home />} />
                            <Route path={Paths.perfomaInvoice.list} element={<ProformaInvoice />} />
                            <Route path={Paths.perfomaInvoice.create} element={<CreateInvoice />} />
                            <Route path={Paths.perfomaInvoice.detail + ":id"} element={<DetailPerfomaInvoice />} />
                            <Route path={Paths.perfomaInvoice.update + ":id"} element={<UpdateInvoice />} />
                            <Route path={Paths.requests.list} element={<RequestList />} />
                            <Route path={Paths.requests.detail + ":id"} element={<RequestDetail />} />
                            <Route path={Paths.product.list} element={<ProductList />} />
                            <Route path={Paths.product.create} element={<CreateProduct />} />
                            <Route path={Paths.product.update + ":id"} element={<UpdateProduct />} />
                            <Route path={Paths.product.attribute.create + ":id"} element={<CreateAttribute />} />
                            <Route path={Paths.product.attribute.list + ":id"} element={<AttributeList />} />
                            <Route path={Paths.product.attribute.update + ":id"} element={<UpdateAttribute />} />
                            <Route path={Paths.product.attributeValue.list + ":id"} element={<AttributeValues />} />
                            <Route path={Paths.product.category.list} element={<CategoryList />} />
                            <Route path={Paths.product.category.create} element={<CreateCategory />} />
                            <Route path={Paths.product.category.update + ":id"} element={<UpdateCategory />} />

                            <Route path={Paths.formBuilder.list + ":id/:type"} element={<FormBuilderList />} />
                            <Route path={Paths.formBuilder.create + ":id/:type"} element={<FormBuilderCreate />} />
                            <Route path={Paths.formBuilder.update + ":id"} element={<FormBuilderUpdate />} />
                            <Route path={Paths.formBuilder.values + ":id"} element={<FormBuilderValues />} />

                            <Route path={Paths.order.list} element={<OrdersList />} />
                            <Route path={Paths.order.details + ":id"} element={<OrderDetail />} />
                            <Route path={Paths.order.create} element={<NewOrder />} />
                            <Route path={Paths.order.edit + ":id"} element={<EditOrder />} />
                            <Route path={Paths.convertToOrder + ":id"} element={<ConvertToOrders />} />

                            <Route path={Paths.print.list} element={<SectionList />} />
                            <Route path={Paths.print.create} element={<CreateSection />} />
                            <Route path={Paths.print.update + ":id"} element={<UpdateSection />} />
                            <Route path={Paths.print.form + ":itemId/:orderId"} element={<PrintForm />} />

                            <Route path={Paths.users.list} element={<UsersList />} />

                            <Route path={Paths.admin.list} element={<AdminList />} />
                            <Route path={Paths.admin.create} element={<CreateAdmin />} />
                            <Route path={Paths.admin.update + ":id"} element={<EditAdmin />} />

                            <Route path={Paths.features.list} element={<FeaturesList />} />
                            <Route path={Paths.features.create} element={<CreateFeature />} />
                            <Route path={Paths.service.print} element={<PrintService />} />


                            <Route path={Paths.announcement.list} element={<AnnouncementList />} />
                            <Route path={Paths.announcement.detail + ":id"} element={<AnnouncementUpdate />} />
                            <Route path={Paths.announcement.create} element={<AnnouncementCreate />} />

                            <Route path={Paths.criticisms.list} element={<CriticismsList />} />
                            <Route path={Paths.criticisms.detail + ":id"} element={<CriticismsDetail />} />

                            <Route path={Paths.learning.list} element={<LearningList />} />
                            <Route path={Paths.learning.create} element={<LearningCreate />} />
                            <Route path={Paths.learning.category} element={<LearningCategory />} />
                        </Routes>
                    </div>
                </div>
            </div>
        </div>
    );
};

export default MainRouter;
