"use client";
import turnosXpressTheme from "@core/app/theme/turnosXpress";
import { ThemeProvider } from "@emotion/react";
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 React from "react";

export interface ActionDialogParams {
    title: string;
    message: string;
    visible: boolean;
    setVisible: (state: boolean) => void;
    buttons: React.ReactNode[];
}

export default function ActionDialog(props: ActionDialogParams) {
    const { title, message, visible, setVisible, buttons } = props;
    const handleClose = () => {
        setVisible(false);
    };

    return (
        <>
            <ThemeProvider theme={turnosXpressTheme}>
                <Dialog
                    open={visible}
                    onClose={handleClose}
                    aria-labelledby="alert-dialog-title"
                    aria-describedby="alert-dialog-description"
                >
                    <DialogTitle id="alert-dialog-title">{title}</DialogTitle>
                    <DialogContent>
                        <DialogContentText id="alert-dialog-description">
                            {message}
                        </DialogContentText>
                    </DialogContent>
                    <DialogActions>{buttons.map((button) => button)}</DialogActions>
                </Dialog>
            </ThemeProvider>
        </>
    );
}
