import { CHECKBOXES_COLUMN, ROW_ACTIONS_COLUMN, EXPAND_TOGGLE_COLUMN } from '../types';
export function decoratePinnedColumns(data) {
  // we need to filter reserved columns not to duplicate them below
  const pinnedWithoutReservedColumns = data?.left?.filter(column => ![EXPAND_TOGGLE_COLUMN.ID, CHECKBOXES_COLUMN.ID].includes(column)) ?? [];

  // we need to always add checkboxes and expand row toggle cell to the left pinned and row actions to the right
  // we do not care if either of them is actually enabled in the table, cause if they are not - they just won't be rendered
  return {
    left: [EXPAND_TOGGLE_COLUMN.ID, CHECKBOXES_COLUMN.ID, ...pinnedWithoutReservedColumns],
    right: [ROW_ACTIONS_COLUMN.ID]
  };
}