import { PropTypes } from "prop-types";
import { lazy } from "react";
import { lazyRetry } from "../utils/lazyRetry";
import {
  ROUTE_AVICULTURE_USER_PROFILE,
  ROUTE_CITY_USER_PROFILE,
  ROUTE_GENERAL_SUPPORT,
  ROUTE_GENERAL_USER_PROFILE,
  ROUTE_PROVINCE_USER_PROFILE,
  ROUTE_SLAUGHTER_USER_PROFILE,
  ROUTE_VETFARM_USER_PROFILE,
  DRIVER_USER_PROFILE,
  ROUTE_GENERAL_MESSAGES,
  ROUTE_INSPECTOR_USER_PROFILE,
  ROUTE_PROVINCE_FINANCIAL_USER_PROFILE,
  ROUTE_SLAUGHTER_HOUSE_VET_USER_PROFILE,
  ROUTE_GENERAL_TRAINING,
  ROUTE_STEWARD_USER_PROFILE,
  ROUTE_CITYVET_USER_PROFILE,
  ROUTE_LIVE_STOCK_USER_PROFILE,
  ROUTE_GENERAL_PAYMENT,
  ROUTE_CHAIN_COMPANY_USER_PROFILE,
  ROUTE_GENERAL_WAGE_PAYMENT,
  ROUTE_GENERAL_DOWNLOAD_REPORT,
  ROUTE_GENERAL_TICKET_LIST,
  ROUTE_GENERAL_TICKET,
} from "./routes";

const Test = ({ testProp }) => {
  return <h1>home {testProp}</h1>;
};

Test.propTypes = {
  testProp: PropTypes.any,
  // testProp: PropTypes.func,
};

// use lazy for import components
const Support = lazy(() => lazyRetry(() => import("../pages/Support")));
const GeneralDashboard = lazy(() =>
  lazyRetry(() => import("../pages/GeneralDashboard"))
);
const Messages = lazy(() => import("../pages/Messages"));
const Training = lazy(() => import("../pages/Training"));
const Payment = lazy(() => import("../pages/Payment"));
const WagePayment = lazy(() => lazyRetry(() => import("../pages/WagePayment")));
const DownloadReport = lazy(() =>
  lazyRetry(() => import("../pages/DownloadReport"))
);
const Ticket = lazy(() => import("../pages/Tickets"));

export const generalRouting = [
  {
    path: [
      ROUTE_GENERAL_USER_PROFILE,
      ROUTE_AVICULTURE_USER_PROFILE,
      ROUTE_CITY_USER_PROFILE,
      ROUTE_SLAUGHTER_USER_PROFILE,
      ROUTE_PROVINCE_USER_PROFILE,
      ROUTE_INSPECTOR_USER_PROFILE,
      ROUTE_VETFARM_USER_PROFILE,
      ROUTE_PROVINCE_FINANCIAL_USER_PROFILE,
      ROUTE_SLAUGHTER_HOUSE_VET_USER_PROFILE,
      ROUTE_STEWARD_USER_PROFILE,
      DRIVER_USER_PROFILE,
      ROUTE_CITYVET_USER_PROFILE,
      ROUTE_LIVE_STOCK_USER_PROFILE,
      ROUTE_CHAIN_COMPANY_USER_PROFILE,
      "/",
    ],
    Page: GeneralDashboard,
    exact: false,
    props: {},
  },
  {
    path: [ROUTE_GENERAL_TICKET_LIST, ROUTE_GENERAL_TICKET],
    Page: Ticket,
    exact: false,
    props: {},
  },
  {
    path: [ROUTE_GENERAL_SUPPORT],
    Page: Support,
    exact: false,
    props: {},
  },
  {
    path: [ROUTE_GENERAL_MESSAGES],
    Page: Messages,
    exact: false,
    props: {},
  },
  {
    path: [ROUTE_GENERAL_TRAINING],
    Page: Training,
    exact: false,
    props: {},
  },
  {
    path: [ROUTE_GENERAL_PAYMENT],
    Page: Payment,
    exact: false,
    props: {},
  },
  {
    path: [ROUTE_GENERAL_WAGE_PAYMENT],
    Page: WagePayment,
    exact: false,
    props: {},
  },
  {
    path: [ROUTE_GENERAL_DOWNLOAD_REPORT],
    Page: DownloadReport,
    exact: false,
    props: {},
  },
];
