import { wixPatternsNestedTableCollapseAndExpandAllSrc144Evid178 } from '@wix/bex-core/bi';
import { NestedTableNestedModeState } from './NestedTableNestedModeState';

export class NestedTableNestedModeStateBIReporter<C extends string> {
  readonly state;

  constructor(state: NestedTableNestedModeState<C>) {
    this.state = state;
  }

  get reportBi() {
    return this.state.wrapper.reportBi;
  }

  reportExpandCollapseAll = () => {
    const { state } = this;

    this.reportBi(
      wixPatternsNestedTableCollapseAndExpandAllSrc144Evid178({
        ...state.toolbar._commonDynamicBiParams(),
        clickType: state.isAllCollapsed ? 'Expand' : 'Collapse',
        numLevels: state.levels.length,
      }),
    );
  };
}
