import { FiltersMap } from '@wix/bex-core';
import { NestedTableLevelDescriptor } from './NestedTableLevelDescriptor';

export const createNestedTableLevel = <
  C extends string,
  T,
  F extends FiltersMap,
>(
  params: Omit<NestedTableLevelDescriptor<C, T, F>, 'depth'>,
) => params;

export const createNestedTableSingleEntityLevels = <
  C extends string,
  T,
  F extends FiltersMap,
>(
  levelsCount: number,
  params: Omit<NestedTableLevelDescriptor<C, T, F>, 'depth'>,
) =>
  new Array(levelsCount)
    .fill(null)
    .map(() =>
      createNestedTableLevel({ ...params, isSameEntityAsOtherLevels: true }),
    );
