import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { CrossOutlineMd } from '../../../icons/CrossOutlineMd';
import { Loader } from '../../Loader';
import { notifyClassnames } from '../constants';
import { ErrorNotificationIcon, InfoNotificationIcon, SuccessNotificationIcon, WarningNotificationIcon, } from '../styles';
import { CloseButton, Content, Footer, Header, IconWrapper, Title, Wrapper, } from './styles';
const mapOfNotificationIcons = {
    info: InfoNotificationIcon,
    success: SuccessNotificationIcon,
    warning: WarningNotificationIcon,
    error: ErrorNotificationIcon,
    progress: InfoNotificationIcon,
};
const DefaultIcon = ({ variant }) => {
    if (Object.is(variant, 'progress')) {
        return _jsx(Loader, {});
    }
    const Icon = mapOfNotificationIcons[variant];
    return _jsx(Icon, {});
};
export const NotificationTemplate = ({ icon, title, closeToast, content, actions, variant, actionsDirection = 'right', showCloseButton = true, }) => {
    const handleCloseToast = () => closeToast?.();
    return (_jsxs(Wrapper, { variant: variant, children: [_jsxs(Header, { children: [_jsx(IconWrapper, { children: icon || _jsx(DefaultIcon, { variant: variant }) }), _jsx(Title, { variant: "h5", children: title }), showCloseButton && (_jsx(CloseButton, { "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u0435", color: "grey", variant: "text", onClick: handleCloseToast, children: _jsx(CrossOutlineMd, {}) }))] }), content && (_jsx(Content, { variant: "body1", className: `${notifyClassnames.root}__content`, children: content })), actions && (_jsx(Footer, { actionsDirection: actionsDirection, className: `${notifyClassnames.root}__footer`, children: actions }))] }));
};
