const adminLevelLabels = {
  super: "超级管理员",
  school: "校级管理员",
  class: "班级管理员",
};

const workflowTypeLabels = {
  profile_change: "考生资料变更",
  registration_review: "考试报名审核",
  center_change: "考点考场变更",
  candidate_account_batch: "批量报名号申领",
  score_appeal: "考生成绩复议",
};

const businessTypeLabels = {
  plan: "招生计划",
  qualification: "指标资格",
  admission: "录取结果",
  cutoff: "录取分数线",
  reporting: "报到情况",
};

const statusLabels = {
  approved: "已通过",
  pending: "待处理",
  rejected: "已退回",
  draft: "草稿",
  published: "已发布",
  open: "开放中",
  upcoming: "即将开放",
  closed: "已结束",
  archived: "已归档",
  completed: "已完成",
  active: "正常",
  disabled: "已停用",
  unpaid: "未缴费",
  paid: "已缴费",
  final: "正式录取",
  admitted: "已接收",
  school_review: "学校审核",
  withdrawal_pending: "退档待审",
  withdrawn: "已退档",
  reported: "已报到",
  not_reported: "未报到",
  submitted: "已提交",
  filling: "志愿填报中",
  supplementary: "补录中",
  locked: "已锁定",
  visible: "已公开",
  hidden: "已隐藏",
  arranged: "已编排",
};

export function adminLevelLabel(value) {
  return adminLevelLabels[value] || value || "—";
}

export function workflowTypeLabel(value) {
  return workflowTypeLabels[value] || value || "—";
}

export function statusLabel(value) {
  if (value === true) return "是";
  if (value === false) return "否";
  return statusLabels[value] || value || "—";
}

export function businessValueLabel(value) {
  return (
    adminLevelLabels[value] ||
    workflowTypeLabels[value] ||
    businessTypeLabels[value] ||
    statusLabels[value] ||
    value ||
    "—"
  );
}

export function auditDetailLabel(value) {
  if (!value) return "—";
  return String(value)
    .split(" · ")
    .map((part) => businessValueLabel(part))
    .join(" · ");
}
