// https://umijs.org/config/
import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import component from '@/locales/en-US/component';
import route from 'mock/route';

const { REACT_APP_ENV } = process.env;

export default defineConfig({
  hash: true,
  antd: {},
  dva: {
    hmr: true,
  },
  locale: {
    // default zh-CN //zh-CN
    default: 'en-US',
    // default true, when it is true, will use `navigator.language` overwrite default
    antd: true,
    baseNavigator: true,
  },
  dynamicImport: {
    loading: '@/components/PageLoading/index',
  },
  targets: {
    ie: 11,
  },
  // umi routes: https://umijs.org/docs/routing
  routes: [
    {
      path: '/login2',
      component: '../pages/user/login2',
    },
    {
      path: '/others',
      component: '../pages/user/others',
    },
    {
      path: '/user',
      component: '../layouts/UserLayout',
      routes: [
        {
          name: 'login',
          path: '/user/login',
          component: './user/login',
        },
        {
          name: 'login',
          path: '/user/forget',
          component: './user/login',
        },
      ],
    },
    {
      path: '/',
      component: '../layouts/SecurityLayout',
      routes: [
        {
          path: '/',
          component: '../layouts/BasicLayout',
          authority: ['admin', 'user'],
          routes: [
            {
              path: '/500',
              component:'./500'
            },
            {
              path: '/',
              redirect: '/runTest',
            },
            {
              path: '/runTest',
              name: 'monitoringcenter',
              icon: 'PieChartOutlined',
              component: './runTest/Template',
            },
            {
              path: '/UserManagement',
              name: 'usemanagement',
              icon:'ProfileOutlined',
              routes: [
                {
                  path: './LIFEUserManagement',
                  name: 'lifeusers',
                  routes: [
                    { path: './', component: './UserManagement/LIFEUserManagement/Users' },
                    { path: './Add', component: './UserManagement/LIFEUserManagement/UsersAdd' },
                    { path: './Detail', component: './UserManagement/LIFEUserManagement/UsersDetail' },
                    { path: './MemberDetail', component: './UserManagement/LIFEUserManagement/UserMemberDetail' },
                    { path: './Edit', component: './UserManagement/LIFEUserManagement/UsersDetail' },
                    { path: './Result', component: './UserManagement/LIFEUserManagement/ResultPage' }, 
                    { path: './ResultFailed', component: './UserManagement/LIFEUserManagement/ResultPageFailed' },
                  ]
                },
                {
                  path: './ServiceProviderManagement',
                  name: 'serviceproviders',
                  routes: [
                    { path: './', component: './UserManagement/ServiceProviderManagement/ServiceProviderManagement' },
                    {
                      path: './Detail',
                      routes: [
                        { path: './', component: './UserManagement/ServiceProviderManagement/Detail'},
                        { path: './Guard', component: './UserManagement/ServiceProviderManagement/Guard'}
                    ]},
                    { path: './Edit', component: './UserManagement/ServiceProviderManagement/Edit' },
                    {path:'./Services',component:'./UserManagement/ServiceProviderManagement/Services'},
                  ]
                },
              ]
            },
            {
              path: '/PropertyManagement',
              name: 'propertymanagement',
              icon: 'ReconciliationOutlined',
              routes: [
                { path: './', component: './PropertyManagement/ChargeManager' },
                { path: './AccoutingDetail', component: './PropertyManagement/AccoutingContent' },
                { path: './AccoutingEdit',component:'./PropertyManagement/AccoutingContent'},
              ]
            },
            { path: '/PropertyManagementDetail', component: './PropertyManagement/ChargeDetail' },

            {
              path: '/CommercialService',
              name: 'commercialservice',
              icon:'ConsoleSqlOutlined',
              routes: [
                {
                  path: './CommunityMaintenance',
                  name: 'communitymaintenance',
                  routes: [
                    { path: './', component: './CommercialService/PropertyServices' },
                    { path: './Detail', component: './CommercialService/Detail' },
                    {path: './Edit',component:'./CommercialService/Detail'},
                  ]
                },
                {
                  path: './OwnerComplaints',
                  name: 'ownercomplaints',
                  component: './CommercialService/PropertyServices',
                },
                {
                  path: './ProblemFeedback',
                  name: 'problemfeedback',
                  component:'./CommercialService/PropertyServices'
                },
                {
                  path: './RenovationApplication',
                  name: 'renovationapplication',
                  routes: [
                    { path: './', component: './CommercialService/Renovation' },
                    {path:'./Detail', component:'./CommercialService/RenovationDetail' },
                  ]

                },
                {
                  path: './AccessCardApplication',
                  name: 'accessCardapplication',
                  routes:[
                    { path: './', component: './CommercialService/Card' },
                    { path: './Detail', component: './CommercialService/CardDetail' },
                    {path: './Add', component: './CommercialService/CardAdd'},
                  ]
                },
                {
                  path: './ReportOnline',
                  name: 'reportonline',
                  component:'./CommercialService/PropertyServices'
                },
                {
                  path: './ShelfLifeService',
                  name: 'shelflifeservice',
                  routes: [
                    { path: './', component: './CommercialService/PropertyServices' },
                    { path: './Detail', component: './CommercialService/Detail' },
                    {path: './Edit',component:'./CommercialService/Detail'},
                  ]
                },
                {path: './OwnerComplaints/Detail',component:'./CommercialService/Detail'},
                {path: './OwnerComplaints/Edit',component:'./CommercialService/Detail'},
                {path: './ProblemFeedback/Detail',component:'./CommercialService/Detail'},
                {path: './ProblemFeedback/Edit',component:'./CommercialService/Detail'},
                {path: './RenovationApplication/Detail',component:'./CommercialService/Detail'},
                {path: './RenovationApplication/Edit',component:'./CommercialService/Detail'},
                {path: './ReportOnline/Detail',component:'./CommercialService/Detail'},
                {path: './ReportOnline/Edit',component:'./CommercialService/Detail'},
              ]
            },
            {
              path: '/OrderManagement',
              name: 'ordermanagement',
              icon: 'ContainerOutlined',
              routes: [
                { path: './', component: './OrderManagement/Order' },
              ]
            },
            {
              path: '/ContractManagement',
              name: 'contractmanagement',
              icon: 'SwitcherOutlined',
              routes: [
                { path: './', component: './ContractManagement/Contract' },
                { path: './Detail', component: './ContractManagement/ContractContent' },
                { path: './Edit',component:'./ContractManagement/ContractContent'},
                { path: './Add',component:'./ContractManagement/ContractContent'},
              ]
            },
            {
              path: '/CommunityManagement',
              name: 'communitymanagement',
              icon:'HddOutlined',
              routes: [
                {
                  path: './CellList',
                  name: 'celllist',
                  routes:[
                    { path: './', component: './CommunityManagement/CellList/CellList' },
                    { path: './Add', component: './CommunityManagement/CellList/Adds' },
                    {path:'./Detail',component:'./CommunityManagement/CellList/Detail'},
                  ]
                },
                {
                  path: './CommunityAnnouncement',
                  name: 'communityannouncement',
                  routes: [
                    { path: "./", component: './CommunityManagement/CommunityAnnouncement/CommunityAnnouncement' },
                    {path:"./Add",component:'./CommunityManagement/CommunityAnnouncement/Add'},
                  ]
                },
                {
                  path: './FacilityBookings',
                  name: 'facilitybookings',
                  routes: [
                    { path: "./", component: './CommunityManagement/FacilityBookings/FacilityBookings' },
                    { path: "./Booking", component: './CommunityManagement/FacilityBookings/Bookings' },
                    { path: "./Detail", component: './CommunityManagement/FacilityBookings/BookingDetail' },
                    { path: "./Adding", component: './CommunityManagement/FacilityBookings/Facility' },
                    { path: "./FacilityEdit", component: './CommunityManagement/FacilityBookings/Facility' },
                    { path: "./FacilityDetail", component: './CommunityManagement/FacilityBookings/Facility' },
                    { path: "./FacilityApply",component:'./CommunityManagement/FacilityBookings/Bookings'}
                  ]
                },
                {
                  path: './VisitorRecord',
                  name: 'visitorrecord',
                  routes: [
                    {path:"./",component:'./CommunityManagement/VisitorRecord/VisitorRecord'}
                  ]
                },
              ]
            },
            {
              path: '/AccountManagement',
              name: 'accountmanagement',
              icon: 'UserSwitchOutlined',        
              routes: [
               /* {
                  path: './AccountManagement',
                  name: 'accountmanagement1',
                  routes: [
                    {path:'./',component: './AccountManagement/AccountManagement/Account'},
                    {path: './AccountManagementEdit',component:'./AccountManagement/AccountManagement/AccountManagement'},
                  ]
                },*/
                {
                  path: './account',
                  name: 'accountmanagement1',
                  routes: [
                    {path:'./',component: './AccountManagement/account/Account'},
                    {path: './edit',component:'./AccountManagement/account/AccountEdit'},
                    {path: './reset',component:'./AccountManagement/account/AccountReset'},
                  ]
                },

                {
                  path: './CompanyInformation',
                  name: 'companyinformation',
                  component:'./AccountManagement/CompanyInformation/CompanyInformation'
                },
                {
                  path: './LanguageSettings',
                  name: 'languagesettings',
                  component:'./AccountManagement/LanguageSettings/LanguageSettings'
                },
              ]
            },
            {
              component: './404',
            },
          ],
        },
        {
          component: './404',
        },
      ],
    },
    {
      component: './404',
    },
  ],
  // Theme for antd: https://ant.design/docs/react/customize-theme-cn

  theme: {
    // ...darkTheme,
    'primary-color': defaultSettings.primaryColor,
  },
  // @ts-ignore
  title: false,
  ignoreMomentLocale: true,
  proxy: proxy[REACT_APP_ENV || 'pre'],
  manifest: {
    basePath: '/',
  },
});
