/**
 * useDataDnd — shared drag-drop machinery for DataList + DataGrid.
 *
 * Both primitives expose six identical drag-drop props:
 *   - dragGroup?:      string   items in this container announce this group when picked up
 *   - accepts?:        string   this container accepts drops whose dragGroup matches (or "*" for any)
 *   - sortable?:       boolean  enable in-container reorder
 *   - dropEvent?:      EventKey bus event on cross-container drop: { id, sourceGroup, targetGroup, newIndex }
 *   - reorderEvent?:   EventKey bus event on in-container reorder: { id, oldIndex, newIndex }
 *   - dndItemIdField?: string   row field used as the @dnd-kit draggable id (default "id")
 *
 * Architecture
 *   - A container that opts in via any dnd prop becomes a "zone".
 *   - The first ancestor zone in the tree creates the DndContext (the "root").
 *   - Inner zones detect the root via React context and skip creating their own.
 *   - The root's onDragEnd reads source + target zone metadata off the dragged
 *     item and the drop target, dispatches to the bus accordingly.
 */
import React from 'react';
import { type UniqueIdentifier } from '@dnd-kit/core';
import type { EntityRow, EventKey } from '@almadar/core';
export interface DataDndProps {
    /**
     * Event emitted N times per drop (one per item in each affected zone) so
     * the trait can persist new positions for every item — not just the moved
     * one. Required for stable sort-by-position because setting only the
     * dragged item's position creates collisions with the (unchanged) others.
     * Payload: { id : string, position : number }.
     */
    positionEvent?: EventKey;
    dragGroup?: string;
    accepts?: string;
    sortable?: boolean;
    dropEvent?: EventKey;
    reorderEvent?: EventKey;
    dndItemIdField?: string;
    /**
     * Mark this container as the DnD root for its subtree. Use on an outer
     * container (e.g. a data-grid hosting inner data-lists) when the container
     * itself is NOT a drop target or sortable, but descendant zones need to
     * share one DndContext so items can be dragged between them. Inner zones
     * with `accepts` / `dragGroup` / `sortable` detect this root and skip
     * creating their own DndContext.
     */
    dndRoot?: boolean;
}
interface UseDataDndArgs<T extends EntityRow> extends DataDndProps {
    items: readonly T[];
    layout: 'list' | 'grid';
}
interface UseDataDndResult<T extends EntityRow> {
    enabled: boolean;
    /** True when this container is a sortable zone (own items are draggable). False in dndRoot-only mode. */
    isZone: boolean;
    wrapContainer: (children: React.ReactNode) => React.ReactNode;
    SortableItem: React.FC<{
        id: UniqueIdentifier;
        children: React.ReactNode;
    }>;
    orderedItems: readonly T[];
}
export declare function useDataDnd<T extends EntityRow>(args: UseDataDndArgs<T>): UseDataDndResult<T>;
export {};
