import _ from 'lodash';
export const menus = [
  {
    "id": "8a8eaa657d27414e017d2861fe7a0038",
    "pid": "0",
    "name": "首页",
    "url": "/portal",
    "order": 0,
    "level": 1,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-home1"
  },
  {
    "id": "ff8081817dbc0fd3017dbcc8d3140006",
    "pid": "0",
    "name": "业务建模",
    "url": "/business",
    "order": 1,
    "level": 1,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-ziyingyewu"
  },
  {
    "id": "8a8ea9d37f90992d017f91de2d14006a",
    "pid": "ff8081817edc7938017edc9f149c0005",
    "name": "组织管理",
    "url": "/idm/orgManagement",
    "order": 1,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-zuzhiqunzu"
  },
  {
    "id": "ff8081817dbc0fd3017dbcc976a70008",
    "pid": "ff8081817dbc0fd3017dbcc8d3140006",
    "name": "业务建模",
    "url": "/businessModeling",
    "order": 1,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-xinwaizongyewu"
  },
  {
    "id": "8a8eaa5f7e0ac819017e23fde976005f",
    "pid": "8a8eaa5f7e0ac819017e23fbfba6005d",
    "name": "实例管理",
    "url": "/operation/instanceManage",
    "order": 1,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-changjingguanli"
  },
  {
    "id": "8a8eaaad7e437e41017e700e746d012a",
    "pid": "8a8eaaad7e437e41017e700d47960128",
    "name": "报告导出",
    "url": "/library/palReport",
    "order": 1,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-export"
  },
  {
    "id": "ff8081817edc7938017edc9f149c0005",
    "pid": "0",
    "name": "基础数据",
    "url": "/",
    "order": 2,
    "level": 1,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-changyongtubiao-mianxing-21"
  },
  {
    "id": "ff8081817edc7938017edca3ec300013",
    "pid": "8a8eaa5f7e0ac819017e23fbfba6005d",
    "name": "审计日志",
    "url": "/idm/logManagement?appNo=Bpmn",
    "order": 2,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-toggle-right"
  },
  {
    "id": "ff8081817edc7938017edca20e04000b",
    "pid": "ff8081817edc7938017edc9f149c0005",
    "name": "岗位管理",
    "url": "/idm/posiManagement",
    "order": 2,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-changyongtubiao-mianxing-32"
  },
  {
    "id": "ff8081817edc7938017edca4ef130016",
    "pid": "ff8081817dbc0fd3017dbcc8d3140006",
    "name": "字典管理",
    "url": "/idm/dictionaryManagement",
    "order": 2,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-zitibiaoti"
  },
  {
    "id": "8a8eaaad7e437e41017e700fea1c012c",
    "pid": "8a8eaaad7e437e41017e700d47960128",
    "name": "模板设置",
    "url": "/library/reportSetting",
    "order": 2,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-radius-setting"
  },
  {
    "id": "8a8eaaad7e437e41017e700d47960128",
    "pid": "0",
    "name": "资产库",
    "url": "/library",
    "order": 3,
    "level": 1,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-codelibrary"
  },
  {
    "id": "ff8081817edc7938017edca27471000d",
    "pid": "ff8081817edc7938017edc9f149c0005",
    "name": "岗位组管理",
    "url": "/idm/posiGroupManagement",
    "order": 3,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-changyongtubiao-mianxing-32"
  },
  {
    "id": "8a8eaaad7e437e41017e8b1c5cff01b7",
    "pid": "ff8081817dbc0fd3017dbcc8d3140006",
    "name": "模型运维",
    "url": "/business/modelManage",
    "order": 3,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-yuanquyunwei"
  },
  {
    "id": "8a8eaa5f7e0ac819017e23fbfba6005d",
    "pid": "0",
    "name": "运维管理",
    "url": "/operation",
    "order": 4,
    "level": 1,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-yuanquyunwei"
  },
  {
    "id": "8a8eaa5f7e958a35017e95b142d00012",
    "pid": "ff8081817dbc0fd3017dbcc8d3140006",
    "name": "一键部署",
    "url": "/business/deploy",
    "order": 4,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-deploymentunit"
  },
  {
    "id": "ff8081817edc7938017edca37d560011",
    "pid": "ff8081817edc7938017edc9f149c0005",
    "name": "角色管理",
    "url": "/idm/roleManagement?appNo=Bpmn",
    "order": 4,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-changyongtubiao-mianxing-32"
  },
  {
    "id": "ff8081817edc7938017edca2de7d000f",
    "pid": "ff8081817edc7938017edc9f149c0005",
    "name": "群组管理",
    "url": "/idm/groupManagement",
    "order": 5,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-changyongtubiao-mianxing-32"
  },
  {
    "id": "8a8ea9097ffce95d017ffdaa1bfe0048",
    "pid": "ff8081817dbc0fd3017dbcc8d3140006",
    "name": "消息模板",
    "url": "/msgTemplate",
    "order": 5,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-message"
  },
  {
    "id": "8a8ea8688016bfd701801800bf6700b3",
    "pid": "ff8081817dbc0fd3017dbcc8d3140006",
    "name": "连接配置",
    "url": "/connectConfig",
    "order": 99999,
    "level": 2,
    "iconType": "FONT",
    "iconStyle": "{}",
    "iconContent": "icon-fencengpeizhi"
  }
];

export default {
  // 支持值为 Object 和 Array
  'GET /gateway/idm/api/menus': {
    success:true,
    code: 0,
    message: '成功',
    data: menus,
  },
  'GET /gateway/idm/api/menus/:appId/menu': (req: any, res: any) => {
    const { appId } = req.params;
    if (appId) {
      const result = _.filter(menus, (m) => m.appId === appId);
      res.send({
        code: 0,
        message: '成功',
        data: result,
      });
    } else {
      res.end();
    }
  },
  'GET /gateway/idm/api/menus/:id': (req: any, res: any) => {
    const { id } = req.params;
    if (id) {
      const menu = _.find(menus, (m) => menu.id === id);
      res.send({
        code: 0,
        message: '成功',
        data: menu,
      });
    } else {
      res.end();
    }
  },
  'GET /gateway/idm/api/menus/:id/children': (req: any, res: any) => {
    const { id } = req.params;
    if (id) {
      const result = _.filter(menus, (m) => m.pid === id);
      res.send({
        code: 0,
        message: '成功',
        data: result,
      });
    } else {
      res.end();
    }
  },
};
