import { Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Paper, Tooltip } from "@mui/material";
import { useState } from "react";
import PhotoLibraryIcon from "@mui/icons-material/PhotoLibrary";
import ImageFormContent from "./ImageFormContent";

const ImageDialog = ({ images }) => {
    const [openImageDialog, setOpenImageDialog] = useState(false);

    return (
        <>
            <Tooltip title="تصاویر">
                <IconButton color="primary" onClick={() => setOpenImageDialog(true)}>
                    <PhotoLibraryIcon />
                </IconButton>
            </Tooltip>
            <Dialog
                fullWidth
                open={openImageDialog}
                onClose={() => setOpenImageDialog(false)}
                PaperProps={{
                    sx: {
                        boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
                    },
                }}
                maxWidth={"sm"}
                scroll="paper"
            >
                <DialogTitle sx={{ fontSize: "large" }}>تصاویر</DialogTitle>
                {openImageDialog && (
                    <DialogContent>
                        <ImageFormContent image={images[1]} title={"تصویر تصادف"} />
                        <ImageFormContent image={images[0]} title={"تصویر تصادف"} />
                    </DialogContent>
                )}
                <DialogActions>
                    <Button onClick={() => setOpenImageDialog(false)} variant="outlined" color="secondary">
                        بستن
                    </Button>
                </DialogActions>
            </Dialog>
        </>
    );
};
export default ImageDialog;
