/**
 * Admin 页面组件映射表
 * 
 * 用于内部路由系统的组件解析
 * key: componentKey (来自 adminRoutes.uts)
 * value: 组件引用
 * 
 * 注意: 
 * 1. 所有组件必须静态导入,确保打包可分析
 * 2. 组件路径使用 @ 别名
 * 3. 占位组件统一使用 PlaceholderPage
 */

// 导入占位组件
import PlaceholderPage from '@/layouts/admin/components/PlaceholderPage.uvue'

// 导入首页（内部组件，不包含 AdminLayout）
import HomeIndex from '@/layouts/admin/pages/HomeIndex.uvue'

// 导入用户模块（纯组件，不包含 AdminLayout）
import UserStatistic from '@/pages/mall/admin/user/Statistic.uvue'
import UserList from '@/pages/mall/admin/user/list.uvue'
import UserLevel from '@/pages/mall/admin/user/level.uvue'
import UserGroup from '@/pages/mall/admin/user/group.uvue'
import UserLabel from '@/pages/mall/admin/user/label.uvue'
import MemberConfig from '@/pages/mall/admin/user/MemberConfig.uvue'
// 其他用户模块组件暂时使用 PlaceholderPage
// import UserGradeType from '@/pages/mall/admin/user/grade/type.uvue'
// import UserGradeCard from '@/pages/mall/admin/user/grade/card.uvue'
// import UserGradeRecord from '@/pages/mall/admin/user/grade/record.uvue'
// import UserGradeRight from '@/pages/mall/admin/user/grade/right.uvue'
// import UserMemberConfig from '@/pages/mall/admin/user/MemberConfig.uvue'

// 导入商品模块（纯组件，不包含 AdminLayout）
import ProductList from '@/pages/mall/admin/product/list.uvue'
import ProductClassify from '@/pages/mall/admin/product/classify.uvue'
import ProductReply from '@/pages/mall/admin/product/reply.uvue'
import ProductAttr from '@/pages/mall/admin/product/attr.uvue'
import ProductParam from '@/pages/mall/admin/product/param.uvue'
import ProductLabel from '@/pages/mall/admin/product/label.uvue'
import ProductProtection from '@/pages/mall/admin/product/protection.uvue'

// 导入订单模块（纯组件，不包含 AdminLayout）
import OrderList from '@/pages/mall/admin/order/list.uvue'
import OrderStatistic from '@/pages/mall/admin/order/order-statistics/index.uvue'
import OrderRefund from '@/pages/mall/admin/order/aftersales-order/index.uvue'
import OrderCashier from '@/pages/mall/admin/order/cashier-order/index.uvue'
import OrderVerify from '@/pages/mall/admin/order/write-off-records/index.uvue'
import OrderConfig from '@/pages/mall/admin/order/order-configuration/index.uvue'

// 营销、内容、财务、数据、设置模块暂时使用 PlaceholderPage
// 避免循环依赖问题
// import MarketingCoupon from '@/pages/mall/admin/marketing/coupon/list.uvue'
// import MarketingIntegral from '@/pages/mall/admin/marketing/integral/list.uvue'
// import MarketingBargain from '@/pages/mall/admin/marketing/bargain/list.uvue'
// import MarketingCombination from '@/pages/mall/admin/marketing/combination/list.uvue'
// import MarketingSeckill from '@/pages/mall/admin/marketing/seckill/list.uvue'
// import CmsArticle from '@/pages/mall/admin/cms/article/list.uvue'
// import CmsCategory from '@/pages/mall/admin/cms/category/list.uvue'
// import FinanceRecord from '@/pages/mall/admin/finance/record.uvue'
// import StatisticIndex from '@/pages/mall/admin/statistic/index.uvue'
// import SettingSystemConfig from '@/pages/mall/admin/setting/system/config.uvue'
// import SettingSystemAdmin from '@/pages/mall/admin/setting/system/admin.uvue'
// import SettingSystemRole from '@/pages/mall/admin/setting/system/role.uvue'

/**
 * 组件映射表
 */
export const componentMap: Map<string, any> = new Map([
  // 首页
  ['HomeIndex', HomeIndex],
  
  // 用户模块
  ['UserStatistic', UserStatistic],
  ['UserList', UserList],
  ['UserLevel', UserLevel],
  ['UserGroup', UserGroup],
  ['UserLabel', UserLabel],
  ['UserMemberConfig', MemberConfig],
  ['UserGradeType', PlaceholderPage],  // 暂时使用占位组件
  ['UserGradeCard', PlaceholderPage],
  ['UserGradeRecord', PlaceholderPage],
  ['UserGradeRight', PlaceholderPage],
  
  // 商品模块
  ['ProductList', ProductList],
  ['ProductClassify', ProductClassify],
  ['ProductReply', ProductReply],
  ['ProductAttr', ProductAttr],
  ['ProductParam', ProductParam],
  ['ProductLabel', ProductLabel],
  ['ProductProtection', ProductProtection],
  
  // 订单模块
  ['OrderList', OrderList],
  ['OrderStatistic', OrderStatistic],
  ['OrderRefund', OrderRefund],
  ['OrderCashier', OrderCashier],
  ['OrderVerify', OrderVerify],
  ['OrderConfig', OrderConfig],
  
  // 营销模块 - 暂时使用占位组件
  ['MarketingCoupon', PlaceholderPage],
  ['MarketingIntegral', PlaceholderPage],
  ['MarketingBargain', PlaceholderPage],
  ['MarketingCombination', PlaceholderPage],
  ['MarketingSeckill', PlaceholderPage],
  
  // 内容模块 - 暂时使用占位组件
  ['CmsArticle', PlaceholderPage],
  ['CmsCategory', PlaceholderPage],
  
  // 财务模块 - 暂时使用占位组件
  ['FinanceRecord', PlaceholderPage],
  
  // 数据模块 - 暂时使用占位组件
  ['StatisticIndex', PlaceholderPage],
  
  // 设置模块 - 暂时使用占位组件
  ['SettingSystemConfig', PlaceholderPage],
  ['SettingSystemAdmin', PlaceholderPage],
  ['SettingSystemRole', PlaceholderPage]
])

/**
 * 获取组件
 * @param componentKey 组件Key
 * @returns 组件引用,不存在时返回占位组件
 */
export function getComponent(componentKey: string): any {
  return componentMap.get(componentKey) || PlaceholderPage
}
