import type { App } from 'vue'

import { TreeNode as VcTreeNode } from '../vc-tree'
import DirectoryTree from './DirectoryTree'
import Tree from './Tree'

export type { DataNode, EventDataNode } from '../vc-tree/interface'

export type {
  AntdTreeNodeAttribute,
  AntTreeNodeCheckedEvent,
  AntTreeNodeDragEnterEvent,
  AntTreeNodeDropEvent,
  AntTreeNodeExpandedEvent,
  AntTreeNodeMouseEvent,
  AntTreeNodeSelectedEvent,
  TreeDataItem,
  TreeProps,
} from './Tree'

export type { ExpandAction as DirectoryTreeExpandAction, DirectoryTreeProps } from './DirectoryTree'

/* istanbul ignore next */

const TreeNode = VcTreeNode

export { DirectoryTree, TreeNode }

export default Object.assign(Tree, {
  DirectoryTree,
  TreeNode,
  install: (app: App) => {
    app.component(Tree.name, Tree)
    app.component(TreeNode.name, TreeNode)
    app.component(DirectoryTree.name, DirectoryTree)
    return app
  },
})
