"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const styles_1 = require("@mui/material/styles");
const material_1 = require("@mui/material");
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
const types_1 = require("@selfcommunity/types");
const react_intl_1 = require("react-intl");
const DateTimeAgo_1 = tslib_1.__importDefault(require("../../../shared/DateTimeAgo"));
const classnames_1 = tslib_1.__importDefault(require("classnames"));
const types_2 = require("../../../types");
const NotificationItem_1 = tslib_1.__importDefault(require("../../../shared/NotificationItem"));
const constants_1 = require("../constants");
const messages = (0, react_intl_1.defineMessages)({
    accountBlocked: {
        id: 'ui.notification.userBlocked.accountBlocked',
        defaultMessage: 'ui.notification.userBlocked.accountBlocked'
    },
    accountReactivated: {
        id: 'ui.notification.userBlocked.accountReactivated',
        defaultMessage: 'ui.notification.userBlocked.accountReactivated'
    }
});
const classes = {
    root: `${constants_1.PREFIX}-user-blocked-root`,
    unBlockedIcon: `${constants_1.PREFIX}-unblocked-icon`,
    blockedIcon: `${constants_1.PREFIX}-blocked-icon`,
    blockedText: `${constants_1.PREFIX}-blocked-text`,
    activeAt: `${constants_1.PREFIX}-active-at`
};
const Root = (0, styles_1.styled)(NotificationItem_1.default, {
    name: constants_1.PREFIX,
    slot: 'UserBlockedRoot'
})(() => ({}));
/**
 * This component render the content of the notification of type user blocked
 * @constructor
 * @param props
 */
function UserBlockedNotification(props) {
    // PROPS
    const { notificationObject = null, id = `n_${props.notificationObject['sid']}`, template = types_2.SCNotificationObjectTemplateType.DETAIL, className } = props, rest = tslib_1.__rest(props, ["notificationObject", "id", "template", "className"]);
    // INTL
    const intl = (0, react_intl_1.useIntl)();
    /**
     * Renders root object
     */
    return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ variant: "circular", classes: {
                root: (0, classnames_1.default)(classes.unBlockedIcon, {
                    [classes.blockedIcon]: notificationObject.type === types_1.SCNotificationTypologyType.BLOCKED_USER
                })
            } }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "outlined_flag" }) })), primary: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "div", color: "inherit", className: classes.blockedText }, { children: notificationObject.type === types_1.SCNotificationTypologyType.BLOCKED_USER
                ? intl.formatMessage(messages.accountBlocked, { b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }) })
                : intl.formatMessage(messages.accountReactivated, { b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }) }) })), secondary: (template === types_2.SCNotificationObjectTemplateType.DETAIL || template === types_2.SCNotificationObjectTemplateType.SNIPPET) && ((0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.activeAt })), footer: template === types_2.SCNotificationObjectTemplateType.TOAST && ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: (0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at }) }))) }, rest)));
}
exports.default = UserBlockedNotification;
