import { ReportBI } from '@wix/bex-core';
import {
  wixPatternsDeleteModalShownSrc144Evid10,
  wixPatternsDeleteModalCtaClickedSrc144Evid11,
} from '@wix/bex-utils/@wix/bi-logger-os-data/v2';

export interface ConfirmModalBIReporterParams {
  readonly reportBi: ReportBI;
  readonly itemId: string;
  readonly itemIndex: number;
}

export class ConfirmModalBIReporter {
  readonly reportBi;
  readonly itemId;
  readonly itemIndex;

  constructor(params: ConfirmModalBIReporterParams) {
    this.reportBi = params.reportBi;
    this.itemId = params.itemId;
    this.itemIndex = params.itemIndex;
  }

  private get biParams() {
    return {
      isSelectAll: false,
      location: 'actionCell' as const,
      numItems: 1,
      itemId: this.itemId,
      itemIndex: this.itemIndex,
    };
  }

  reportDeleteModalShown() {
    this.reportBi(wixPatternsDeleteModalShownSrc144Evid10(this.biParams));
  }

  reportDeleteModalCtaClicked(ctaName: string) {
    this.reportBi(
      wixPatternsDeleteModalCtaClickedSrc144Evid11({
        ...this.biParams,
        ctaName,
      }),
    );
  }
}
