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);
};
import React from 'react';
import i18n from 'ui-i18n';
import { canUserMakeActivitiesExport } from '@reltio/mdm-sdk';
import Tooltip from '@mui/material/Tooltip';
import Typography from '@mui/material/Typography';
import { ActivityExportButton } from '../ActivityExportButton';
import { ActivityFilterButton } from '../ActivityFilterButton';
import { useMdmTenant, useMdmUser } from '../../../contexts/MdmModuleContext';
import { getFilterLabel } from './helpers';
import { useStyles } from './styles';
export 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 = useStyles();
    var user = useMdmUser();
    var tenant = useMdmTenant();
    var canExport = canUserMakeActivitiesExport(user, tenant);
    var filterLabel = getFilterLabel(value);
    return (React.createElement("div", { className: styles.header },
        React.createElement(Typography, { variant: "body2", className: styles.label }, i18n.text('Filter:')),
        React.createElement(Tooltip, { title: filterLabel },
            React.createElement(Typography, { variant: "body2", className: styles.label, color: "textSecondary", display: "block", noWrap: true }, filterLabel)),
        React.createElement("div", { className: styles.buttonsWrapper },
            canExport && (React.createElement(ActivityExportButton, { filters: __assign(__assign({}, value), { entityUri: entityUri, segmentId: segmentId }), exportTypes: exportTypes })),
            React.createElement(ActivityFilterButton, { filter: value, entityType: entityType, onChange: onChange }))));
};
