'use client';

/**
 * Decomposed shadcn-style tree component.
 *
 * Two usage patterns:
 *
 *   1) High-level (most cases):
 *      <TreeRoot data={...} getItemName={...} onSelectionChange={...} />
 *
 *   2) Composition (full control):
 *      <TreeProvider data={...} getItemName={...}>
 *        <TreeSearchInput />
 *        <TreeContent />
 *      </TreeProvider>
 */

export { TreeRoot, TreeRoot as Tree, default as default } from './TreeRoot';

export {
  TreeProvider,
  useTreeContext,
  useTreeLabels,
  useTreeRows,
  useTreeSelection,
  useTreeExpansion,
  useTreeFocus,
  useTreeSearch,
  useTreeActions,
} from './context';
export type { TreeProviderProps, TreeContextValue } from './context';

export { useTreeTypeAhead, useTreeKeyboard } from './hooks';
export type { UseTreeTypeAheadOptions, UseTreeKeyboardOptions } from './hooks';

export {
  TreeContent,
  TreeRow,
  TreeChevron,
  TreeIcon,
  TreeLabel,
  TreeSearchInput,
  TreeEmpty,
  TreeSkeleton,
  TreeError,
  TreeIndentGuides,
} from './components';
export type {
  TreeContentProps,
  TreeRowProps,
  TreeChevronProps,
  TreeIconProps,
  TreeLabelProps,
  TreeSearchInputProps,
  TreeEmptyProps,
  TreeSkeletonProps,
  TreeErrorProps,
  TreeIndentGuidesProps,
} from './components';

export {
  createChildCache,
  resolveChildren,
  flattenTree,
  loadTreeState,
  saveTreeState,
  clearTreeState,
  createDemoTree,
  DEFAULT_TREE_APPEARANCE,
  resolveAppearance,
  appearanceToStyle,
} from './data';
export type {
  ChildCache,
  ChildEntry,
  ChildEntryStatus,
  FlattenInput,
  PersistedTreeState,
  DemoNode,
  TreeAppearance,
  ResolvedAppearance,
  TreeDensity,
  TreeAccentIntensity,
  TreeRadius,
} from './data';

export { DEFAULT_TREE_LABELS } from './types';
export type {
  TreeRootProps,
  TreeNode,
  TreeItemId,
  TreeLabels,
  TreeSelectionMode,
  TreeActivationMode,
  TreeActivateOptions,
  TreeRowRenderProps,
  TreeRowSlot,
  TreeContextMenuSlot,
  TreeLoadChildren,
  FlatRow,
} from './types';
