export const candidateNavigation = [
  { page: 'dashboard', label: '总览', group: '个人总览' },
  { page: 'profile', label: '个人资料', group: '账户与档案' },
  { page: 'security', label: '账户安全', group: '账户与档案' },
  { page: 'exams', label: '考试报名', group: '考试服务' },
  { page: 'registrations', label: '我的报名', group: '考试服务' },
  { page: 'admit', label: '准考证', group: '考试服务' },
  { page: 'results', label: '成绩查询', group: '考试服务' },
  { page: 'admissions', label: '志愿与录取', group: '招生录取' },
  { page: 'notices', label: '通知公告', group: '招生录取' }
];

const adminBase = [
  { page: 'dashboard', label: '工作台', group: '运行总览', levels: ['super', 'school', 'class'] },
  { page: 'schools', label: '学校管理', group: '组织与账户', levels: ['super'] },
  { page: 'organization', label: '本校组织', group: '组织与账户', levels: ['school'] },
  { page: 'admins', label: '管理员', group: '组织与账户', levels: ['super'] },
  { page: 'account-batches', label: '批量建号', group: '组织与账户', levels: ['school'] },
  { page: 'candidates', label: '考生信息', group: '报名考务', levels: ['super', 'school', 'class'] },
  { page: 'indicator-qualifications', label: '指标资格确认', group: '招生录取', levels: ['school'] },
  { page: 'registrations', label: '报名审核', group: '报名考务', levels: ['super', 'school', 'class'] },
  { page: 'payments', label: '缴费名单', group: '报名考务', levels: ['super', 'school', 'class'] },
  { page: 'admit', label: '准考证', group: '报名考务', levels: ['super', 'school', 'class'] },
  { page: 'exams', label: '考试与科目', group: '考试与成绩', levels: ['super'] },
  { page: 'results', label: '成绩管理', group: '考试与成绩', levels: ['super', 'school', 'class'] },
  { page: 'admission-settings', label: '录取设置', group: '招生录取', levels: ['super'] },
  { page: 'admission-accounts', label: '招生账户', group: '招生录取', levels: ['super'] },
  { page: 'admission-plans', label: '招生计划', group: '招生录取', levels: ['super'] },
  { page: 'admission-reporting', label: '报到与补录', group: '招生录取', levels: ['super'] },
  { page: 'admission-supervision', label: '投档监督', group: '招生录取', levels: ['super'] },
  { page: 'notices', label: '通知发布', group: '公开信息', levels: ['super'] },
  { page: 'centers', label: '考场信息', group: '场所与流程', levels: ['super', 'school'] },
  { page: 'flows', label: '流程中心', group: '场所与流程', levels: ['super', 'school', 'class'] },
  { page: 'flow-design', label: '流程设计', group: '系统配置', levels: ['super'] },
  { page: 'number-rules', label: '报名号规则', group: '系统配置', levels: ['super'] },
  { page: 'security', label: '账户安全', group: '系统配置', levels: ['super', 'school', 'class'] }
];

export function adminNavigation(level = 'super') {
  return adminBase.filter(item => item.levels.includes(level));
}

export const admissionNavigation = [
  { page: 'dashboard', label: '工作台', group: '总览' },
  { page: 'plans', label: '招生计划', group: '招生业务' },
  { page: 'placements', label: '投档审核', group: '招生业务' },
  { page: 'reporting', label: '考生报到', group: '招生业务' },
  { page: 'notice-template', label: '通知书模板', group: '文书中心' }
];

export function roleNavigation(role, level) {
  if (role === 'candidate') return candidateNavigation;
  if (role === 'admission_school') return admissionNavigation;
  return adminNavigation(level);
}

export function routeFor(role, page) {
  if (role === 'admission_school') return `/admission/${page}`;
  return `/${role}/${page}`;
}
