import type { ReactNode } from "react";
import MuiAlert from "@mui/material/Alert";

/**
 * Inline contextual alert (form/section feedback) — distinct from the global toast.
 * `onClose` is simplified to take no arguments (MUI's close SyntheticEvent is omitted).
 */
export default function Alert({
  severity = "info",
  children,
  onClose,
}: {
  severity?: "success" | "error" | "warning" | "info";
  children: ReactNode;
  onClose?: () => void;
}) {
  return (
    <MuiAlert
      severity={severity}
      onClose={onClose}
      // Czech label for the close button (MUI defaults to English "Close").
      slotProps={{ closeButton: { "aria-label": "Zavřít" } }}
      sx={{ borderRadius: 2 }}
    >
      {children}
    </MuiAlert>
  );
}
