import type { ReactNode } from 'react'

export interface Column<T = unknown> {
  key: string
  header: string
  width?: string
  sortable?: boolean
  render?: (value: unknown, row: T) => ReactNode
}

export interface DataTableProps<T extends { id: string }> {
  columns: Column<T>[]
  data: T[]
  onRowClick?: (row: T) => void
  selectedId?: string
  sortable?: boolean
  pageSize?: number
  pageSizeOptions?: number[]
  rowAccent?: (row: T) => 'error' | 'warning' | undefined
  expandedContent?: (row: T) => ReactNode | null
  /** Strip border, radius, and shadow so the table sits flush inside a parent container. */
  flush?: boolean
  /** Make the table fill remaining vertical space in a flex parent.
   *  The table body scrolls while the header stays sticky and the
   *  pagination footer stays pinned at the bottom. */
  fillHeight?: boolean
  /** Controlled sort: called when the user clicks a sortable column header.
   *  When provided, the component skips client-side sorting — the caller is
   *  responsible for providing `data` in the desired order. */
  onSortChange?: (key: string, dir: 'asc' | 'desc') => void
}
