import { dragAndDropDriverFactory } from '../utils/DragAndDrop/dragAndDropDriverFactory';
import { baseUniDriverFactory, findByHook, } from '../utils/test-utils/unidriver';
import { draggableUniDriverFactory } from '../DragAndDrop/Draggable/Draggable.uni.driver';
import { dataHooks } from './constants';
export const sortableListBaseUniDriverFactory = (base, body) => {
    const getDraggableUniDriver = () => draggableUniDriverFactory(findByHook(base, dataHooks.provider));
    return {
        ...baseUniDriverFactory(base, body),
        /**
         * reorder sortable list items
         * @param {ReorderDataHooks} dataHooks { from: string, to: string }
         * @return {Promise<void>}
         */
        reorder: async ({ dataHookFrom, dataHookTo }) => {
            const draggableDriver = getDraggableUniDriver();
            await draggableDriver.beginDrag({
                dataHook: dataHookFrom,
            });
            await draggableDriver.dragOver({ dataHook: dataHookTo });
            await draggableDriver.endDrag({ dataHook: dataHookTo });
        },
        /**
         * get draggable item current position
         * @param itemDetails { dataHook: string }
         * @return {Promise<void>}
         */
        getItemPosition: async ({ dataHook }) => dragAndDropDriverFactory({ base }).getItemPosition({ dataHook }),
    };
};
export default sortableListBaseUniDriverFactory;
//# sourceMappingURL=SortableListBase.uni.driver.js.map