import Button from "@mui/material/Button";
import Dialog from "@mui/material/Dialog";
import DialogActions from "@mui/material/DialogActions";
import DialogContent from "@mui/material/DialogContent";
import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle";
import { useExternalI18n } from "../i18n/ExternalI18nProvider.jsx";

export function ConfirmDialog({ confirmColor = "primary", content, loading, onClose, onConfirm, open, title }) {
  const { t } = useExternalI18n();
  return (
    <Dialog fullWidth maxWidth="xs" open={open} onClose={loading ? undefined : onClose}>
      <DialogTitle>{title}</DialogTitle>
      <DialogContent><DialogContentText>{content}</DialogContentText></DialogContent>
      <DialogActions><Button disabled={loading} onClick={onClose}>{t("common.cancel")}</Button><Button color={confirmColor} disabled={loading} onClick={onConfirm} variant="contained">{t("common.confirm")}</Button></DialogActions>
    </Dialog>
  );
}
