import { api } from '~/utils/axios';

/**
 * 获取系统菜单
 * @return {Promise} api
 */
export function getMenuTree() {
  return api.get('Menu.Menu/getMenuTree', {
    isTransformResponse: true
  });
}
/**
 * 更新菜单
 * @param {Object} data
 * @return {Promise} api
 */
export function addMenu(data) {
  return api.post('Menu.Menu/addMenu', data, {
    isTransformResponse: true,
    isShowSuccessMessage: true,
    errorMessageText: '添加失败'
  });
}
/**
 * 更新菜单
 * @param {Object} data
 * @return {Promise} api
 */
export function updateMenu(data) {
  return api.post('Menu.Menu/updateMenu', data, {
    isTransformResponse: true,
    isShowSuccessMessage: true,
    errorMessageText: '更新失败'
  });
}
/**
 * 删除菜单
 * @param {Object} data
 * @return {Promise} api
 */
export function deleteMenu(data) {
  return api.post('Menu.Menu/deleteMenu', data, {
    isTransformResponse: true,
    isShowSuccessMessage: true,
    errorMessageText: '删除失败',
    returnapiSuccess: true
  });
}
/**
 * 获取菜单接口
 * @param {Object} data
 * @return {Promise} api
 */
export function getMenuApiTree(data) {
  return api.post('Menu.Menu/getMenuApiTree', data, {
    isTransformResponse: true
  });
}
/**
 * 获取菜单接口
 * @param {Object} data
 * @return {Promise} api
 */
export function getMenuApiList(data) {
  return api.post('Menu.Menu/getMenuApiList', data, {
    isTransformResponse: true
  });
}
/**
 * 添加菜单接口
 * @param {Object} data
 * @return {Promise} api
 */
export function addMenuApi(data) {
  return api.post('Menu.Menu/addMenuApi', data, {
    isTransformResponse: true,
    isShowSuccessMessage: true,
    errorMessageText: '添加失败'
  });
}
/**
 * 添加菜单接口
 * @param {Object} data
 * @return {Promise} api
 */
export function deleteMenuApi(data) {
  return api.post('Menu.Menu/deleteMenuApi', data, {
    isTransformResponse: true,
    isShowSuccessMessage: true,
    errorMessageText: '删除失败'
  });
}
/**
 * 获取角色菜单
 * @param {Object} data
 * @return {Promise} api
 */
export function getRoleMenu(data) {
  return api.post('Menu.Menu/getRoleMenu', data, {
    isTransformResponse: true
  });
}
/**
 * 绑定角色菜单
 * @param {Object} data
 * @return {Promise} api
 */
export function bindRoleMenu(data) {
  return api.post('Menu.Menu/bindRoleMenu', data, {
    isTransformResponse: true,
    isShowSuccessMessage: true,
    errorMessageText: '绑定失败'
  });
}
