import { SortOrder, TableSelectionType } from './constants';

/** Column visibility data for {@link Table} */
export type TableColumnVisibility<C extends string> = {
  /** Column name */
  column: C;
  /** Column visibility */
  visible: boolean;
};

/**
 * Selection data that used by {@link Table}.
 *
 * Use {@link selectedRowsCount} to determinate how many rows should be selected by this selection.
 */
export type TableSelection =
  | {
      /** Selection mode type */
      type: TableSelectionType.Include;
      /** Only rows with given IDs will be selected */
      selectedIds: string[];
    }
  | {
      /** Selection mode type */
      type: TableSelectionType.Exclude;
      /** All rows will be selected expect rows with given IDs */
      unselectedIds: string[];
    };

/** Sort data for {@link Table} */
export interface TableSort<C extends string> {
  /** Column that must be used for sort */
  column: C;
  /** Order of sort */
  order: SortOrder;
}
