"use client";

import Link from "next/link";
import { useTranslation } from "react-i18next";

import { adminHasAnyPermission } from "@/lib/admin-permissions";
import { PRD_SETTLEMENT_AGENT_ACCESS_ANY } from "@/lib/admin-prd";
import { useAdminProfile } from "@/stores/admin-session";

/** 钱包模块仅服务主站钱包玩家；信用盘结账在结算中心。 */
export function WalletScopeHint(): React.ReactElement {
  const { t } = useTranslation("wallet");
  const profile = useAdminProfile();
  const canSettlement = adminHasAnyPermission(profile?.permissions, [
    ...PRD_SETTLEMENT_AGENT_ACCESS_ANY,
  ]);

  return (
    <p className="text-sm text-muted-foreground">
      {t("scopeHint", {
        defaultValue:
          "本模块为主站钱包模式：钱包流水与主站转账单。信用盘玩家的下注占用、结算记账请查看",
      })}
      {canSettlement ? (
        <Link href="/admin/settlement-center" className="mx-1 text-primary underline">
          {t("scopeHintSettlementLink", { defaultValue: "结算中心" })}
        </Link>
      ) : (
        <span className="mx-1 font-medium text-foreground">
          {t("scopeHintSettlement", { defaultValue: "结算中心" })}
        </span>
      )}
      。
    </p>
  );
}
