import dynamic from 'dva/dynamic';
import { EnterpriseHomePage } from './enterpriseHomePage';
// import { EnterpriseAddressBook } from "./enterpriseAddressBook";
import { EnterpriseManagement } from './enterpriseManagement';
import { PersonnelRecruitment } from './personnelRecruitment';
import { MessageNotification } from './messageNotification';
import { Administrative } from './administrative';
import { hrManagement } from './hrManagement';
import { TaskManager } from './taskManager';
import { PoliceDeclare } from './PoliceDeclare';
import { ExamInformation } from './ExamInformation';
import { StatisticalSurvey } from './StatisticalSurvey';
import { DevicesManagement } from './DevicesManagement';
import { ContractManagement } from './ContractManagement';
// import { IncentiveManagement } from "./IncentiveManagement";
import { AttendanceManagement } from './AttendanceManagement';
import { SalaryManagement } from './SalaryManagement';
import { ExaminationApproval } from './ExaminationApproval';
import { TrainingUnitsTrainingManagement } from './TrainingUnitsTrainingManagement';
import { PrintingCertificate } from './PrintingCertificate';
import { TrainingInstitutionsCoursewareManagement } from './TrainingInstitutionsCoursewareManagement';
import { TrainingInstitutionsTrainingManagement } from './TrainingInstitutionsTrainingManagement';
// import { TrainingInstitutionsExamManage } from './TrainingInstitutionsExamManage';
import { TrainingInstitutionsCertificationManage } from './TrainingInstitutionsCertificationManage';
import { TrainingInstitutionsTrainingRecord } from './TrainingInstitutionsTrainingRecord';
import trainingAdapt from './trainingAdapt';
import trainingPersonInCharge from './trainingPersonInCharge';
import { InsuranceManagement } from './InsuranceManagement';
import financialWallet from './financialWallet';
import SalaryPayment from './SalaryPayment';
import businessInvoice from './businessInvoice';
import QualifySubsidy from './QualifySubsidy';
import { HelpCenterFunctionIntroduction } from './HelpCenterFunctionIntroduction';
import { HelpCenterCommonProblems } from './HelpCenterCommonProblems';
import { HelpCenterOperationManual } from './HelpCenterOperationManual';
import { HelpCenterPersonnelImport } from './HelpCenterPersonnelImport';
import { HelpCenterDownloadClient } from './HelpCenterDownloadClient';
import { HelpCenterGiveUsAdvice } from './HelpCenterGiveUsAdvice';
import { DataMap } from './DataMap';
import { DataStatistics } from './dataStatistics';
import { Command } from './Command';
import { Meeting } from './Meeting';
import { PublicSafety } from './PublicSafety';
import temporaryInsurance from './temporaryInsurance';
import  salary from './salary';
// wrapper of dynamic

/**
 * iverry remark
 * 缁勪欢鍔ㄦ€佸姞杞�
 * @param {*} app  dva 瀹炰緥锛屽姞杞� models 鏃堕渶瑕�
 * @param {*} models  dva models(redux) 浼犲叆瀛楃涓诧紝鎷兼帴model鏂囦欢澶瑰搴旂殑鍚嶅瓧 
 * @param {*} component 鍦ㄨ繑鍥� Promise 鐨勫嚱鏁帮紝Promise 杩斿洖 React Component
 */
const dynamicWrapper = (app, models, component) =>
  dynamic({
    app,
    models: () => models.map(m => import(`../models/${m}.js`)),
    component
  });

// nav data
export const getNavData = app => [
  {
    component: dynamicWrapper(app, ['user', 'login','client'], () =>
      import('../layouts/BasicLayout')
    ),
    layout: 'BasicLayout',
    name: '棣栭〉', // for breadcrumb
    path: '/',
    children: [
      /**
       * @author Orm
       * 浼佷笟妯″潡-浼佷笟棣栭〉
       */
      EnterpriseHomePage(app),

      /**
       * @author Orm
       * 鏁版嵁鍦板浘
       */
      DataMap(app),

      /**
       * @author Orm
       * 浼佷笟妯″潡-浼佷笟閫氳褰�
       */
      // EnterpriseAddressBook(app),

      /**
       * @author Lmb
       * 浼佷笟妯″潡-浼佷笟绠$悊
       */
      EnterpriseManagement(app),

      /**
       * @author Orm
       * 浜轰簨妯″潡-浜轰簨鎷涜仒
       */
      PersonnelRecruitment(app),
      /**
       * @author Hjj
       * 浜轰簨妯″潡-鍐呭嫟绠$悊
       * @author Lmb
       * 浜轰簨妯″潡-浜旈櫓涓€閲戣缃�
       *  @author cxl
       * 浜轰簨妯″潡-濂栨儵绠$悊
       */
      AttendanceManagement(app),
      /**
       * @author LYQ
       * 涓氬姟妯″潡-椹诲嫟绠$悊-鍒涘缓浠诲姟-浠诲姟璇︽儏
       */
      TaskManager(app),
      /**
       * @author Orm
       * 浜轰簨妯″潡-钖叕绠$悊
       */
      SalaryManagement(app),

      /**
       * @author  Lmb
       * 琛屾斂妯″潡-娑堟伅
       */
      MessageNotification(app),
      /**
       * @author  Hjj
       * 琛屾斂妯″潡-瀹℃壒绠$悊
       */
      ExaminationApproval(app),
      /**
       * @author  Xyz
       * 琛屾斂妯″潡-鍔冲姟钖叕
       */
      Administrative(app),

      /**
       * @author cxl
       * 琛屾斂妯″潡-璁惧绠$悊
       */
      DevicesManagement(app),
      /**
       * @author cxl
       * 琛屾斂妯″潡-鍚堝悓绠$悊
       */
      ContractManagement(app),

      /**
       * @author Lmb
       * 浜轰簨妯″潡-浜旈櫓涓€閲戣缃�
       */
      hrManagement(app),

      /**
       * @author cxl
       * 浜轰簨妯″潡-濂栨儵绠$悊
      IncentiveManagement(app),
      */
      
      /**
       * @author Hjj
       * 涓氬姟妯″潡-澶囨璁稿彲鐢虫姤
       */
      PoliceDeclare(app),
      /**
       * @author Hjj
       * 涓氬姟妯″潡-淇濆畨鍛樿€冨煿淇℃伅鎶芥煡绠$悊
       */
      ExamInformation(app),
       /**
       * @author Hjj
       * 涓氬姟妯″潡-缁熻璋冩煡
       */
      StatisticalSurvey(app),
      /**
       * @author Orm
       * 鍩硅妯″潡-鍙傝鍗曚綅-鍦ㄧ嚎鍩硅
       */
      TrainingUnitsTrainingManagement(app),
      
      /**
       * @author Orm
       * 鍩硅妯″潡-鍩硅鏈烘瀯-璇句欢搴撶鐞�
       */
      TrainingInstitutionsCoursewareManagement(app),
      /**
       * @author Orm
       * 鍩硅妯″潡-鍩硅鏈烘瀯-鍩硅绠$悊
       */
      TrainingInstitutionsTrainingManagement(app),
      /**
       * @author Orm
       * 鍩硅妯″潡-鍩硅鏈烘瀯-鑰冭瘯绠$悊
       */
      // TrainingInstitutionsExamManage(app),
      /**
       * @author Lyq
       * 鍩硅妯″潡-鍙傝鍗曚綅-鍦ㄧ嚎鍩硅
       */
      PrintingCertificate(app),
       /**
       * @author Lyq
       * 鍩硅妯″潡-鍩硅鏈烘瀯-宀椾綅閫傚簲鎬у煿璁�
       */
      trainingAdapt(app),
        /**
       * @author Cyq
       * 鍩硅妯″潡-鍩硅鏈烘瀯-绛夌骇璇佺鐞�
       */
      TrainingInstitutionsCertificationManage(app),
        /**
       * @author Lyq
       * 鍩硅妯″潡-鍩硅鏈烘瀯-绛夌骇璇佺鐞�
       */
      trainingPersonInCharge(app),
       /**
       * @author Lyq
       * 鍩硅妯″潡-鍩硅鏈烘瀯-绛夌骇璇佸鍛樺疄涔犲鏍歌褰�
       */
      TrainingInstitutionsTrainingRecord(app),
      /**
       * @author Zjp
       * 閲戣瀺淇濋櫓妯″潡-淇濋櫓
       */
      InsuranceManagement(app),
      /**
       * @author Lyq
       * 閲戣瀺淇濋櫓妯″潡-閽卞寘
       */
      financialWallet(app),
      /**
       * @author Cyq
       * 閲戣瀺淇濋櫓妯″潡-钖祫鍙戞斁绠$悊
       */
      SalaryPayment(app),
      /**
       * @author Lyq
       * 涓氬姟鍙戠エ妯″潡-閽卞寘
       */
      businessInvoice(app),
      /**
       * @author Cyq
       * 閲戣瀺绠$悊妯″潡-璧勬牸璇佽ˉ璐村彂鏀剧鐞�
       */
      QualifySubsidy(app),
      /**
       * @author Zhx
       * SaaS甯姪妯″潡-鍔熻兘绠€浠�
       */
      HelpCenterFunctionIntroduction(app),
      /**
       * @author Zhx
       * SaaS甯姪妯″潡-甯歌闂
       */
      HelpCenterCommonProblems(app),
      /**
       * @author Zhx
       * SaaS甯姪妯″潡-鎿嶄綔鎵嬪唽
       */
      HelpCenterOperationManual(app),
      /**
       * @author Zhx
       * SaaS甯姪妯″潡-浜哄憳瀵煎叆鎸囧崡
       */
      HelpCenterPersonnelImport(app),
      /**
       * @author Zhx
       * SaaS甯姪妯″潡-涓嬭浇瀹㈡埛绔�
       */
      HelpCenterDownloadClient(app),
      /**
       * @author Zhx
       * SaaS甯姪妯″潡-缁欐垜浠缓璁�
       */

      HelpCenterGiveUsAdvice(app),
      /**
       * @author Orm
       * 澶у瀷娲诲姩
       */
      PublicSafety(app),
      /**
       * @author Lyq
       * 鏁版嵁缁熻
       */
      DataStatistics(app),
      /**
       * @author Lyq
       * 闃叉帶鎸囨尌
       */
      Command(app),
      /**
       * @author Lyq
       * 钖叕
       */
      salary(app),
      /**
       * @author Lyq
       * 涓翠繚浠诲姟
       */
      temporaryInsurance(app),
      /**
       * 鍗庝负浼氳
       */
      Meeting(app),
      {
        name: '鏀粯',
        path: 'pay',
        icon: 'warning',
        children: [
          {
            name: '鏀粯',
            path: 'paystatus',
            component: dynamicWrapper(app, [], () =>
              import('../routes/pay/PayStatus')
            )
          }
        ]
      },
      {
        name: '寮傚父',
        path: 'exception',
        icon: 'warning',
        children: [
          {
            name: '403',
            path: '403',
            component: dynamicWrapper(app, [], () =>
              import('../routes/Exception/403')
            )
          },
          {
            name: '404',
            path: '404',
            component: dynamicWrapper(app, [], () =>
              import('../routes/Exception/404')
            )
          },
          {
            name: '500',
            path: '500',
            component: dynamicWrapper(app, [], () =>
              import('../routes/Exception/500')
            )
          }
        ]
      }
    ]
  },
  {
    component: dynamicWrapper(app, ['user', 'register','im'], () =>
      import('../layouts/UserLayout')
    ),
    path: '/user',
    layout: 'UserLayout',
    children: [
      {
        name: '甯愭埛',
        icon: 'user',
        path: 'user',
        children: [
          {
            name: '鐧诲綍',
            path: 'LogOn',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/LogOn')
            )
          },
          {
            name: '娉ㄥ唽',
            path: 'Enroll',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/Enroll')
            )
          },
          {
            name: '涓汉娉ㄥ唽',
            path: 'PersonalRegistration',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/PersonalRegistration')
            )
          },
          {
            name: '涓汉娉ㄥ唽鎴愬姛',
            path: 'PersonalRegistrationResult',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/PersonalRegistrationResult')
            )
          },
          {
            name: '浼佷笟娉ㄥ唽',
            path: 'EnterpriseRegistration',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/EnterpriseRegistration')
            )
          },
          {
            name: '浼佷笟娉ㄥ唽鎴愬姛',
            path: 'EnterpriseRegistrationResult',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/EnterpriseRegistrationResult')
            )
          },
          {
            name: '浼佷笟蹇樿瀵嗙爜',
            path: 'ForgetPassword',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/ForgetPassword')
            )
          },
          {
            name: '淇敼瀵嗙爜',
            path: 'ChangeUserPassword',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/ChangeUserPassword')
            )
          },
          {
            name: '鐢ㄦ埛鍗忚',
            path: 'UserAgreement',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/UserAgreement')
            )
          },
          {
            name: '闅愮绛栫暐',
            path: 'UserPlicy',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/UserPlicy')
            )
          },
          {
            name: '鐧诲綍',
            path: 'Login',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/Login')
            )
          },
          {
            name: '鐧诲綍',
            path: 'SignIn',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/SignIn')
            )
          },
        ]
      }
    ]
  },
  {
    component: dynamicWrapper(app, ['user', 'register'], () =>
      import('../layouts/PlatformLoginLayout')
    ),
    path: '/bbd',
    layout: 'PlatformLoginLayout',
    children: [
      {
        name: '鐧句繚鐩�',
        icon: 'user',
        path: 'bbd',
        children: [
          {
            name: '鐧诲綍',
            path: 'login',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/PlatformLogin/BBDLogin')
            )
          },
          {
            name: '蹇樿瀵嗙爜',
            path: 'forgetpassword',
            component: dynamicWrapper(app, [], () =>
              import('../routes/User/PlatformLogin/ForgetPassword')
            )
          }
        ]
      }
    ]
  },
  {
    component: dynamicWrapper(app, [], () =>
      import('../layouts/fromV5Layout')
    ),
    path: '/fromv5',
    layout: 'FromV5Layout',
    children: [
      SalaryManagement(app),
      AttendanceManagement(app),
      TaskManager(app)
    ]
  }
];