/**
 * Wrapper for beautiful-dnd library
 *
 * @author Denis Makarov
 * @date 2020-03-09
 */

import * as React from 'react';
import {
    DragDropContext as DndContext,
    DragDropContextProps as DndContextProps,
    Draggable as DndDraggable,
    DraggableProps as DndDraggableProps,
    Droppable as DndDroppable,
    DroppableProps as DndDroppableProps,
    DropResult as DndDDropResult,
    DroppableProvided as DndDroppableProvided,
    DraggableProvided as DndDraggableProvided,
    DroppableStateSnapshot as DndDroppableSnapshot,
    DraggableStateSnapshot as DndDraggableSnapshot
} from 'react-beautiful-dnd';

export type DragDropContextProps = DndContextProps;

export type DroppableProps = DndDroppableProps;

export type DroppableProvided = DndDroppableProvided;

export type DraggableProvided = DndDraggableProvided;

export type DraggableStateSnapshot = DndDraggableSnapshot;

export type DroppableStateSnapshot = DndDroppableSnapshot;

export type DraggableProps = DndDraggableProps;

export type DropResult = DndDDropResult;

export class DragDropContext extends React.Component<DragDropContextProps> {
    override render () {
        return (
            <DndContext {...this.props}>
                {this.props.children}
            </DndContext>
        );
    }
}

export class Droppable extends React.Component<DroppableProps> {
    override render () {
        return (
            <DndDroppable {...this.props}>
                {this.props.children}
            </DndDroppable>
        );
    }
}

export class Draggable extends React.Component<DraggableProps> {
    override render () {
        return (
            <DndDraggable {...this.props}>
                {this.props.children}
            </DndDraggable>
        );
    }
}
