import type { ReactNode } from "react";

export type RowDataType = Record<string, unknown> & { id: string | number };

export type ColumnType<T extends RowDataType = RowDataType> = {
  title: string;
  key: string;
  render?: (item: T) => ReactNode;
  width?: string | number;
  align?: "left" | "center" | "right";
  className?: string;
};

export type TableProps<T extends RowDataType = RowDataType> = {
  columns: ColumnType<T>[];
  data?: T[];
  isLoading?: boolean;
  onRowClick?: (id: T["id"], item: T) => void;
  className?: string;
  rowClassName?: string | ((item: T, index: number) => string);
  noDataMessage?: ReactNode;
  headerClassName?: string;
  emptyRowsCount?: number;
  showHeader?: boolean;
  actions?: ReactNode;
  actionsPosition?: "top" | "header-replace" | "above-header";
};
