var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React, { Suspense, lazy } from 'react';
import { Route, Switch, Redirect } from 'react-router-dom';
import { PrivateRoute } from './PrivateRoute';
import { UdpPageEnums } from '../enums/pageEnums';
import { ConfigService } from '../configService';
import { PageLoading } from '../UI/feedback/PageLoading';
import { PublicRoute } from './PublicRoute';
import { useMenuContext } from '../utilities/menus/MenuProvider';
// Lazy load route components
const VirtualBrowser = lazy(() => import('../maintenanceEngine/virtualBrowser/VirtualBrowser'));
const MenuPage = lazy(() => import('../menuPage/MenuPage'));
const UdpPublicForm = lazy(() => import('../udp/pages/UdpFormsPublicForm'));
const WorkflowContainer = lazy(() => import('../workflow/WorkflowContainer'));
const PasswordResetRedirect = lazy(() => import('./components/PasswordResetRedirect'));
const MyExportsPage = lazy(() => import('../udp/export/MyExportsPage'));
const PageNotFoundRoute = lazy(() => import('./components/PageNotFoundRoute'));
const UdpMaintenanceConfigPage = lazy(() => import('../udp/pages/UdpMaintenanceConfigPage'));
const UdpMaintenanceEnginePage = lazy(() => import('../udp/pages/UdpMaintenanceEnginePage'));
const AadCallback = lazy(() => import('../utilities/auth/AadCallback'));
const UdpTransactionsPage = lazy(() => import('../udp/pages/UdpTransactionsPage'));
const UdpTransactionTypesPage = lazy(() => import('../udp/pages/UdpTransactionTypesPage'));
const PageContainer = lazy(() => import('../page/PageContainer').then((module) => ({
    default: module.PageContainer
})));
const Reports = lazy(() => import('../reports/Reports'));
const Inquiry = lazy(() => import('../inquiry/Inquiry').then((module) => ({ default: module.Inquiry })));
export const UdpRoutes = (props) => {
    const { homeRoute } = props, other = __rest(props, ["homeRoute"]);
    const { leftMenuLoading } = useMenuContext();
    return (React.createElement(Suspense, { fallback: React.createElement(PageLoading, null) }, React.createElement(Switch, null, homeRoute && React.createElement(Redirect, { exact: true, from: "/", to: homeRoute }), leftMenuLoading && React.createElement(Route, { exact: true, path: "/", component: PageLoading }), React.createElement(PrivateRoute, { path: "/virtual/:id", render: (props) => React.createElement(VirtualBrowser, Object.assign({}, props, other)) }), React.createElement(PrivateRoute, { path: "/menupage/:id", render: (props) => React.createElement(MenuPage, Object.assign({}, props, other)) }), React.createElement(PublicRoute, { path: `/page/${UdpPageEnums.Udp_Forms_Renderer_Page_Public}`, render: (props) => React.createElement(UdpPublicForm, Object.assign({}, props, other)) }), React.createElement(PublicRoute, { path: `/passwordresetsuccess`, render: (props) => React.createElement(PasswordResetRedirect, { props: props }) }), React.createElement(PrivateRoute, { path: "/workflowtask/:id", render: (props) => React.createElement(WorkflowContainer, Object.assign({}, props, other)) }), React.createElement(PrivateRoute, { path: "/myexports", render: (props) => (React.createElement(MyExportsPage, Object.assign({ productId: ConfigService.config.UNITY_PRODUCT_ID }, props, other))) }), React.createElement(PrivateRoute, { path: "/crudbrowser", render: (props) => React.createElement(UdpMaintenanceEnginePage, Object.assign({}, props)) }), React.createElement(PrivateRoute, { path: "/tablebrowser", render: (props) => React.createElement(UdpMaintenanceConfigPage, Object.assign({}, props)) }), React.createElement(Route, { path: "/aad_callback", component: AadCallback }), React.createElement(PrivateRoute, { path: "/transactionsPage", render: (props) => React.createElement(UdpTransactionsPage, Object.assign({}, props)) }), React.createElement(PrivateRoute, { path: "/transactionTypesPage", render: (props) => React.createElement(UdpTransactionTypesPage, Object.assign({}, props)) }), React.createElement(PrivateRoute, { path: "/reports/:id", exact: true, component: Reports }), React.createElement(PrivateRoute, { path: "/inquiry/:id", render: (props) => React.createElement(Inquiry, Object.assign({}, props)) }), React.createElement(PrivateRoute, { path: "/page/:id", render: (props) => React.createElement(PageContainer, Object.assign({ fromMenu: true }, props)) }), React.createElement(PrivateRoute, { path: "*", component: PageNotFoundRoute }))));
};
//# sourceMappingURL=UdpRoutes.js.map