export const zh = {
  nav: {
    label: '导航',
    overview: '总览',
    projects: '项目管理',
    tasks: '任务看板',
    events: '事件日志',
    meetings: '会议室',
    analytics: '活动分析',
    agents: 'Agent 配置',
    reports: '研究报告',
    briefings: 'Leader 简报',
    settings: '设置',
  },
  status: {
    connected: '已连接',
    disconnected: '未连接',
  },
  common: {
    loading: '加载中...',
    save: '保存',
    cancel: '取消',
    delete: '删除',
    confirm: '确认',
    create: '创建',
    add: '添加',
    edit: '编辑',
    back: '返回',
    noData: '暂无数据',
    loadFailed: (msg: string) => `加载失败: ${msg}`,
    submitting: '提交中...',
    deleting: '删除中...',
    creating: '创建中...',
    adding: '添加中...',
    saving: '保存中...',
    confirm_delete: '确认删除',
    demo: '（演示）',
  },
  agentStatus: {
    busy: '工作中',
    waiting: '等待',
    offline: '关闭',
    waitingLong: '等待中',
  },
  teamStatus: {
    active: '进行中',
    completed: '已完成',
    archived: '已归档',
  },
  dashboard: {
    title: '总览',
    projectCount: '项目数量',
    projectCountDesc: '已创建的项目总数',
    agentCount: 'Agent 总数',
    agentCountDesc: '所有项目中的 Agent',
    agentCountHookDesc: (count: number) => `含 ${count} 个自动捕获的 Agent`,
    activeTasks: '活跃任务',
    activeTasksDesc: '正在执行中的任务',
    completedTasks: '已完成任务',
    completedTasksDesc: '累计完成的任务数',
    pendingDecisions: '待处理决策',
    noPendingItems: '无需处理的事项',
    systemHealth: '系统健康状态',
    apiStatus: 'API 状态',
    apiOnline: '在线',
    apiOffline: '离线',
    wsConnection: 'WebSocket 连接',
    wsConnected: '已连接',
    wsDisconnected: '未连接',
    teamCount: '团队数量',
    lastActivity: '最后活动',
    noActivity: '暂无',
    teamOverview: '团队状态概览',
    activeProjects: '活跃项目',
    allProjects: '全部项目',
    noProjects: '暂无项目，请先创建一个项目',
    quickActions: '快速操作',
    viewTaskWall: '查看任务墙',
    viewAnalytics: '活动分析',
    systemSettings: '系统设置',
    recentActivity: '近期活动',
    noActivityRecords: '暂无活动记录',
    viewAllEvents: '查看全部事件',
    taskProgress: (completed: number, total: number) => `${completed}/${total} 任务完成`,
    agentsWorking: (count: number) => `${count} 个 Agent 工作中`,
    noAgentActivity: '暂无 Agent 活动',
    viewDetails: '查看详情',
    loadFailed: (msg: string) => `加载失败: ${msg}`,
    teamEvent: '团队事件',
    meetingEvent: '会议事件',
  },
  tasks: {
    title: '项目任务墙',
    selectProject: '选择项目',
    executeTask: '执行新任务',
    totalTasks: (count: number) => `共 ${count} 个任务`,
    avgScore: (score: string) => `平均分 ${score}`,
    completed: (count: number) => `已完成: ${count}`,
    completedSection: '已完成',
    noTasks: '暂无任务',
    selectProjectHint: '请先选择一个项目以查看任务',
    loadFailed: (msg: string) => `加载任务失败：${msg}`,
    targetTeam: '目标团队',
    selectTeam: '选择团队',
    taskTitle: '任务标题',
    taskTitlePlaceholder: '输入任务标题',
    taskDesc: '任务描述',
    taskDescPlaceholder: '输入任务描述（可选）',
    submit: '提交',
    horizonShort: '短期',
    horizonMid: '中期',
    horizonLong: '长期',
  },
  projects: {
    title: '项目管理',
    createProject: '创建项目',
    projectList: '项目列表',
    noProjects: '暂无项目，点击上方按钮创建第一个项目',
    colName: '名称',
    colDesc: '描述',
    colStatus: '状态',
    colCreatedAt: '创建时间',
    colActions: '操作',
    viewDetail: '详情',
    deleteProject: '删除',
    confirmDelete: '确认删除',
    confirmDeleteDesc: (name: string) => `确定要删除项目「${name}」吗？此操作不可撤销。`,
    createTitle: '创建项目',
    createDesc: '创建一个新的 AI Agent 项目',
    projectName: '项目名称',
    projectNamePlaceholder: '输入项目名称',
    projectDesc: '项目描述',
    projectDescPlaceholder: '输入项目描述（可选）',
    rootPath: '根路径',
    rootPathPlaceholder: '项目根目录路径（可选）',
    loadFailed: (msg: string) => `加载失败: ${msg}`,
    statusActive: '工作中',
    statusInactive: '关闭',
    expandActiveTeams: (n: number) => `${n} 个活跃团队`,
    expandPendingTasks: (n: number) => `${n} 个待处理任务`,
    expandTopTasks: '待处理任务',
    expandLastUpdated: '更新时间',
    colTaskCount: '任务数',
  },
  teams: {
    title: '项目管理',
    createTeam: '创建项目',
    teamList: '项目列表',
    noTeams: '暂无项目，点击上方按钮创建第一个项目',
    colName: '名称',
    colMode: '编排模式',
    colAgentCount: 'Agent 数',
    colTaskCount: '任务数',
    colCreatedAt: '创建时间',
    colActions: '操作',
    viewDetail: '详情',
    deleteTeam: '删除',
    loadFailed: (msg: string) => `加载失败: ${msg}`,
    confirmDelete: '确认删除',
    confirmDeleteDesc: (name: string) => `确定要删除项目「${name}」吗？此操作不可撤销。`,
    createTitle: '创建项目',
    createDesc: '创建一个新的 AI Agent 项目',
    teamName: '项目名称',
    teamNamePlaceholder: '输入项目名称',
    modeLabel: '编排模式',
    modeCoordinate: 'coordinate（协调模式）',
    modeBroadcast: 'broadcast（广播模式）',
    creating: '创建中...',
    deleting: '删除中...',
  },
  teamDetail: {
    backToList: '返回项目列表',
    loadFailed: (name: string) => `加载失败: ${name}`,
    notFound: '项目不存在',
    colProjectId: '项目 ID',
    colMode: '编排模式',
    colAgentCount: 'Agent 数量',
    colCreatedAt: '创建时间',
    agentList: 'Agent 列表',
    addAgent: '添加 Agent',
    noAgents: '暂无 Agent，点击上方按钮添加',
    colName: '名称',
    colRole: '角色',
    colModel: '模型',
    colStatus: '状态',
    colActions: '操作',
    autoCaptured: '自动捕获',
    deleteAgent: '删除',
    taskHistory: '任务历史',
    startMeeting: '发起会议',
    runTask: '执行新任务',
    noTasks: '暂无任务记录',
    colTaskTitle: '任务标题',
    colTaskStatus: '状态',
    colTaskCreatedAt: '创建时间',
    activityTracking: '活动追踪',
    recentCount: '最近 100 条',
    noActivities: '暂无活动记录',
    colTime: '时间',
    colTool: '工具',
    colInputSummary: '输入摘要',
    colDuration: '耗时',
    colStatusIcon: '状态',
    addAgentDialog: '添加 Agent',
    addAgentDesc: (name: string) => `为项目「${name}」添加一个新的 Agent`,
    agentNameLabel: 'Agent 名称',
    agentNamePlaceholder: '输入 Agent 名称',
    agentRoleLabel: '角色',
    agentRolePlaceholder: '例如：researcher, coder, reviewer',
    agentPromptLabel: '系统提示词',
    agentPromptPlaceholder: '输入 Agent 的系统提示词（可选）',
    agentModelLabel: '模型',
    adding: '添加中...',
    add: '添加',
    confirmDeleteAgent: '确认删除',
    confirmDeleteAgentDesc: (name: string) => `确定要删除 Agent「${name}」吗？此操作不可撤销。`,
    cancel: '取消',
    deleting: '删除中...',
    runTaskDialog: '执行新任务',
    runTaskDesc: (name: string) => `为项目「${name}」创建并执行一个新任务`,
    taskTitleLabel: '任务标题',
    taskTitlePlaceholder: '输入任务标题',
    taskDescLabel: '任务描述',
    taskDescPlaceholder: '详细描述任务内容',
    running: '执行中...',
    run: '执行',
    meetingDialog: '发起会议',
    meetingDesc: (name: string) => `为项目「${name}」发起一场 Agent 会议`,
    meetingTopicLabel: '会议主题',
    meetingTopicPlaceholder: '输入会议讨论主题',
    meetingParticipants: (names: string) => `参会者：${names}`,
    noParticipants: '暂无 Agent',
    meetingCreating: '创建中...',
    meetingCreate: '发起会议',
    agentStatusOnline: '在线',
    agentStatusBusy: '工作中',
    agentStatusWaiting: '等待',
    agentStatusError: '错误',
    agentStatusOffline: '关闭',
    taskStatusCompleted: '已完成',
    taskStatusRunning: '进行中',
    taskStatusFailed: '失败',
    taskStatusPending: '等待中',
  },
  projectDetail: {
    backToList: '返回项目列表',
    projectNotFound: '项目不存在',
    description: '描述',
    activeTeams: '当前团队',
    historyTeams: '历史团队',
    createdAt: '创建时间',
    teamsUnit: '个',
    noActiveTeams: '暂无活跃团队。通过 MCP 的 team_create 工具创建新团队开始工作。',
    historyTeamsTitle: (count: number) => `历史团队 (${count})`,
    noDetailRecord: '无详细记录',
    addAgent: 'Agent',
    runTask: '任务',
    startMeeting: '会议',
    noMembers: '暂无团队成员',
    noMembersHint: '点击上方 "+ Agent" 添加成员开始协作',
    memberCount: (count: number) => `${count} 成员`,
    agentRole: '角色:',
    agentTask: '任务:',
    agentPending: '待分配',
    agentNoActivity: '无活动记录',
    activityTracking: '活动追踪',
    noActivityHint: '暂无活动记录（Agent开始工作后自动显示）',
    colTime: '时间',
    colAgent: 'Agent',
    colTool: '工具',
    colSummary: '摘要',
    colDuration: '耗时',
    colStatus: '状态',
    decisionTimeline: '决策时间线',
    noDecisions: '暂无决策记录（团队开始工作后自动显示）',
    agentName: '名称',
    agentModel: '模型',
    agentSession: '会话',
    agentCurrentTask: '当前任务',
    noActiveSession: '无活跃会话',
    addAgentDialog: '添加 Agent',
    agentNameLabel: '名称',
    agentRoleLabel: '角色',
    confirmDeleteAgent: '确认删除',
    confirmDeleteAgentDesc: (name: string) => `确定要删除 Agent「${name}」吗？`,
    createTask: '创建任务',
    taskTitleLabel: '标题',
    taskDescLabel: '描述',
    startMeetingDialog: '发起会议',
    meetingTopicLabel: '主题',
    initiate: '发起',
    deptQA: 'QA部门',
    deptFrontend: '前端工程',
    deptBackend: '后端工程',
    deptEng: '工程部门',
    deptRD: 'R&D研发',
    deptOps: '运营部门',
    deptOther: '其他成员',
    decisionLabelAgentCreated: (name: string) => `Agent创建: ${name}`,
    decisionLabelTaskAssigned: (title: string) => `任务分配: ${title}`,
    decisionLabelMeeting: (topic: string) => `会议: ${topic}`,
    decisionLabelTeamCreated: (name: string) => `团队创建: ${name}`,
    decisionDetailRole: (role: string) => `角色: ${role}`,
    decisionDetailAssignedTo: (to: string) => `分配给: ${to}`,
    decisionDetailParticipants: (list: string) => `参与者: ${list}`,
  },
  events: {
    title: '事件日志',
    allTypes: '全部类型',
    filterBySource: '按来源过滤...',
    colTime: '时间',
    colType: '类型',
    colSource: '来源',
    colSummary: '摘要',
    noEvents: '暂无事件记录',
    loadFailed: (msg: string) => `加载事件失败：${msg}`,
    limit50: '50条',
    limit100: '100条',
    limit200: '200条',
  },
  meetings: {
    title: '会议室',
    all: (count: number) => `全部 (${count})`,
    active: (count: number) => `进行中 (${count})`,
    concluded: (count: number) => `已结束 (${count})`,
    createMeeting: '创建会议',
    noMeetings: '暂无会议',
    noActiveMeetings: '暂无进行中的会议',
    noConcludedMeetings: '暂无已结束的会议',
    activeSection: (count: number) => `进行中的会议 (${count})`,
    concludedSection: (count: number) => `已结束的会议 (${count})`,
    createTitle: '创建新会议',
    createDesc: '为团队创建一个新的讨论会议',
    selectTeam: '选择团队',
    selectTeamPlaceholder: '选择团队...',
    topicLabel: '会议主题',
    topicPlaceholder: '输入会议主题...',
    agendaLabel: '议程',
    agendaOptional: '(可选)',
    agendaPlaceholder: '输入会议议程...',
    statusActive: '进行中',
    statusConcluded: '已结束',
    durationJustStarted: '刚刚开始',
    durationHoursMinutes: (h: number, m: number) => `${h}小时${m}分钟`,
    durationMinutes: (m: number) => `${m}分钟`,
    participantsCount: (n: number) => `${n} 人参与`,
    agendaPrefix: '议程',
  },
  meetingDetail: {
    back: '返回',
    backToList: '返回会议列表',
    notFound: '会议不存在',
    loadFailed: (msg: string) => `加载失败: ${msg}`,
    statusActive: '进行中',
    statusEnded: '会议已结束',
    participants: (count: number) => `${count} 人参与`,
    discussion: '会议讨论',
    noMessages: '暂无讨论消息',
    round: (n: number) => `第 ${n} 轮`,
  },
  analytics: {
    title: '活动分析',
    allTeams: '全部团队',
    selectTeam: '选择团队',
    noTeamData: '暂无团队数据',
    totalActivities: '总活动数',
    activeAgents: '活跃Agent',
    topTool: '最常用工具',
    toolDistribution: '工具使用分布',
    noToolData: '暂无工具使用数据',
    agentRanking: 'Agent活跃度排行',
    noAgentData: '暂无Agent活动数据',
    activityTimeline: '活动时间线（过去24小时）',
    noTimelineData: '暂无时间线数据',
    efficiencyMetrics: '效率指标',
    taskCompletionRate: '任务完成率',
    avgCompletionTime: '平均完成时间',
    avgToolsPerTask: '平均工具调用/任务',
    topAgents: '最高效Agent排行',
    noEfficiencyData: '暂无效率数据',
    colAgent: 'Agent',
    colActivityCount: '活动数',
    colToolTypes: '工具种类',
    colLastActive: '最后活跃',
    colActiveTime: '活跃时长',
    colEfficiency: '效率(次/时)',
    timeMinutes: (m: number) => `${m}分钟`,
    timeHours: (h: number) => `${h}小时`,
    timeJustNow: '刚刚',
    timeMinutesAgo: (m: number) => `${m}分钟前`,
    timeHoursAgo: (h: number) => `${h}小时前`,
    timeDaysAgo: (d: number) => `${d}天前`,
    timeMonthsAgo: (m: number) => `${m}个月前`,
    timeYearsAgo: (y: number) => `${y}年前`,
    timeTooltip: (hour: string | number, count: number) => `${hour}时: ${count}次活动`,
  },
  settings: {
    tabGeneral: '通用设置',
    tabInfra: '基础设施',
    tabTeam: '团队配置',
    tabWake: '唤醒设置',
    tabAbout: '关于',
    wakeTitle: '唤醒设置',
    wakeDesc: '配置 Leader Agent 定时唤醒行为',
    wakeInterval: '唤醒间隔',
    wakeIntervalOff: '关闭',
    wakeInterval10m: '10 分钟',
    wakeInterval30m: '30 分钟',
    wakeInterval1h: '1 小时',
    wakePrompt: '唤醒 Prompt 模板',
    wakePromptPlaceholder: '输入唤醒提示词...',
    wakeAutonomy: '自主决策级别',
    wakeAutonomyFull: '完全自主',
    wakeAutonomyConsult: '重要事项请示',
    wakeAutonomyReadonly: '仅检查不执行',
    wakeSave: '保存唤醒设置',
    wakeSavedMsg: '唤醒设置已保存',
    generalTitle: '通用设置',
    generalDesc: '配置项目基本信息和界面偏好',
    projectName: '项目名称',
    projectNamePlaceholder: '请输入项目名称',
    projectDesc: '项目描述',
    projectDescPlaceholder: '请输入项目描述',
    defaultModel: '默认LLM模型',
    interfaceLang: '界面语言 / Interface Language',
    langSwitchHint: '切换界面语言，立即生效',
    darkMode: '深色主题',
    darkModeHint: '切换深色/浅色主题模式',
    saveDemo: '保存（演示）',
    storageTitle: '存储配置',
    storageDesc: '数据库和缓存后端设置',
    storageBackend: '存储后端',
    dbUrl: '数据库URL',
    dbUrlHintSqlite: 'SQLite数据库文件路径',
    dbUrlHintPg: 'PostgreSQL连接字符串',
    cacheBackend: '缓存后端',
    cacheMemory: '内存缓存',
    cacheRedis: 'Redis',
    redisUrl: 'Redis URL',
    memoryBackend: '记忆后端',
    memoryFile: '文件系统',
    portsTitle: '服务端口',
    portsDesc: 'API和Dashboard服务端口配置',
    apiPort: 'API端口',
    dashboardPort: 'Dashboard端口',
    teamDefaultsTitle: '团队默认配置',
    teamDefaultsDesc: '配置自动创建团队和团队名称前缀',
    autoCreateTeam: '自动创建团队',
    autoCreateTeamHint: '新项目启动时自动创建团队',
    teamNamePrefix: '团队名称前缀',
    teamNamePrefixPlaceholder: '例如: project-alpha',
    teamNamePrefixHint: '自动创建团队时使用的名称前缀',
    templatesTitle: '团队模板',
    templatesDesc: '选择预设模板快速添加成员到常驻列表',
    noTemplates: '暂无可用模板',
    useTemplate: '使用此模板',
    membersTitle: '常驻团队成员',
    membersDesc: '配置每次创建团队时自动添加的常驻成员',
    noMembers: '暂无常驻成员，点击下方按钮添加',
    memberEnabled: '启用',
    memberDisabled: '禁用',
    memberNamePlaceholder: '名称',
    memberRolePlaceholder: '角色描述',
    addMember: '添加常驻成员',
    saveTeamConfig: '保存团队配置',
    savedMsg: '设置已保存',
    teamConfigSavedMsg: '团队配置已保存',
    memberAddedMsg: '成员已添加',
    memberDeletedMsg: '成员已删除',
    memberUpdatedMsg: '成员信息已更新',
    templateAlreadyExists: '模板中的成员已全部存在',
    templateApplied: (name: string, count: number) => `已从"${name}"添加 ${count} 个成员`,
    membersUnit: (count: number) => `${count} 人`,
    aboutTitle: '关于 AI Team OS',
    aboutDesc: '版本和项目信息',
    version: '版本',
    techStack: '技术栈',
    license: '许可证',
    python: 'Python',
    nodejs: 'Node.js',
    coreDeps: '核心依赖',
    depLangGraph: 'LangGraph — AI编排引擎',
    depFastAPI: 'FastAPI — REST API框架',
    depMem0: 'Mem0 — 记忆管理',
    depReact: 'React + TypeScript — 前端',
    depDB: 'SQLite / PostgreSQL — 数据存储',
    depZustand: 'Zustand — 状态管理',
    defaultProjectDesc: '通用可复用的AI Agent团队操作系统框架',
  },
  activityLog: {
    loading: '加载中...',
    noActivities: '暂无活动记录',
    ariaRunning: '进行中',
    ariaError: '错误',
    ariaCompleted: '已完成',
  },
  taskCard: {
    statusPending: '待处理',
    statusRunning: '运行中',
    statusCompleted: '已完成',
    statusFailed: '失败',
    priorityCritical: '紧急',
    priorityHigh: '高',
    priorityMedium: '中',
    priorityLow: '低',
    scoreUnit: '分',
  },
  agents: {
    title: 'Agent 配置',
    searchPlaceholder: '搜索 Agent...',
    selectAgent: '点击左侧 Agent 查看并编辑配置',
    noAgents: '未找到 Agent 模板',
    noAgentsHint: '模板文件位于 ~/.claude/agents/ 或 plugin/agents/ 目录',
    loadFailed: (msg: string) => `加载失败: ${msg}`,
    saveFailed: (msg: string) => `保存失败: ${msg}`,
    saveSuccess: '保存成功',
    saving: '保存中...',
    fieldName: '名称',
    fieldDescription: '描述',
    fieldModel: '模型',
    fieldColor: '颜色',
    fieldPrompt: 'Prompt',
    promptPlaceholder: '输入 Agent 系统提示词...',
    descPlaceholder: '输入 Agent 描述...',
    modelOpus: 'Opus（最强）',
    modelSonnet: 'Sonnet（均衡）',
    modelHaiku: 'Haiku（快速）',
    colorOptions: '颜色标识',
    groupEngineering: '工程',
    groupManagement: '管理',
    groupTesting: '测试',
    groupSupport: '支持',
    groupSpecialized: '专项',
    groupOther: '其他',
    save: '保存',
  },
  reports: {
    title: '研究报告',
    searchPlaceholder: '搜索报告...',
    filterAuthor: '全部作者',
    noReports: '暂无报告文件',
    noReportsHint: '报告保存在 ~/.claude/data/ai-team-os/reports/ 目录',
    selectReport: '点击左侧报告查看内容',
    loadFailed: (msg: string) => `加载失败: ${msg}`,
    author: '作者',
    date: '日期',
    size: '大小',
    bytes: 'B',
    kb: 'KB',
  },
  briefings: {
    title: 'Leader 简报',
    tabPending: '待决',
    tabResolved: '已决',
    tabDismissed: '已驳回',
    noItems: '暂无事项',
    options: '可选方案',
    recommendation: '建议',
    resolution: '决策结果',
    resolve: '决策',
    dismiss: '驳回',
    resolveDialogTitle: '输入决策',
    resolutionLabel: '决策内容',
    resolutionPlaceholder: '请输入你的决策或指示...',
    confirmResolve: '确认决策',
    urgency: {
      high: '紧急',
      medium: '一般',
      low: '低优先级',
    },
  },
  taskDetail: {
    horizonShort: '短期',
    horizonMid: '中期',
    horizonLong: '长期',
    memoTypeProgress: '进度',
    memoTypeDecision: '决策',
    memoTypeIssue: '问题',
    memoTypeSummary: '总结',
    fieldHorizon: '周期:',
    fieldScore: '评分:',
    fieldTeam: '团队:',
    fieldAssignedTo: '负责人:',
    sectionDesc: '描述',
    sectionResult: '结果',
    sectionMemo: 'Memo',
    sectionTimeline: '时间轴',
    timelineCreated: '创建',
    timelineStarted: '开始',
    timelineCompleted: '完成',
  },
};

// 递归宽化：string叶子→string，函数保留原类型，对象递归
type DeepLoosen<T> = {
  [K in keyof T]: T[K] extends (...args: infer A) => infer R
    ? (...args: A) => R
    : T[K] extends string
      ? string
      : DeepLoosen<T[K]>;
};

export type Translations = DeepLoosen<typeof zh>;
