import { useMemo } from 'react';
import { TableColumn as TableColumnWSR } from '@wix/design-system/dist/types/Table';

export interface UseActionCellColumnBaseParams<T> {
  actionCellWidth?: string | number;
  actionCellProps?: Partial<Omit<TableColumnWSR<T>, 'render' | 'style'>>;
}

export function useActionCellColumnBase<T>(
  params: UseActionCellColumnBaseParams<T>,
) {
  const { actionCellProps, actionCellWidth } = params;

  return useMemo(() => {
    return {
      title: '',
      id: 'cairo-action-cell',
      key: 'cairo-action-cell',
      width: actionCellWidth ?? '48px',
      style: { justifyContent: 'flex-end' },
      ...actionCellProps,
    };
  }, [actionCellProps, actionCellWidth]);
}
