/**
 * @description 菜单相关API
 * @author yslg
 * @since 2025-10-15
 */

import { api } from '@/apis/index';
import type { ResultDomain } from '@/types';

/**
 * 菜单API服务
 */
export const menuApi = {
  /**
   * 获取顶部菜单栏配置
   * @returns Promise<ResultDomain<any>>
   */
  async getTopMenuConfig(): Promise<ResultDomain<any>> {
    const response = await api.get<any>('/homepage/menu/top-menu');
    return response.data;
  },

  /**
   * 后台修改菜单名称
   * @param menuData 菜单数据
   * @returns Promise<ResultDomain<boolean>>
   */
  async updateMenuName(menuData: any): Promise<ResultDomain<boolean>> {
    const response = await api.put<boolean>('/homepage/menu/update-name', menuData);
    return response.data;
  },

  /**
   * 获取菜单项列表
   * @returns Promise<ResultDomain<any>>
   */
  async getMenuList(): Promise<ResultDomain<any>> {
    const response = await api.get<any>('/homepage/menu/list');
    return response.data;
  }
};
