const deleteGeneratedEOI = async () => {
  // Prevent multiple simultaneous deletion attempts
  if (isDeletingGenerated.value) {
    console.log('Delete already in progress, ignoring additional clicks');
    return;
  }
  
  isDeletingGenerated.value = true;
  
  try {
    const response = await $fetch<{ success: boolean; message: string }>('/api/eoi/delete-generated-document', {
      method: 'POST',
      headers: {
        'x-tag': '094ut234'
      },
      body: {
        interestId: props.interest.Id.toString()
      }
    });
    
    if (response.success) {
      toast.success('Generated EOI deleted successfully');
      showDeleteGeneratedConfirmDialog.value = false;
      signatureStatus.value = null; // Reset signature status
      emit('update'); // Refresh parent data
    }
  } catch (error: any) {
    console.error('Failed to delete generated EOI:', error);
    toast.error(error.data?.statusMessage || 'Failed to delete generated EOI');
  } finally {
    // Add a small delay before allowing another deletion attempt
    setTimeout(() => {
      isDeletingGenerated.value = false;
    }, 1000);
  }
};
