import {FC} from 'react';
import {RouteObject, useRoutes} from 'react-router-dom';
import {
  HOME_PATH,
  MAIN_PATH,
  MENU_PATH,
  ROLE_PATH,
  USER_PATH,
  STORAGE_PATH,
  GOODS_PATH,
  PDA_MENU_PATH,
  CONTAINER_PATH,
  MATTER_PATH,
  RAW_IN_STREAM_PATH,
  RAW_OUT_STREAM_PATH,
  SEMI_REPORT_PATH,
  SEMI_DRAW_PATH,
  SEMI_IN_STREAM_PATH,
  SEMI_OUT_STREAM_PATH,
  LOGIN_PATH,
  NO_PERMISSION_PATH,
  FINISH_PRODUCT_IN_STREAM_PATH,
  FINISH_PRODUCT_OUT_STREAM_PATH,
  DEAD_PRODUCT_PATH,
  RESERVE_WARNING_PATH,
  QUALITY_PATH,
  PURCHASE_PATH,
  MATERIAL_BIND_PATH,
  STOCK_PATH,
  DICTIONARY_PATH,
  GS_INTERFACE_LOG_PATH,
  PRODUCTION_REQUISITION_PATH,
  SELL_ORDER_PATH,
  RELOCAT_ORDER_PATH,
  PRODUCT_REPORT_PATH,
  ORDER_LOG_PATH,
  INVENTORY_PATH,
  GS_ERROR_LOG_PATH,
  OTHER_IN_PATH,
  OTHER_OUT_PATH,
  SCREEN_PURCHASE_PATH,
  DELIVER_TRACE_PATH,
} from './name';
import {
  Container,
  Goods,
  Matter,
  Menu,
  NoPermision,
  NotFound,
  Pda,
  RawInStream,
  RawOutStream,
  Role,
  SemiDraw,
  SemiInStream,
  SemiOutStream,
  SemiReport,
  User,
  Storage,
  ProductInStream,
  ProductOutStream,
  ReserveWarning,
  Quality,
  Stock,
  Dictionary,
  GSInterfaceLog,
  ProductionRequisitionOrder,
  RelcationOrder,
  ProductReport,
  DeadProduct,
  PurchaseOrder,
  MaterialBind,
  SellOrder,
  OrderDeleteLog,
  Inventory,
  Login,
  GSErrorLog,
  OtherIn,
  OtherOut,
  ScreenPurchase,
  DeliverTraces,
} from './routes';
import Main from '@pages/main';
import Home from '@pages/home';

export const routes: RouteObject[] = [
  {path: LOGIN_PATH, element: <Login />},
  {
    path: HOME_PATH,
    element: <Home />,
  },
  {path: MAIN_PATH, element: <Main />},
  {path: MENU_PATH, element: <Menu />},
  {path: ROLE_PATH, element: <Role />},
  {path: USER_PATH, element: <User />},
  {path: STORAGE_PATH, element: <Storage />},
  {path: GOODS_PATH, element: <Goods />},
  {path: PDA_MENU_PATH, element: <Pda />},
  {path: CONTAINER_PATH, element: <Container />},
  {path: MATTER_PATH, element: <Matter />},
  {path: QUALITY_PATH, element: <Quality />},
  {path: RAW_IN_STREAM_PATH, element: <RawInStream />},
  {path: RAW_OUT_STREAM_PATH, element: <RawOutStream />},
  {path: SEMI_REPORT_PATH, element: <SemiReport />},
  {path: SEMI_DRAW_PATH, element: <SemiDraw />},
  {path: SEMI_IN_STREAM_PATH, element: <SemiInStream />},
  {path: SEMI_OUT_STREAM_PATH, element: <SemiOutStream />},
  {path: FINISH_PRODUCT_IN_STREAM_PATH, element: <ProductInStream />},
  {path: FINISH_PRODUCT_OUT_STREAM_PATH, element: <ProductOutStream />},
  {path: DEAD_PRODUCT_PATH, element: <DeadProduct />},
  {path: RESERVE_WARNING_PATH, element: <ReserveWarning />},
  {path: PURCHASE_PATH, element: <PurchaseOrder />},
  {path: MATERIAL_BIND_PATH, element: <MaterialBind />},
  {path: STOCK_PATH, element: <Stock />},
  {path: DICTIONARY_PATH, element: <Dictionary />},
  {path: GS_INTERFACE_LOG_PATH, element: <GSInterfaceLog />},
  {
    path: PRODUCTION_REQUISITION_PATH,
    element: <ProductionRequisitionOrder />,
  },
  {path: SELL_ORDER_PATH, element: <SellOrder />},
  {path: RELOCAT_ORDER_PATH, element: <RelcationOrder />},
  {path: PRODUCT_REPORT_PATH, element: <ProductReport />},
  {path: ORDER_LOG_PATH, element: <OrderDeleteLog />},
  {path: INVENTORY_PATH, element: <Inventory />},
  {path: GS_ERROR_LOG_PATH, element: <GSErrorLog />},
  {path: OTHER_IN_PATH, element: <OtherIn />},
  {path: OTHER_OUT_PATH, element: <OtherOut />},
  {path: NO_PERMISSION_PATH, element: <NoPermision />},
  {path: SCREEN_PURCHASE_PATH, element: <ScreenPurchase />},
  {path: DELIVER_TRACE_PATH, element: <DeliverTraces />},
  {path: '*', element: <NotFound />},
];

export const RootRoutes: FC = function () {
  const Routes = useRoutes(routes);

  return Routes;
};

export * from './name';
