import DeleteIcon from "@mui/icons-material/Delete";
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
import { useState } from "react";
import DeleteContent from "./DeleteContent";
const Delete = ({ rowId, mutate }) => {
  const [openDeleteDialog, setOpenDeleteDialog] = useState(false);

  return (
    <>
      <Tooltip title="حذف">
        <IconButton color="error" onClick={() => setOpenDeleteDialog(true)}>
          <DeleteIcon />
        </IconButton>
      </Tooltip>
      <Dialog
        open={openDeleteDialog}
        onClose={() => setOpenDeleteDialog(false)}
        PaperProps={{
          sx: {
            boxShadow:
              "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
          },
        }}
        dir="rtl"
        maxWidth={"md"}
      >
        <DialogTitle>حذف</DialogTitle>
        <DeleteContent
          rowId={rowId}
          mutate={mutate}
          setOpenDeleteDialog={setOpenDeleteDialog}
        />
      </Dialog>
    </>
  );
};
export default Delete;
