export type SortDirection = 'asc' | 'desc'

export interface DataTableColumn {
  /** Unique key — used as slot name prefix (`#cell-{key}`) and default data accessor (`row[key]`) */
  key: string
  /** Display label for the column header */
  label: string
  /** Whether clicking this column header triggers sorting. Default: false */
  sortable?: boolean
  /** Sort key sent to the API (may differ from `key`). Falls back to `key` if omitted. */
  sortKey?: string
  /** CSS class applied to both <th> and <td> */
  class?: string
  /** CSS class applied only to <th> */
  headerClass?: string
  /** Width hint (e.g. 'w-24', 'min-w-[10rem]') */
  width?: string
  /** Inline min-width style (e.g. '120px', '8rem'). Only effective with fixedLayout. */
  minWidth?: string
  /** Text alignment: 'left' (default), 'center', 'right' */
  align?: 'left' | 'center' | 'right'
  /** Hide on mobile (adds 'hidden sm:table-cell') */
  hiddenMobile?: boolean
  /** Whether this column has a filter input under the header */
  filterable?: boolean
  /** Placeholder for the filter input */
  filterPlaceholder?: string
}

export type DataTableColumnFilters = Record<string, string>

export interface DataTableSort {
  field: string
  direction: SortDirection
}

export interface DataTablePagination {
  currentPage: number
  totalPages: number
  /** Total items matching current filters */
  totalItems: number
  /** Items displayed on current page */
  pageItems: number
  /** Available per-page options. If omitted, per-page selector is hidden. */
  perPageOptions?: number[]
  /** Currently selected items per page */
  perPage?: number
}
