"use client";

import { useAuth } from "@/components/providers/auth-provider";
import { useTranslations } from "next-intl";

export function ImpersonationBanner() {
  const { user } = useAuth();
  const t = useTranslations("auth");

  const impersonation = user?.impersonation;
  if (!impersonation?.isImpersonation) {
    return null;
  }

  return (
    <div
      className="border-b border-amber-300 bg-amber-50 px-4 py-2 text-center text-sm text-amber-950 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100"
      role="status"
    >
      {t("impersonationBanner", {
        label: impersonation.label ?? t("impersonationDefaultLabel"),
      })}
    </div>
  );
}
