import type { AdminAccountKind } from "@/types/api/admin-auth";

/** 旧版 localStorage 可能仍存 `site_operator`，归一为 `site_admin`。 */
export function normalizeAdminAccountKind(
  kind: string | undefined | null,
): AdminAccountKind | undefined {
  if (!kind) {
    return undefined;
  }
  if (kind === "site_operator") {
    return "site_admin";
  }
  if (
    kind === "super_admin"
    || kind === "site_admin"
    || kind === "site_finance"
    || kind === "site_cs"
    || kind === "agent_operator"
    || kind === "platform_account"
  ) {
    return kind;
  }
  return undefined;
}
