import request from "@/utils/request";
import { MenuQuery, MenuVO, MenuForm, RouteVO } from "./model";

class MenuAPI {
  /**
   * 获取路由列表
   */
  static getRoutes() {   
    return new Promise((resolve) => {
      resolve([    
        {
          path: "/home",
          component: "Layout",        
          redirect: "/home/index2",
          name: "/index2",
          meta: {
            title: "数据总览2",
            icon: "homepage",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6","data_admin"],
            alwaysShow: false,
          },
          children: [
            {
              path: "index2",
              component: "dashboard/index2",
              name: "dashboardIndex2",
              meta: {
                title: "模型管理",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST","data_admin"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },   
        {
          path: "/modelMgr",
          component: "Layout",
          redirect: "/modelMgr/index",
          name: "/modelMgr",
          meta: {
            title: "算法分割管理",
            icon: "split",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "index",
              component: "model/index",
              name: "modelIndex",
              meta: {
                title: "模型管理",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "uploadModel",
              component: "model/uploadModel",
              name: "uploadModel",
              meta: {
                title: "上传模型",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "editModel",
              component: "model/editModel",
              name: "editModel",
              meta: {
                title: "更新模型",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "modelDetail",
              component: "model/modelDetail",
              name: "modelDetail",
              meta: {
                title: "模型详情",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/connection",
          component: "Layout",
          redirect: "/connection/index",
          name: "/connection",
          meta: {
            title: "互联协议管理",
            icon: "web",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "index",
              component: "connection/index",
              name: "connectionIndex",
              meta: {
                title: "互联协议",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "edit",
              component: "connection/edit",
              name: "connectionEdit",
              meta: {
                title: "互联协议修改",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "detail",
              component: "connection/detail",
              name: "connectionDetail",
              meta: {
                title: "互联协议详情",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/simulationEvaluation",
          component: "Layout",
          redirect: "/simulationEvaluation/index",
          name: "/simulationEvaluation",
          meta: {
            title: "仿真评估",
            icon: "simu",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "index",
              component: "simulationEvaluation/index",
              name: "simulationEvaluationIndex",
              meta: {
                title: "编译部署",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "reportList",
              component: "simulationEvaluation/reportList",
              name: "simulationEvaluationReportList",
              meta: {
                title: "评估报告",
                icon: "user",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "addReport",
              component: "simulationEvaluation/addReport",
              name: "simulationEvaluationAddReport",
              meta: {
                title: "新建评估报告",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "reportDesc",
              component: "simulationEvaluation/reportDesc",
              name: "simulationEvaluationReportDesc",
              meta: {
                title: "评估报告详情",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "addTask",
              component: "simulationEvaluation/addTask",
              name: "simulationEvaluationAddTask",
              meta: {
                title: "新建推理任务",
                icon: "oper",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "taskDesc",
              component: "simulationEvaluation/taskDesc",
              name: "simulationEvaluationTaskDesc",
              meta: {
                title: "任务详情",
                icon: "oper",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "execution",
              component: "simulationEvaluation/execution",
              name: "simulationEvaluationExecution",
              meta: {
                title: "执行中任务",
                icon: "oper",
                hidden: false,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "hisTaskList",
              component: "simulationEvaluation/hisTaskList",
              name: "simulationEvaluationHisTaskList",
              meta: {
                title: "历史任务列表",
                icon: "oper",
                hidden: false,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/operatorLibrary",
          component: "Layout",
          redirect: "/operatorLibrary/calculate",
          name: "/operatorLibrary",
          meta: {
            title: "算子库管理",
            icon: "oper",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "calculate",
              component: "manage/calculate/index",
              name: "calculate",
              meta: {
                title: "算子管理",
                icon: "oper",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "calculateEdit",
              component: "manage/calculate/edit",
              name: "calculateEdit",
              meta: {
                title: "算子编辑",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "calculateDetail",
              component: "manage/calculate/view",
              name: "calculateDetail",
              meta: {
                title: "算子查看",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "calculateParam",
              component: "manage/calculateParam/index",
              name: "calculateParam",
              meta: {
                title: "算子程序管理",
                icon: "oper",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "calculateParamEdit",
              component: "manage/calculateParam/edit",
              name: "calculateParamEdit",
              meta: {
                title: "算子程序编辑",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "calculateParamDetail",
              component: "manage/calculateParam/view",
              name: "calculateParamDetail",
              meta: {
                title: "算子程序查看",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/dataMgr",
          component: "Layout",
          redirect: "/dataMgr/datas",
          name: "/dataMgr",
          meta: {
            title: "数据集管理",
            icon: "dict",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "datas",
              component: "manage/datas/index",
              name: "datas",
              meta: {
                title: "数据集管理",
                icon: "dict",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "datasAdd",
              component: "manage/datas/add",
              name: "datasAdd",
              meta: {
                title: "数据集新增",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "datasEdit",
              component: "manage/datas/edit",
              name: "datasEdit",
              meta: {
                title: "数据集编辑",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/tester",
          component: "Layout",
          redirect: "/tester/index",
          name: "/tester",
          meta: {
            title: "算法测试仪管理",
            icon: "test",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "equipment",
              component: "manage/equipment/index",
              name: "equipment",
              meta: {
                title: "计算设备管理",
                icon: "setting",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentEdit",
              component: "manage/equipment/edit",
              name: "equipmentEdit",
              meta: {
                title: "计算设备编辑",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentUpgrades",
              component: "manage/equipment/upGrades",
              name: "equipmentUpgrades",
              meta: {
                title: "计算设备升级",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentAddPcie",
              component: "manage/equipment/addPcie",
              name: "equipmentAddPcie",
              meta: {
                title: "计算PCIE设备新增",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentAddNet",
              component: "manage/equipment/addNet",
              name: "equipmentAddNet",
              meta: {
                title: "计算网络设备新增",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentDetail",
              component: "manage/equipment/view",
              name: "equipmentDetail",
              meta: {
                title: "计算设备查看",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "otherTool",
              component: "manage/otherTool/index",
              name: "otherTool",
              meta: {
                title: "第三方工具管理",
                icon: "setting",
                hidden: false,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "otherToolAdd",
              component: "manage/otherTool/add",
              name: "otherToolAdd",
              meta: {
                title: "第三方工具编辑",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "otherToolDetail",
              component: "manage/otherTool/view",
              name: "otherToolDetail",
              meta: {
                title: "查看第三方工具",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/system",
          component: "Layout",
          redirect: "/system/index",
          name: "/system",
          meta: {
            title: "系统管理",
            icon: "system",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "user",
              component: "system/user/index",
              name: "User",
              meta: {
                title: "用户管理",
                icon: "user",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "userEdit",
              component: "system/user/edit",
              name: "UserEdit",
              meta: {
                title: "用户管理编辑",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "role",
              component: "system/role/index",
              name: "Role",
              meta: {
                title: "角色管理",
                icon: "role",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "roleEdit",
              component: "system/role/edit",
              name: "RoleEdit",
              meta: {
                title: "角色管理编辑",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "menu",
              component: "system/menu/index",
              name: "Menu",
              meta: {
                title: "菜单管理",
                icon: "menu",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "menuEdit",
              component: "system/menu/edit",
              name: "MenuEdit",
              meta: {
                title: "菜单管理编辑",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
      ]);
    });
    /*
    return request<any, RouteVO[]>({
      url: "/api/v1/menus/routes",
      method: "get",
    });*/
  }

  static getRoutesV2() {
    return new Promise((resolve) => {
      resolve([       
        {
          path: "/modelMgr",
          component: "Layout",
          redirect: "/modelMgr/index",
          name: "/modelMgr",
          meta: {
            title: "算法分割管理",
            icon: "split",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "index",
              component: "model/index",
              name: "modelIndex",
              meta: {
                title: "模型管理",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "uploadModel",
              component: "model/uploadModel",
              name: "uploadModel",
              meta: {
                title: "上传模型",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "modelDetail",
              component: "model/modelDetail",
              name: "modelDetail",
              meta: {
                title: "模型详情",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/connection",
          component: "Layout",
          redirect: "/connection/index",
          name: "/connection",
          meta: {
            title: "互联协议管理",
            icon: "web",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "index",
              component: "connection/index",
              name: "connectionIndex",
              meta: {
                title: "互联协议",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "edit",
              component: "connection/edit",
              name: "connectionEdit",
              meta: {
                title: "互联协议修改",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "detail",
              component: "connection/detail",
              name: "connectionDetail",
              meta: {
                title: "互联协议详情",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/simulationEvaluation",
          component: "Layout",
          redirect: "/simulationEvaluation/index",
          name: "/simulationEvaluation",
          meta: {
            title: "仿真评估",
            icon: "simu",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "index",
              component: "simulationEvaluation/index",
              name: "simulationEvaluationIndex",
              meta: {
                title: "编译部署",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "reportList",
              component: "simulationEvaluation/reportList",
              name: "simulationEvaluationReportList",
              meta: {
                title: "评估报告",
                icon: "user",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "addReport",
              component: "simulationEvaluation/addReport",
              name: "simulationEvaluationAddReport",
              meta: {
                title: "新建评估报告",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "reportDesc",
              component: "simulationEvaluation/reportDesc",
              name: "simulationEvaluationReportDesc",
              meta: {
                title: "评估报告详情",
                icon: "user",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "addTask",
              component: "simulationEvaluation/addTask",
              name: "simulationEvaluationAddTask",
              meta: {
                title: "新建推理任务",
                icon: "oper",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "execution",
              component: "simulationEvaluation/execution",
              name: "simulationEvaluationExecution",
              meta: {
                title: "执行中任务",
                icon: "oper",
                hidden: false,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "hisTaskList",
              component: "simulationEvaluation/hisTaskList",
              name: "simulationEvaluationHisTaskList",
              meta: {
                title: "历史任务列表",
                icon: "oper",
                hidden: false,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        
        {
          path: "/dataMgr",
          component: "Layout",
          redirect: "/dataMgr/datas",
          name: "/dataMgr",
          meta: {
            title: "数据集管理",
            icon: "dict",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "datas",
              component: "manage/datas/index",
              name: "datas",
              meta: {
                title: "数据集管理",
                icon: "dict",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "datasAdd",
              component: "manage/datas/add",
              name: "datasAdd",
              meta: {
                title: "数据集新增",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "datasEdit",
              component: "manage/datas/edit",
              name: "datasEdit",
              meta: {
                title: "数据集编辑",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        {
          path: "/tester",
          component: "Layout",
          redirect: "/tester/index",
          name: "/tester",
          meta: {
            title: "算法测试仪管理",
            icon: "test",
            hidden: false,
            roles: ["GUEST", "ADMIN", "ADMIN6"],
            alwaysShow: false,
          },
          children: [
            {
              path: "equipment",
              component: "manage/equipment/index",
              name: "equipment",
              meta: {
                title: "计算设备管理",
                icon: "setting",
                hidden: false,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentEdit",
              component: "manage/equipment/edit",
              name: "equipmentEdit",
              meta: {
                title: "计算设备编辑",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentUpgrades",
              component: "manage/equipment/upGrades",
              name: "equipmentUpgrades",
              meta: {
                title: "计算设备升级",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentAddPcie",
              component: "manage/equipment/addPcie",
              name: "equipmentAddPcie",
              meta: {
                title: "计算PCIE设备新增",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentAddNet",
              component: "manage/equipment/addNet",
              name: "equipmentAddNet",
              meta: {
                title: "计算网络设备新增",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "equipmentDetail",
              component: "manage/equipment/view",
              name: "equipmentDetail",
              meta: {
                title: "计算设备查看",
                hidden: true,
                roles: ["ADMIN", "GUEST"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "otherTool",
              component: "manage/otherTool/index",
              name: "otherTool",
              meta: {
                title: "第三方工具管理",
                icon: "setting",
                hidden: false,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "otherToolAdd",
              component: "manage/otherTool/add",
              name: "otherToolAdd",
              meta: {
                title: "第三方工具编辑",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
            {
              path: "otherToolDetail",
              component: "manage/otherTool/view",
              name: "otherToolDetail",
              meta: {
                title: "查看第三方工具",
                hidden: true,
                roles: ["ADMIN6", "GUEST", "ADMIN"],
                keepAlive: true,
                alwaysShow: false,
              },
            },
          ],
        },
        
      ]);
    });
    /*
    return request<any, RouteVO[]>({
      url: "/api/v1/menus/routes",
      method: "get",
    });*/
  }
  /**
   * 获取菜单树形列表
   *
   * @param queryParams
   */
  static getList(queryParams: MenuQuery) {
    return request<any, MenuVO[]>({
      url: "/api/v1/menus",
      method: "get",
      params: queryParams,
    });
  }

  /**
   * 获取菜单下拉数据源
   */
  static getOptions() {
    return request<any, OptionType[]>({
      url: "/api/v1/menus/options",
      method: "get",
    });
  }

  /**
   * 获取菜单表单数据
   *
   * @param id
   */
  static getFormData(id: number) {
    return request<any, MenuForm>({
      url: "/api/v1/menus/" + id + "/form",
      method: "get",
    });
  }

  /**
   * 添加菜单
   *
   * @param data
   */
  static add(data: MenuForm) {
    return request({
      url: "/api/v1/menus",
      method: "post",
      data: data,
    });
  }

  /**
   * 修改菜单
   *
   * @param id
   * @param data
   */
  static update(id: string, data: MenuForm) {
    return request({
      url: "/api/v1/menus/" + id,
      method: "put",
      data: data,
    });
  }

  /**
   * 删除菜单
   *
   * @param id 菜单ID
   */
  static deleteById(id: number) {
    return request({
      url: "/api/v1/menus/" + id,
      method: "delete",
    });
  }
}

export default MenuAPI;
