import request from "@/utils/request";

/**
 * 获取所有前端导航
 * @returns {Promise}
 */
export function getFrontMenus() {
  return request({
    url: "/platform/frontmenus",
    method: "get",
  });
}

/**
 * 创建前端导航
 * @param {Object} frontMenuData 前端导航数据
 * @returns {Promise}
 */
export function createFrontMenu(formData, options = {}) {
  return request({
    url: "/platform/createfrontmenu",
    method: "post",
    data: formData,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  });
}

/**
 * 编辑前端导航
 * @param {number|string} id 前端导航ID
 * @param {Object} frontMenuData 更新的数据
 * @returns {Promise}
 */
export function editFrontMenu(id, frontMenuData) {
  return request({
    url: `/platform/editfrontmenu/${id}`,
    method: "post",
    data: frontMenuData,
  });
}

/**
 * 删除前端导航
 * @param {number|string} id 前端导航ID
 * @returns {Promise}
 */
export function deleteFrontMenu(id) {
  return request({
    url: `/platform/deletefrontmenu/${id}`,
    method: "delete",
  });
}

