export type MenuNodeType = '目录' | '菜单' | '按钮';

export interface MenuPermissionNode {
  key: string;
  title: string;
  path: string;
  icon: string;
  order: number;
  type: MenuNodeType;
  visible: boolean;
  permission: string;
  remark?: string;
  children?: MenuPermissionNode[];
}

export interface ButtonPermissionItem {
  id: string;
  name: string;
  code: string;
  menuPath: string;
  menuKey: string;
}

export const iconOptions = [
  'DashboardOutlined',
  'BlockOutlined',
  'AppstoreOutlined',
  'CloudServerOutlined',
  'LineChartOutlined',
  'UnorderedListOutlined',
  'ControlOutlined',
  'SettingOutlined',
  'UserOutlined',
  'TeamOutlined',
  'SafetyCertificateOutlined',
];

export const initialMenuTree: MenuPermissionNode[] = [
  {
    key: '1',
    title: '总览',
    path: '/dashboard',
    icon: 'DashboardOutlined',
    order: 1,
    type: '菜单',
    visible: true,
    permission: 'dashboard:view',
  },
  {
    key: '2',
    title: '大模型管理',
    path: '/llm',
    icon: 'BlockOutlined',
    order: 2,
    type: '目录',
    visible: true,
    permission: 'llm:view',
    children: [
      {
        key: '2-1',
        title: '模型列表',
        path: '/llm/models',
        icon: 'AppstoreOutlined',
        order: 1,
        type: '菜单',
        visible: true,
        permission: 'llm:models:view',
      },
      {
        key: '2-2',
        title: '供应商管理',
        path: '/llm/providers',
        icon: 'CloudServerOutlined',
        order: 2,
        type: '菜单',
        visible: true,
        permission: 'llm:providers:view',
      },
      {
        key: '2-3',
        title: '用量统计',
        path: '/llm/usage',
        icon: 'LineChartOutlined',
        order: 3,
        type: '菜单',
        visible: true,
        permission: 'llm:usage:view',
      },
      {
        key: '2-4',
        title: '用量明细',
        path: '/llm/usage/details',
        icon: 'UnorderedListOutlined',
        order: 4,
        type: '菜单',
        visible: true,
        permission: 'llm:usage:details:view',
      },
      {
        key: '2-5',
        title: '限流配额',
        path: '/llm/quota',
        icon: 'ControlOutlined',
        order: 5,
        type: '菜单',
        visible: true,
        permission: 'llm:quota:view',
      },
    ],
  },
  {
    key: '3',
    title: '系统管理',
    path: '/system',
    icon: 'SettingOutlined',
    order: 3,
    type: '目录',
    visible: true,
    permission: 'system:view',
    children: [
      {
        key: '3-1',
        title: '用户管理',
        path: '/system/user',
        icon: 'UserOutlined',
        order: 1,
        type: '菜单',
        visible: true,
        permission: 'system:user:view',
      },
      {
        key: '3-2',
        title: '角色管理',
        path: '/system/role',
        icon: 'TeamOutlined',
        order: 2,
        type: '菜单',
        visible: true,
        permission: 'system:role:view',
      },
      {
        key: '3-3',
        title: '权限配置',
        path: '/system/permission',
        icon: 'SafetyCertificateOutlined',
        order: 3,
        type: '菜单',
        visible: true,
        permission: 'system:permission:view',
      },
    ],
  },
];

export const initialButtonPermissions: ButtonPermissionItem[] = [
  { id: 'btn-1', name: '新增', code: 'system:user:add', menuPath: '系统管理 / 用户管理', menuKey: '3-1' },
  { id: 'btn-2', name: '编辑', code: 'system:user:edit', menuPath: '系统管理 / 用户管理', menuKey: '3-1' },
  { id: 'btn-3', name: '删除', code: 'system:user:delete', menuPath: '系统管理 / 用户管理', menuKey: '3-1' },
  { id: 'btn-4', name: '导出', code: 'system:user:export', menuPath: '系统管理 / 用户管理', menuKey: '3-1' },
  { id: 'btn-5', name: '新增', code: 'system:role:add', menuPath: '系统管理 / 角色管理', menuKey: '3-2' },
  { id: 'btn-6', name: '编辑', code: 'system:role:edit', menuPath: '系统管理 / 角色管理', menuKey: '3-2' },
  { id: 'btn-7', name: '删除', code: 'system:role:delete', menuPath: '系统管理 / 角色管理', menuKey: '3-2' },
  { id: 'btn-8', name: '新增模型', code: 'llm:models:add', menuPath: '大模型管理 / 模型列表', menuKey: '2-1' },
];
