"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActivityLogFilter = void 0;
var react_1 = __importDefault(require("react"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var Tooltip_1 = __importDefault(require("@mui/material/Tooltip"));
var Typography_1 = __importDefault(require("@mui/material/Typography"));
var ActivityExportButton_1 = require("../ActivityExportButton");
var ActivityFilterButton_1 = require("../ActivityFilterButton");
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
var helpers_1 = require("./helpers");
var styles_1 = require("./styles");
var ActivityLogFilter = function (_a) {
    var value = _a.value, entityType = _a.entityType, entityUri = _a.entityUri, onChange = _a.onChange, exportTypes = _a.exportTypes, segmentId = _a.segmentId;
    var styles = (0, styles_1.useStyles)();
    var user = (0, MdmModuleContext_1.useMdmUser)();
    var tenant = (0, MdmModuleContext_1.useMdmTenant)();
    var canExport = (0, mdm_sdk_1.canUserMakeActivitiesExport)(user, tenant);
    var filterLabel = (0, helpers_1.getFilterLabel)(value);
    return (react_1.default.createElement("div", { className: styles.header },
        react_1.default.createElement(Typography_1.default, { variant: "body2", className: styles.label }, ui_i18n_1.default.text('Filter:')),
        react_1.default.createElement(Tooltip_1.default, { title: filterLabel },
            react_1.default.createElement(Typography_1.default, { variant: "body2", className: styles.label, color: "textSecondary", display: "block", noWrap: true }, filterLabel)),
        react_1.default.createElement("div", { className: styles.buttonsWrapper },
            canExport && (react_1.default.createElement(ActivityExportButton_1.ActivityExportButton, { filters: __assign(__assign({}, value), { entityUri: entityUri, segmentId: segmentId }), exportTypes: exportTypes })),
            react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, { filter: value, entityType: entityType, onChange: onChange }))));
};
exports.ActivityLogFilter = ActivityLogFilter;
