import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

// 护士端权限
import { NurseGuard } from './guard/nurse.guard';
// 服务台权限
import { FuwutaiGuard } from './guard/fuwutai.guard';
// 管理端权限
import { MainGuard } from './guard/main.guard';
// 药房端权限
import { PharmacyGuard } from './guard/pharmacy.guard';
// 标本视图权限
import { SpecimenView2Guard } from './guard/SpecimenView2Guard.guard';
// 标本间端权限
import { SpecimenRoomViewGuard } from './guard/SpecimenRoomViewGuard.guard';
// 病理科权限
import { PathologyGuard } from './guard/Pathology.guard';
// 全局业务查看权限
import { DisinfectionSupplyGuard } from './guard/DisinfectionSupplyGuard.guard';
// 事件配置查看权限
import { IncidentConfigGuard } from './guard/IncidentConfig.guard';
// 三方配置查看权限
import { OtherConfigGuard } from './guard/OtherConfig.guard';
//业务页面控制查看权限
import { PageConfigGuard } from './guard/PageConfig.guard';
// 护士端控制查看权限
import { NurseConfigGuard } from './guard/nurseConfig.guard';
// 数据生成查看权限
import { DataGenerateGuard } from './guard/DataGenerate.guard';
//系统配置查看权限
import { SystemConfigGuard } from './guard/SystemConfig.guard';
// 故障实时播报权限
import { RealtimeBroadcastGuard } from './guard/realtimeBroadcast.guard';
import { InspectClosedLoopViewGuard } from './guard/inspectClosedLoopView.guard';
// web报修权限
import { WebRepairsGuard } from './guard/WebRepairs.guard';
const routes: Routes = [
  // 默认
  {
    path: '',
    redirectTo: 'login',
    pathMatch: 'full'
  },
  // 登录
  {
    path: 'login',
    loadChildren: () => import('./views/login/login.module').then(m => m.LoginModule)
  },
  // 登录
  {
    path: 'login/:hosId',
    loadChildren: () => import('./views/login/login.module').then(m => m.LoginModule)
  },
  // 管理端
  {
    path: 'main',
    loadChildren: () => import('./views/main/main.module').then(m => m.MainModule),
    canActivate: [MainGuard],
  },
  // 调度台
  {
    path: 'dispatchingDesk',
    loadChildren: () => import('./views/fuwutai/fuwutai.module').then(m => m.FuwutaiModule),
    canActivate: [FuwutaiGuard],
  },
  // 护士端
  {
    path: 'nurse',
    loadChildren: () => import('./views/hushijiandan/hushijiandan.module').then(m => m.HushijiandanModule),
    canActivate: [NurseGuard],
  },
  // 药房端
  {
    path: 'pharmacy',
    loadChildren: () => import('./views/pharmacy/pharmacy.module').then(m => m.PharmacyModule),
    canActivate: [PharmacyGuard]
  },
  // 药房端2
  {
    path: 'pharmacy2',
    loadChildren: () => import('./views/pharmacy2/pharmacy2.module').then(m => m.Pharmacy2Module),
    canActivate: [PharmacyGuard]
  },
  // 标本视图
  {
    path: 'specimenView2',
    loadChildren: () => import('./views/specimen-view2/specimen-view2.module').then(m => m.SpecimenView2Module),
    canActivate: [SpecimenView2Guard]
  },
	// 标本间端
	{
	  path: 'specimenRoomView',
	  loadChildren: () => import('./views/specimen-room-view/specimen-room-view.module').then(m => m.SpecimenRoomViewModule),
	  canActivate: [SpecimenRoomViewGuard]
	},
	// 病理科端
	{
	  path: 'pathology',
	  loadChildren: () => import('./views/pathology/pathology.module').then(m => m.PathologyModule),
	  canActivate: [PathologyGuard]
	},
	// 病理科端-扫描条码
	{
	  path: 'pathologyScan',
	  loadChildren: () => import('./views/pathologyScan/pathologyScan.module').then(m => m.PathologyScanModule),
	},
	// 门诊病理采样端
	{
		path: 'pathologySample',
		loadChildren: () => import('./views/pathology-sample/pathology-sample.module').then(m => m.PathologySampleModule),
	},
	// 病理交接本
	{
		path: 'pathologyCommunicationBook',
		loadChildren: () => import('./views/pathology-communication-book/pathology-communication-book.module').then(m => m.PathologyCommunicationBookModule),
	},
	// 交接本核对页
	{
		path: 'pathologyCheck',
		loadChildren: () => import('./views/pathology-check/pathology-check.module').then(m => m.PathologyCheckModule),
	},
  // 全局业务查看
  {
    path: 'disinfectionSupply',
    loadChildren: () => import('./views/disinfection-supply/disinfection-supply.module').then(m => m.DisinfectionSupplyModule),
    canActivate: [DisinfectionSupplyGuard]
  },
  // 事件配置查看
  {
    path: 'incidentConfig',
    loadChildren: () => import('./views/incident-config/incident-config.module').then(m => m.IncidentConfigModule),
    canActivate: [IncidentConfigGuard]
  },
  // 三方配置查看
  {
    path: 'otherConfig',
    loadChildren: () => import('./views/other-config/other-config.module').then(m => m.OtherConfigModule),
    canActivate: [OtherConfigGuard]
  },
	// 系统配置
	{
	  path: 'systemConfig',
	  loadChildren: () => import('./views/system-config/system-config.module').then(m => m.SystemConfigModule),
	  canActivate: [SystemConfigGuard]
	},
  // 业务页面控制查看
  {
    path: 'pageConfig',
    loadChildren: () => import('./views/page-config/page-config.module').then(m => m.PageConfigModule),
    canActivate: [PageConfigGuard]
  },
  // 护士端控制查看
  {
    path: 'nurseConfig',
    loadChildren: () => import('./views/nurse-config/nurse-config.module').then(m => m.NurseConfigModule),
    canActivate: [NurseConfigGuard]
  },
	// 数据生成查看
	{
	  path: 'dataGenerate',
	  loadChildren: () => import('./views/data-generate/data-generate.module').then(m => m.DataGenerateModule),
	  canActivate: [DataGenerateGuard]
	},
  // 问卷预览
  {
    path: "preview",
    loadChildren: () => import("./views/preview/preview.module").then((m) => m.PreviewModule),
  },
  // 洗涤批次视图
  {
    path: 'washingBatchView',
    loadChildren: () => import('./views/washing-batch-view/washing-batch-view.module').then(m => m.WashingBatchViewModule),
  },
	{
	  // 发药批次-配置
	  path: 'dispensingDetail/:id',
	  loadChildren: () => import('./views/dispensing-detail/dispensing-detail.module').then(m => m.DispensingDetailModule),
	},
  // 洗涤批次视图
  {
    path: 'inspectionPlanConfig/:id',
    loadChildren: () => import('./views/inspection-plan-config/inspection-plan-config.module').then(m => m.InspectionPlanConfigModule),
  },
	{
	  // 故障管理-知识库-新增/编辑
	  path: 'repositoryManageAdd/:id',
	  loadChildren: () => import('./views/repository-manage-add/repository-manage-add.module').then(m => m.RepositoryManageAddModule),
	},
  // 故障实时播报
  {
    path: 'realtimeBroadcast',
    loadChildren: () => import('./views/realtime-broadcast/realtime-broadcast.module').then(m => m.RealtimeBroadcastModule),
    canActivate: [RealtimeBroadcastGuard]
  },
  // 新版统计
  {
    path: "newStatistics",
    loadChildren: () => import("./views/new-statistics/new-statistics.module").then((m) => m.NewStatisticsModule),
  },
  // 批量发起陪检
  {
    path: 'batchInspection',
    loadChildren: () => import('./views/batch-inspection/batch-inspection.module').then(m => m.BatchInspectionModule),
  },
  // 陪检信息配置
  {
    path: 'inspectInfoConfig',
    loadChildren: () => import('./views/inspect-info-config/inspect-info-config.module').then(m => m.InspectInfoConfigModule),
  },
  // 陪检闭环视图
  {
    path: 'inspectClosedLoopView',
    loadChildren: () => import('./views/inspect-closed-loop-view/inspect-closed-loop-view.module').then(m => m.InspectClosedLoopViewModule),
    canActivate: [InspectClosedLoopViewGuard]
  },
  // 标本打包
  {
    path: 'batchSpecimen',
    loadChildren: () => import('./views/batch-specimen/batch-specimen.module').then(m => m.BatchSpecimenModule),
  },
	// web报修
	{
	  path: 'webRepairs',
	  loadChildren: () => import('./views/web-repairs/web-repairs.module').then(m => m.WebRepairsModule),
		canActivate: [WebRepairsGuard]
	},
  // 临时路由
  {
    path: "redirect",
    redirectTo: '/',
    pathMatch: 'full'
  },
  // 管理端首页
  {
    path: '**',
    redirectTo: 'main/home'
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
