import { withoutIrrelevant } from '@wix/bex-core';
import { cairoNestedTableCollapseAndExpand } from '@wix/bex-core/bi';
const withoutDefaults = withoutIrrelevant();
export class NestedTableNodeStateBIReporter {
    constructor(state) {
        this.reportExpandCollapse = () => {
            const { state } = this;
            const { parent, parentNode, node: { _expanded }, } = state;
            const { nestedTable: { bi, toolbar }, } = state;
            if (parent == null || parentNode == null) {
                return;
            }
            bi.reportBi(withoutDefaults(cairoNestedTableCollapseAndExpand)({
                ...toolbar._commonDynamicBiParams(),
                clickType: _expanded ? 'Expand' : 'Collapse',
                itemId: parent.id,
                itemIndex: state._rowNum,
                currentLevel: parentNode.childrenDepth,
                numLevels: state.nestedTable.levels.length,
            }));
        };
        this.state = state;
    }
}
//# sourceMappingURL=NestedTableNodeStateBIReporter.js.map