"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.FieldOperationsBIReporter = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _util = require("../util");
var _v = require("@wix/bex-utils/@wix/bi-logger-os-data/v2");
var _formatPermissionsForBi = require("./formatPermissionsForBi");
class FieldOperationsBIReporter {
  constructor(params) {
    (0, _defineProperty2.default)(this, "reportBi", void 0);
    (0, _defineProperty2.default)(this, "reportArchiveFieldModalCtaClicked", ctaName => {
      this.reportBi((0, _util.withoutDefaults)(_v.cairoModalCtaClicked)({
        ctaName,
        modalName: 'Archive custom field'
      }));
    });
    (0, _defineProperty2.default)(this, "reportDeleteFieldModalCtaClicked", ctaName => {
      this.reportBi((0, _util.withoutDefaults)(_v.cairoModalCtaClicked)({
        ctaName,
        modalName: 'Delete custom field'
      }));
    });
    (0, _defineProperty2.default)(this, "reportArchiveFieldFailed", ({
      origin,
      formValues
    }) => {
      if (!formValues) {
        return;
      }
      this.reportBi((0, _util.withoutDefaults)(_v.cairoDataExtensionUnsuccessfulUpdateInServer)({
        actionName: 'Archive',
        errorType: 'Technical issue',
        origin,
        permissions: (0, _formatPermissionsForBi.formatPermissionsForBi)(formValues),
        fieldType: formValues.type,
        fieldName: formValues.name,
        key: formValues.key
      }));
    });
    (0, _defineProperty2.default)(this, "reportArchiveTryAgain", () => {
      this.reportBi((0, _util.withoutDefaults)(_v.cairoTryAgainClicked)({
        actionName: 'Archive custom field',
        loaction: 'toast'
      }));
    });
    (0, _defineProperty2.default)(this, "reportRestoreFieldFailed", ({
      origin,
      formValues
    }) => {
      if (!formValues) {
        return;
      }
      this.reportBi((0, _util.withoutDefaults)(_v.cairoDataExtensionUnsuccessfulUpdateInServer)({
        actionName: 'Restore',
        errorType: 'Technical issue',
        origin,
        permissions: (0, _formatPermissionsForBi.formatPermissionsForBi)(formValues),
        fieldType: formValues.type,
        fieldName: formValues.name,
        key: formValues.key
      }));
    });
    (0, _defineProperty2.default)(this, "reportRestoreTryAgain", () => {
      this.reportBi((0, _util.withoutDefaults)(_v.cairoTryAgainClicked)({
        actionName: 'Restore custom field',
        loaction: 'toast'
      }));
    });
    const {
      reportBi
    } = params;
    this.reportBi = reportBi;
  }
}
exports.FieldOperationsBIReporter = FieldOperationsBIReporter;
//# sourceMappingURL=FieldOperationsBIReporter.js.map