import styles from './styles.module.css'
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 { v4 } from "uuid"

interface ConfirmDialogInterface {
    open: boolean
    closeCallback: any
    agreeCallback: any
    text: string
}

export default function ConfirmDialog({open, agreeCallback, closeCallback, text}: ConfirmDialogInterface) {
    return (
        <Dialog
            open={open}
            onClose={closeCallback}
            aria-labelledby="alert-dialog-title"
            aria-describedby="alert-dialog-description"
        >
            <DialogTitle>
                {"Are you sure?"}
            </DialogTitle>
            <DialogContent>
                <DialogContentText>
                    {text}
                </DialogContentText>
            </DialogContent>
            <DialogActions>
                <Button onClick={() => agreeCallback(v4())} autoFocus>
                    Agree
                </Button>
                <Button onClick={closeCallback}>Disagree</Button>
            </DialogActions>
        </Dialog>
    );
}
