import React from 'react';
import {FaRegTrashAlt} from "react-icons/fa";
import {toast} from "react-toastify";
import {
    AlertDialog, AlertDialogAction, AlertDialogCancel,
    AlertDialogContent, AlertDialogDescription, AlertDialogFooter,
    AlertDialogHeader,
    AlertDialogTitle,
    AlertDialogTrigger
} from "@/components/ui/alert-dialog";
import DangerButton from "@/components/common-ui/DangerButton";
interface Props {
    Delete: (id: any, second_id?: any) => Promise<any>
    id: any
    second_id?: any
    sm?: boolean
}
function DeleteConfirmation({Delete, id, second_id, sm}: Props) {
    return (
        <AlertDialog>
            <AlertDialogTrigger>
                <DangerButton text={<FaRegTrashAlt/>} classNames={'px-4 py-2 rounded cursor-pointer'}/>
            </AlertDialogTrigger>
            <AlertDialogContent>
                <AlertDialogHeader>
                    <AlertDialogTitle className='text-red-500'>Confirm Deletion</AlertDialogTitle>
                    <AlertDialogDescription>
                        Are you sure you want to proceed with this action?
                    </AlertDialogDescription>
                </AlertDialogHeader>
                <AlertDialogFooter>
                    <AlertDialogCancel
                        onClick={() => {toast.info('Action Cancelled');}}
                    >Cancel</AlertDialogCancel>
                    <AlertDialogAction
                        onClick={() => {Delete(id, second_id)}}
                    >Yes</AlertDialogAction>
                </AlertDialogFooter>
            </AlertDialogContent>
        </AlertDialog>
    );
}

export default DeleteConfirmation;