// (C) 2024-2025 GoodData Corporation
import { isDashboardLayoutDraggableItem, isDashboardLayoutDraggableListItem, isInsightDraggableItem, isInsightDraggableListItem, isInsightPlaceholderDraggableItem, isRichTextDraggableItem, isRichTextDraggableListItem, isVisualizationSwitcherDraggableItem, isVisualizationSwitcherDraggableListItem, } from "../types.js";
export function draggableWidgetDropHandler(item, handlers) {
    if (isInsightDraggableListItem(item)) {
        handlers.handleInsightListItemDrop(item.insight);
    }
    if (isInsightPlaceholderDraggableItem(item)) {
        handlers.handleInsightPlaceholderDrop();
    }
    if (isRichTextDraggableListItem(item)) {
        handlers.handleRichTextPlaceholderDrop(item.size);
    }
    if (isVisualizationSwitcherDraggableListItem(item)) {
        handlers.handleVisualizationSwitcherPlaceholderDrop(item.size);
    }
    if (isDashboardLayoutDraggableListItem(item)) {
        handlers.handleDashboardLayoutPlaceholderDrop(item.size);
    }
    if (isInsightDraggableItem(item) ||
        isRichTextDraggableItem(item) ||
        isVisualizationSwitcherDraggableItem(item) ||
        isDashboardLayoutDraggableItem(item)) {
        handlers.handleWidgetDrop(item);
    }
}
