import request from "@/utils/request";

// 获取所有菜单
export function getAllMenus() {
  return request({
    url: `/backend/allmenu`,
    method: "get",
  });
}

//获取用户菜单
export function getMenus(id){
  return request({
    url: `/backend/menu/${parseInt(id)}`,
    method: "get",
  });
}

// 更新菜单状态
export function updateMenuStatus(menuId, status) {
  return request({
    url: `/backend/menu/status/${menuId}`,
    method: "patch",
    data: { status },
  });
}

// 创建菜单
export function createMenu(menuData) {
  return request({
    url: `/backend/createmenu`,
    method: "post",
    data: menuData,
  });
}

// 更新菜单
export function updateMenu(menuId, menuData) {
  return request({
    url: `/backend/updatemenu/${menuId}`,
    method: "put",
    data: menuData,
  });
}

// 删除菜单
export function deleteMenu(menuId) {
  return request({
    url: `/backend/deletemenu/${menuId}`,
    method: "delete",
  });
}
