type RiskTranslate = (key: string, options?: { ns?: string }) => string;

/** 风控占用流水来源（risk.sourceReasonOptions） */
export function riskSourceReasonLabel(
  reason: string | null | undefined,
  t: RiskTranslate,
): string {
  if (reason == null || reason === "") {
    return "—";
  }
  const key = `sourceReasonOptions.${reason}`;
  const translated = t(key, { ns: "risk" });
  return translated === key ? reason : translated;
}

export type RiskPoolsPageTitleKey = "hotPageTitle" | "soldOutPageTitle" | "allPoolsPageTitle";

/** 锁定 / 释放动作（risk.lock / risk.release） */
export function riskActionTypeLabel(action: string, t: RiskTranslate): string {
  if (action === "lock") {
    return t("lock", { ns: "risk" });
  }
  if (action === "release") {
    return t("release", { ns: "risk" });
  }
  return action;
}
