import type { ApiResponse } from './types/common';
import type { MenuItem } from './types/menu';

const delay = (ms = 300) => new Promise(r => setTimeout(r, ms));

/** 多级菜单 Mock */
const mockMenus: MenuItem[] = [
  {
    id: '1',
    name: '总览',
    path: '/dashboard',
    icon: 'DashboardOutlined',
  },
  {
    id: '2',
    name: '大模型管理',
    path: '/llm',
    icon: 'BlockOutlined',
  },
  {
    id: '3',
    name: '系统管理',
    path: '/system',
    icon: 'SettingOutlined',
    children: [
      {
        id: '3-1',
        name: '用户管理',
        path: '/system/user',
        icon: 'UserOutlined',
      },
      {
        id: '3-2',
        name: '角色管理',
        path: '/system/role',
        icon: 'TeamOutlined',
      },
      {
        id: '3-3',
        name: '权限配置',
        path: '/system/permission',
      },
    ],
  },
];

export async function getMenus(): Promise<ApiResponse<MenuItem[]>> {
  await delay();
  console.log(mockMenus);
  return { code: 200, data: mockMenus, message: 'ok' };
}
