import {
    AlertDialogAction,
    AlertDialogContent,
    AlertDialogDescription,
    AlertDialogFooter,
    AlertDialogHeader,
    AlertDialogTitle,
} from '@/Components/ui/alert-dialog';
import { AlertDialog as BaseAlertDialog } from '@radix-ui/react-alert-dialog';

export default function AlertDialog({
    open,
    title,
    children: description,
    positiveActionLabel = 'OK',
    negativeActionLabel,
    onPositiveActionClick,
    onNegativeActionClick,
}: {
    open: boolean;
    title: string;
    children: string;
    positiveActionLabel?: string;
    negativeActionLabel?: string;
    onPositiveActionClick: () => void;
    onNegativeActionClick?: () => void;
}) {
    return (
        <BaseAlertDialog open={open}>
            <AlertDialogContent>
                <AlertDialogHeader>
                    <AlertDialogTitle>{title}</AlertDialogTitle>
                    <AlertDialogDescription className="text-zinc-500">
                        {description}
                    </AlertDialogDescription>
                </AlertDialogHeader>
                <AlertDialogFooter>
                    {negativeActionLabel ? (
                        <AlertDialogAction onClick={onNegativeActionClick}>
                            {negativeActionLabel}
                        </AlertDialogAction>
                    ) : null}
                    <AlertDialogAction onClick={onPositiveActionClick}>
                        {positiveActionLabel}
                    </AlertDialogAction>
                </AlertDialogFooter>
            </AlertDialogContent>
        </BaseAlertDialog>
    );
}
