import * as React from 'react';

type IRenderData = {
  isPlaceholder: boolean;
  depth: number;
  isPreview: boolean;
  connectDragSource: any;
  item: NestableItemProps;
  siblings?: NestableItemProps[];
};

interface NestableItemProps {
  children?: React.ReactNode;
  id?: number | string;
  preventItemChangeDepth?: boolean;
  preventChangeParent?: boolean;
  enforcePinnedOrder?: boolean;
  draggable?: boolean;
  lockDropArea?: boolean;
  isCollapsed?: boolean;
  [key: string]: any;
}

export interface NestableListBaseProps {
  dataHook?: string;
  items?: NestableItemProps[];
  readOnly?: boolean;
  isRenderDraggingChildren?: boolean;
  childrenProperty?: string;
  childrenStyle?: React.CSSProperties;
  onUpdate?: (data: { items: object[]; item: object }) => void;
  useDragHandle?: boolean;
  maxDepth?: number;
  threshold?: number;
  onDragStart?: (itemProps: any) => void;
  onDragEnd?: (itemProps: any) => void;
  renderItem?: (data: IRenderData) => React.ReactNode;
  renderAction?: (data: IRenderData) => React.ReactNode;
  renderPrefix?: (data: IRenderData) => React.ReactNode;
  zIndex?: number;
  /** Defines the zIndex of the draggable layer */
  dragLayerZIndex?: number;
  /** Allows dragging and dropping an item only on its own depth */
  preventChangeDepth?: boolean;
  /** Allows dragging and dropping an item only on its own parent */
  preventChangeParent?: boolean;
  /** Allows dragging and dropping an item only on its pin section */
  enforcePinnedOrder?: boolean;
}

export default class NestableListBase extends React.PureComponent<NestableListBaseProps> {}
