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 { DisinfectionSupplyGuard } from './guard/DisinfectionSupplyGuard.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: 'disinfectionSupply',
    loadChildren: () => import('./views/disinfection-supply/disinfection-supply.module').then(m => m.DisinfectionSupplyModule),
    canActivate: [DisinfectionSupplyGuard]
  },
  // 问卷预览
  {
    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: '**',
    redirectTo: 'main/home'
  },
];

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