/**
 * 账号管理路由分发
 *
 * @author CaiAoLin
 * @date 2017/6/2
 * @version
 */
import Express from "express";
import ManagerController from "../controllers/manager_controller";

const router = Express.Router();
const managerController = new ManagerController();

module.exports =function (app) {

    // 管理员列表action
    router.get('/', managerController.auth, managerController.init, managerController.index);
    // 修改管理员
    // router.post('/modify/:id', managerController.auth, managerController.init, managerController.modify);
    // 删除管理员
    // router.get('/delete/:id',managerController.auth,  managerController.init, managerController.delete);
    // 管理员权限组分配
    router.post('/group/save', managerController.auth, managerController.init, managerController.groupSave);
    // 停用或启用管理员
    router.get('/modify/:id/:login',managerController.auth,  managerController.init, managerController.modify);
    // 超级管理员action
    router.get('/admin', managerController.auth, managerController.init, managerController.admin);
    router.post('/admin', managerController.auth, managerController.init, managerController.adminSubmit);
    // 权限组列表
    router.get('/authority', managerController.auth, managerController.init, managerController.authority);
    router.post('/authority/add', managerController.auth, managerController.init, managerController.authorityAdd);
    router.post('/authority/save', managerController.auth, managerController.init, managerController.authoritySave);
    router.post('/authority/delete', managerController.auth, managerController.init, managerController.authorityDelete);

    // 权限添加接口
    router.post('/permission/add', managerController.auth, managerController.init, managerController.permissionAdd);

    router.get('/create', managerController.create);

    app.use("/manager", router);
};