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',
    children: [
      {
        id: '2-1',
        name: '模型列表',
        path: '/llm/models',
        icon: 'AppstoreOutlined',
      },
      {
        id: '2-2',
        name: '供应商管理',
        path: '/llm/providers',
        icon: 'CloudServerOutlined',
      },
      {
        id: '2-3',
        name: '用量统计',
        path: '/llm/usage',
        icon: 'LineChartOutlined',
      },
      {
        id: '2-4',
        name: '用量明细',
        path: '/llm/usage/details',
        icon: 'UnorderedListOutlined',
      },
      {
        id: '2-5',
        name: '限流配额',
        path: '/llm/quota',
        icon: 'ControlOutlined',
      },
    ],
  },
  {
    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',
        icon: 'SafetyCertificateOutlined',
      },
    ],
  },
];

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