import { Toaster as Sonner, toast } from "sonner";

/**
 * Toast host — port of fe0/src/components/ui/sonner.tsx.
 *
 * Simplified: fe0 read the active theme via `next-themes` (`useTheme`) to drive the
 * toaster's light/dark mode. The app shells ship a single (light) theme and have no
 * theme provider, so the `next-themes` dependency is dropped and `theme` defaults to
 * "system". The toast classNames are preserved verbatim for visual parity.
 */
type ToasterProps = React.ComponentProps<typeof Sonner>;

const Toaster = ({ ...props }: ToasterProps) => {
  return (
    <Sonner
      theme="system"
      className="toaster group"
      toastOptions={{
        classNames: {
          toast:
            "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
          description: "group-[.toast]:text-muted-foreground",
          actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
          cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
        },
      }}
      {...props}
    />
  );
};

export { Toaster, toast };
