import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
import { Sys001Component } from "./sys001/sys001.component";
import { Sys002Component } from "./sys002/sys002.component";
import { Sys002CreateUserComponent } from "./sys002/sys002-create-user.component";
import { Sys002SetUserComponent } from "./sys002/sys002-set-user.component";
import { Sys002ViewUserComponent } from "./sys002/sys002-view-user.component";
import { Sys002Resolver } from "app/views/sys/sys002/sys002-resolver.service";
import { Sys003Component } from "./sys003/sys003.component";
import { Sys004Component } from "./sys004/sys004.component";
import { Sys004CreateRoleComponent } from "./sys004/sys004-create-role.component";
import { Sys004SetRoleComponent } from "./sys004/sys004-set-role.component";
import { Sys004Resolver } from "app/views/sys/sys004/sys004-resolver.service";
import { Sys005Component } from "./sys005/sys005.component";
import { Sys005CreatePageComponent } from "./sys005/sys005-create-page.component";
import { Sys005SetPageComponent } from "./sys005/sys005-set-page.component";
import { Sys005Resolver } from "app/views/sys/sys005/sys005-resolver.service";
import { Sys006Component } from "./sys006/sys006.component";
import { Sys006Resolver } from "app/views/sys/sys006/sys006-resolver.service";
import { Sys006CreateGroupComponent } from "./sys006/sys006-create-group.component";
import { Sys006SetGroupComponent } from "./sys006/sys006-set-group.component";
import { Sys006ViewGroupComponent } from "./sys006/sys006-view-group.component";

import { AuthGuard } from "app/auth-guard.service";

const routes: Routes = [
  {
    path: "",
    data: {
      title: "系統設定"
    },
    children: [
      {
        path: "sys001",
        component: Sys001Component,
        canActivate: [AuthGuard],
        data: {
          title: "變更密碼"
        }
      },
      {
        path: "sys002",
        component: Sys002Component,
        canActivate: [AuthGuard],
        data: {
          title: "使用者管理"
        }
      },
      {
        path: "sys002-create-user",
        component: Sys002CreateUserComponent,
        canActivate: [AuthGuard],
        data: {
          title: "新增使用者"
        }
      },
      {
        path: "sys002-view-user",
        component: Sys002ViewUserComponent,
        canActivate: [AuthGuard],
        resolve: { selectedUser: Sys002Resolver },
        data: {
          title: "檢視使用者資料"
        }
      },
      {
        path: "sys002-set-user",
        component: Sys002SetUserComponent,
        canActivate: [AuthGuard],
        resolve: { selectedUser: Sys002Resolver },
        data: {
          title: "修改使用者"
        }
      },
      {
        path: "sys003",
        component: Sys003Component,
        canActivate: [AuthGuard],
        data: {
          title: "個人資料設定"
        }
      },
      {
        path: "sys004",
        component: Sys004Component,
        canActivate: [AuthGuard],
        data: {
          title: "角色權限管理"
        }
      },
      {
        path: "sys004-create-role",
        component: Sys004CreateRoleComponent,
        canActivate: [AuthGuard],
        data: {
          title: "新增權限"
        }
      },
      {
        path: "sys004-set-role",
        component: Sys004SetRoleComponent,
        resolve: { selectedRole: Sys004Resolver },
        canActivate: [AuthGuard],
        data: {
          title: "設定權限"
        }
      },
      {
        path: "sys006",
        component: Sys006Component,
        canActivate: [AuthGuard],
        data: {
          title: "分局管理"
        }
      },
      {
        path: "sys006-create-group",
        component: Sys006CreateGroupComponent,
        canActivate: [AuthGuard],
        data: {
          title: "新增分局"
        }
      },
      {
        path: "sys006-view-group",
        component: Sys006ViewGroupComponent,
        resolve: { selectedGroup: Sys006Resolver },
        canActivate: [AuthGuard],
        data: {
          title: "檢視分局"
        }
      },
      {
        path: "sys006-set-group",
        component: Sys006SetGroupComponent,
        resolve: { selectedGroup: Sys006Resolver },
        canActivate: [AuthGuard],
        data: {
          title: "修改分局"
        }
      },
      {
        path: "sys005",
        component: Sys005Component,
        canActivate: [AuthGuard],
        data: {
          title: "頁面管理"
        }
      },
      {
        path: "sys005-create-page",
        component: Sys005CreatePageComponent,
        canActivate: [AuthGuard],
        data: {
          title: "新增頁面"
        }
      },
      {
        path: "sys005-set-page",
        component: Sys005SetPageComponent,
        resolve: { selectedPage: Sys005Resolver },
        canActivate: [AuthGuard],
        data: {
          title: "修改頁面資料"
        }
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: [Sys002Resolver, Sys004Resolver, Sys005Resolver, Sys006Resolver]
})
export class SysRoutingModule {}
