import { request } from '@/api';
import type {
  MenuFormParams,
  DeleteMenuParams,
  MenuListResponse
} from '@/api/types/system/menu';

/**
 * 获取菜单列表
 * @returns Promise<MenuListResponse> 菜单列表数据
 */
export async function getMenuApi(): Promise<MenuListResponse> {
  return request.get<MenuListResponse>('/menus/list');
}

/**
 * 添加菜单
 * @param params 菜单表单参数（form-data格式）
 * @returns Promise<void>
 */
export async function createMenuApi(params: MenuFormParams): Promise<void> {
  return request.post<void>('/menus/create', params);
}

/**
 * 编辑菜单
 * @param params 菜单表单参数（含id）
 * @returns Promise<void>
 */
export async function editMenuApi(params: MenuFormParams): Promise<void> {
  return request.post<void>('/menus/edit', params);
}

/**
 * 删除菜单
 * @param params 仅需菜单id
 * @returns Promise<void>
 */
export async function deleteMenuApi(params: DeleteMenuParams): Promise<void> {
  return request.post<void>('/menus/del', params);
}
