"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 classnames_1 = tslib_1.__importDefault(require("classnames"));
const Widget_1 = tslib_1.__importDefault(require("../../components/Widget"));
const system_1 = require("@mui/system");
const NewChip_1 = tslib_1.__importDefault(require("../NewChip/NewChip"));
const notification_1 = require("../../types/notification");
const PREFIX = 'SCNotificationItem';
const classes = {
    root: `${PREFIX}-root`,
    header: `${PREFIX}-header`,
    image: `${PREFIX}-image`,
    snippetImage: `${PREFIX}-snippet-image`,
    title: `${PREFIX}-title`,
    primary: `${PREFIX}-primary`,
    secondary: `${PREFIX}-secondary`,
    actions: `${PREFIX}-actions`,
    footer: `${PREFIX}-footer`,
    snippet: `${PREFIX}-snippet`,
    new: `${PREFIX}-new`,
    newChip: `${PREFIX}-new-chip`
};
const Root = (0, styles_1.styled)(Widget_1.default, {
    name: PREFIX,
    slot: 'Root',
    overridesResolver: (props, styles) => styles.root
})(({ theme }) => ({}));
/**
 * > API documentation for the Community-JS BaseItem component. Learn about the available props and the CSS API.

 #### Import

 ```jsx
 import {NotificationItem} from '@selfcommunity/react-ui';
 ```

 #### Component Name

 The name `NotificationItem` can be used when providing style overrides in the theme.


 #### CSS

 |Rule Name|Global class|Description|
 |---|---|---|
 |root|.SCBaseItem-root|Styles applied to the root element.|
 |new|.SCBaseItem-new-snippet|Styles applied to the root element when notification is marked as new.|
 |content|.SCBaseItem-content|Styles applied to the content element.|
 |header|.SCBaseItem-header|Styles applied to the header element.|
 |image|.SCBaseItem-image|Styles applied to image section.|
 |snippetImage|.SCBaseItem-snippet-image|Styles applied to image section when a snippet notification is rendered.|
 |title|.SCBaseItem-text|Styles applied to title section.|
 |primary|.SCBaseItem-primary|Styles applied to primary section.|
 |secondary|.SCBaseItem-secondary|Styles applied to secondary section.|
 |actions|.SCBaseItem-actions|Styles applied to actions section.|
 |footer|.SCBaseItem-footer|Styles applied to footer section.|
 |newChip|.SCBaseItem-new-chip|Styles applied to the new chip element when notification is marked as new.|

 * @param inProps
 */
function NotificationItem(inProps) {
    // PROPS
    const props = (0, system_1.useThemeProps)({
        props: inProps,
        name: PREFIX
    });
    const { id = null, className = null, image = null, disableTypography = false, primary = null, primaryTypographyProps = { component: 'span', variant: 'body1' }, secondary = null, secondaryTypographyProps = { component: 'p', variant: 'body2' }, actions = null, footer = null, template = notification_1.SCNotificationObjectTemplateType.DETAIL, isNew = false, elevation = 0 } = props, rest = tslib_1.__rest(props, ["id", "className", "image", "disableTypography", "primary", "primaryTypographyProps", "secondary", "secondaryTypographyProps", "actions", "footer", "template", "isNew", "elevation"]);
    // RENDER
    return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id }, rest, { className: (0, classnames_1.default)(classes.root, className, `${PREFIX}-${template}`, {
            [classes.new]: isNew
        }), elevation: elevation }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.header }, { children: [image && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: (0, classnames_1.default)(classes.image) }, { children: image })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.title }, { children: [primary && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.primary }, { children: [template === notification_1.SCNotificationObjectTemplateType.DETAIL && isNew && (0, jsx_runtime_1.jsx)(NewChip_1.default, { className: classes.newChip }), disableTypography ? primary : (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({}, primaryTypographyProps, { children: primary }))] }))), secondary && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.secondary }, { children: disableTypography ? secondary : (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({}, secondaryTypographyProps, { children: secondary })) })))] }))] })), actions && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: actions })), footer && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.footer }, { children: footer }))] })));
}
exports.default = NotificationItem;
