import { Table } from '@wix/design-system';
import { minimalRequiredWdsRuntimeCheck } from '../../minimalRequiredWdsRuntimeCheck';
import * as commonStyle from '../common.st.css.js';

export interface GetVirtualTableParams {
  horizontalScroll?: boolean;
}

export function getVirtualTableProps(props: GetVirtualTableParams) {
  const { horizontalScroll } = props;

  if (process.env.NODE_ENV !== 'production') {
    // need this version because of style fixes on the WSR side
    minimalRequiredWdsRuntimeCheck({
      required: '^1.114.0',
      requiredBy: 'WixPatterns/TableVirtual',
    });
  }

  const { st, classes } =
    Table.dataTableRowVirtualStyle as import('@stylable/runtime').RuntimeStylesheet;

  return {
    useNewInfiniteScrollLoader: true,
    rowClass: st(classes.root, { horizontalScroll }),
    headerClass: commonStyle.st(commonStyle.classes.column),
    headerRowClass: st(classes.root, { horizontalScroll }),
  };
}
