import { useState } from 'react'

import { TreeItemId, TreeItemProps } from './tree.types'

export const useTreeState = (activeItemId?: TreeItemId) => {
  const [itemsInternal, setItemsInternal] = useState<TreeItemProps[]>([])
  const [activeItemIndex, setActiveItemIndex] = useState<TreeItemId>(activeItemId ?? '')

  return { itemsInternal, setItemsInternal, activeItemIndex, setActiveItemIndex }
}
