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} sx={{ borderRadius: 2 }}>
      {children}
    </MuiAlert>
  );
}
