/**
 * 总后台菜单路由配置
 * 所有子路由合并到一个 AdminLayout 下
 */
import AdminLayout from '@/layout/AdminLayout'

const adminRoutes = {
  path: '/admin',
  component: AdminLayout,
  redirect: '/admin/dashboard',
  children: [
    // 1. 数据看板
    { path: 'dashboard', component: () => import('@/views/admin/dashboard/index'), name: 'AdminDashboard', meta: { title: '数据看板' } },

    // 2. 租户管理
    { path: 'company', component: () => import('@/views/admin/sysCompany/index'), name: 'SysCompanyAdmin', meta: { title: '租户管理' } },
    { path: 'moduleUsage', component: () => import('@/views/admin/moduleUsage/index'), name: 'AdminModuleUsage', meta: { title: '租户模块使用统计' } },
    { path: 'tenantMenu', component: () => import('@/views/admin/tenantMenu/index'), name: 'AdminTenantSysMenu', meta: { title: '租户管理端菜单' } },
    { path: 'tenantCompany', component: () => import('@/views/admin/tenantCompany/index'), name: 'AdminTenantComMenu', meta: { title: '租户销售端菜单' } },

    // 3. 代理管理
    { path: 'proxy', component: () => import('@/views/admin/proxy/index'), name: 'AdminProxy', meta: { title: '代理管理' } },
    { path: 'serviceCost', component: () => import('@/views/admin/serviceCost/index'), name: 'AdminServiceCost', meta: { title: '收费配置' } },
    { path: 'agentReport', component: () => import('@/views/admin/agentReport/index'), name: 'AdminAgentReport', meta: { title: '收益报表' } },

    // 4. 员工与组织
    { path: 'sysUser', component: () => import('@/views/admin/sysUser/index'), name: 'SysUserAdmin', meta: { title: '员工管理' } },
    { path: 'role', component: () => import('@/views/system/role/index'), name: 'AdminRole', meta: { title: '角色管理' } },
    { path: 'menu', component: () => import('@/views/system/menu/index'), name: 'AdminMenu', meta: { title: '菜单管理' } },
    { path: 'dept', component: () => import('@/views/system/dept/index'), name: 'AdminDept', meta: { title: '部门管理' } },
    { path: 'post', component: () => import('@/views/system/post/index'), name: 'AdminPost', meta: { title: '岗位管理' } },

    // 5. 系统管理
    { path: 'dict', component: () => import('@/views/system/dict/index'), name: 'AdminDict', meta: { title: '字典管理' } },
    { path: 'config', component: () => import('@/views/system/config/index'), name: 'AdminConfig', meta: { title: '参数管理' } },
    { path: 'notice', component: () => import('@/views/system/notice/index'), name: 'AdminNotice', meta: { title: '通知公告' } },
    { path: 'keyword', component: () => import('@/views/system/keyword/index'), name: 'AdminKeyword', meta: { title: '违规词语' } },

    // 6. 系统配置
    { path: 'cidConfig', component: () => import('@/views/admin/cidConfig/index'), name: 'AdminCidConfig', meta: { title: 'CID配置' } },
    { path: 'wxConfig', component: () => import('@/views/admin/wxConfig/index'), name: 'AdminWxConfig', meta: { title: '个微配置' } },
    { path: 'ossConfig', component: () => import('@/views/admin/ossConfig/index'), name: 'AdminOssConfig', meta: { title: 'OSS配置' } },
    { path: 'frontConfig', component: () => import('@/views/admin/frontConfig/index'), name: 'AdminFrontConfig', meta: { title: '点播线路配置' } },
    { path: 'dbConfig', component: () => import('@/views/admin/dbConfig/index'), name: 'AdminDbConfig', meta: { title: 'DB配置' } },

    // 7. 外呼管理
    { path: 'voice', component: () => import('@/views/admin/voice/index'), name: 'AdminVoice', meta: { title: '外呼管理' } },
    { path: 'voiceApi', component: () => import('@/views/admin/voiceApi/index'), name: 'AdminVoiceApi', meta: { title: '通话接口管理' } },
    { path: 'voicePackage', component: () => import('@/views/admin/voicePackage/index'), name: 'AdminVoicePackage', meta: { title: '通话套餐管理' } },
    { path: 'voiceSeat', component: () => import('@/views/admin/voiceSeat/index'), name: 'AdminVoiceSeat', meta: { title: '坐席管理' } },
    { path: 'voiceBlacklist', component: () => import('@/views/admin/voiceBlacklist/index'), name: 'AdminVoiceBlacklist', meta: { title: '黑名单管理' } },
    { path: 'voiceFrequency', component: () => import('@/views/admin/voiceFrequency/index'), name: 'AdminVoiceFrequency', meta: { title: '呼叫频率配置' } },
    { path: 'voiceOrder', component: () => import('@/views/admin/voiceOrder/index'), name: 'AdminVoiceOrder', meta: { title: '通话套餐订单' } },

    // 8. 短信管理
    { path: 'sms', component: () => import('@/views/admin/sms/index'), name: 'AdminSms', meta: { title: '短信管理' } },
    { path: 'smsApi', component: () => import('@/views/admin/smsApi/index'), name: 'AdminSmsApi', meta: { title: '短信接口' } },
    { path: 'smsApiTenant', component: () => import('@/views/admin/smsApiTenant/index'), name: 'AdminSmsApiTenant', meta: { title: '短信接口绑定' } },
    { path: 'smsPackage', component: () => import('@/views/admin/smsPackage/index'), name: 'AdminSmsPackage', meta: { title: '短信套餐' } },
    { path: 'smsOrder', component: () => import('@/views/admin/smsOrder/index'), name: 'AdminSmsOrder', meta: { title: '短信订单' } },

    // 9. 财务管理
    { path: 'consumeRecord', component: () => import('@/views/admin/consumeRecord/index'), name: 'AdminConsumeRecord', meta: { title: '消费扣款记录' } },
    { path: 'consumeReport', component: () => import('@/views/admin/consumeReport/index'), name: 'AdminConsumeReport', meta: { title: '模块消费统计' } },
    { path: 'rechargeRecord', component: () => import('@/views/admin/rechargeRecord/index'), name: 'AdminRechargeRecord', meta: { title: '充值扣款记录' } },
    { path: 'commissionRecord', component: () => import('@/views/admin/commissionRecord/index'), name: 'AdminCommissionRecord', meta: { title: '返佣记录' } },
    { path: 'withdrawal', component: () => import('@/views/admin/withdrawalManage/index'), name: 'AdminWithdrawal', meta: { title: '代理提现管理' } },

    // 10. 日志管理
    { path: 'operLog', component: () => import('@/views/monitor/operlog/index'), name: 'AdminOperLog', meta: { title: '操作日志' } },
    { path: 'loginLog', component: () => import('@/views/monitor/logininfor/index'), name: 'AdminLoginLog', meta: { title: '登录日志' } },
    { path: 'companyOperLog', component: () => import('@/views/monitor/componentsOperLog/index'), name: 'AdminCompanyOperLog', meta: { title: '租户操作日志' } },
    { path: 'proxyOperLog', component: () => import('@/views/admin/proxyOperLog/index'), name: 'AdminProxyOperLog', meta: { title: '代理操作日志' } },

    // 11. 内容审计
    { path: 'videoResource', component: () => import('@/views/admin/videoResource/index'), name: 'AdminVideoResource', meta: { title: '视频资源' } },
    { path: 'live', component: () => import('@/views/admin/live/index'), name: 'AdminLive', meta: { title: '直播间' } },
    { path: 'liveVideo', component: () => import('@/views/admin/liveVideo/index'), name: 'AdminLiveVideo', meta: { title: '直播视频' } },
    { path: 'product', component: () => import('@/views/admin/product/index'), name: 'AdminProduct', meta: { title: '商品管理' } },
    { path: 'storeOrder', component: () => import('@/views/admin/storeOrder/index'), name: 'AdminStoreOrder', meta: { title: '销售订单' } },
    { path: 'article', component: () => import('@/views/admin/article/index'), name: 'AdminArticle', meta: { title: '文章管理' } },

    // 12. AI模型管理（统一配置）
    { path: 'aiModel', component: () => import('@/views/admin/aiModel/index'), name: 'AdminAiModel', meta: { title: 'AI模型配置' } },

    // 13. 其他管理
    { path: 'ipadServer', component: () => import('@/views/admin/ipadServer/index'), name: 'AdminIpadServer', meta: { title: 'Ipad服务器' } },
    { path: 'keywordManage', component: () => import('@/views/admin/keywordManage/index'), name: 'AdminKeywordManage', meta: { title: '关键词管理' } },

    // 14. Lobster 引擎（挂在 /admin/lobster-mgmt 下，通过 sys_menu 数据库驱动）
    { path: 'workflowGenerate', component: () => import('@/views/lobster/workflow-generate/index'), name: 'AdminWorkflowGenerate', meta: { title: 'AI生成工作流' } },
    { path: 'salesCorpus', component: () => import('@/views/lobster/sales-corpus/index'), name: 'AdminSalesCorpus', meta: { title: '销冠语料学习' } },
    { path: 'instance', component: () => import('@/views/lobster/instance/index'), name: 'AdminLobsterInstance', meta: { title: '实例监控' } },
    { path: 'optimization', component: () => import('@/views/lobster/optimization/index'), name: 'AdminLobsterOptimization', meta: { title: 'AI优化建议' } },
    { path: 'prompt', component: () => import('@/views/lobster/prompt/index'), name: 'AdminLobsterPrompt', meta: { title: '提示词管理' } },
    { path: 'deadLetter', component: () => import('@/views/lobster/dead-letter/index'), name: 'AdminLobsterDeadLetter', meta: { title: '死信队列' } }
  ]
}

export default adminRoutes
