import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import './SessionDropdown.scss';
import Icon from '../Icon';
import Tabs from '../Tabs';
import Typography from '../Typography';
import Tooltip from '../Tooltip';
const SessionDropdown = ({ header, secondaryHeader, primaryCount, secondaryCount, primaryItems, secondaryItems, width, activeTab = 'primary', activeTabId, onPrimaryTabClick, onSecondaryTabClick, onTabClick, actions, tabsData, notchPosition = 'top-left', }) => {
    const itemsToDisplay = secondaryHeader && activeTab === 'secondary'
        ? secondaryItems
        : primaryItems;
    const hasSecondaryItems = secondaryCount && parseInt(secondaryCount) > 0;
    const hasPrimaryItems = primaryCount && parseInt(primaryCount) > 0;
    const showActionIcons = secondaryHeader && (hasPrimaryItems || hasSecondaryItems);
    const handleTabClick = (tabId) => {
        if (onTabClick) {
            onTabClick(tabId);
        }
        if (tabId === 'tab-1' && onPrimaryTabClick) {
            onPrimaryTabClick();
        }
        else if (tabId === 'tab-2' && onSecondaryTabClick) {
            onSecondaryTabClick();
        }
    };
    const { tooltip: downloadTooltip = 'Download', iconName: downloadIconName = 'download_file', disabled: isDownloadDisabled = false, onClick: onDownloadClick, className: downloadClassName = '', } = actions?.download || {};
    const { tooltip: deleteTooltip = 'Delete', iconName: deleteIconName = 'delete_icon', disabled: isDeleteDisabled = false, onClick: onDeleteClick, className: deleteClassName = '', } = actions?.delete || {};
    const renderHeaderIcons = () => (_jsxs("div", { className: "ff-dropdown-header-icons", children: [actions?.download && (_jsx(Tooltip, { title: downloadTooltip, children: _jsx(Icon, { name: downloadIconName || '', className: `ff-dropdown-icon ff-download-icon ${downloadClassName}`, onClick: onDownloadClick, width: 18, height: 20, disabled: isDownloadDisabled, hoverEffect: true }) })), actions?.delete && (_jsx(Tooltip, { title: deleteTooltip, children: _jsx(Icon, { name: deleteIconName || '', className: `ff-dropdown-icon ff-delete-icon ${deleteClassName}`, onClick: onDeleteClick, width: 25, height: 25, disabled: isDeleteDisabled, hoverEffect: true }) }))] }));
    return (_jsxs("div", { className: "ff-resolution-dropdown", style: width ? { minWidth: width } : {}, children: [_jsx("div", { className: `ff-dropdown-notch ${notchPosition === 'bottom-center' ? 'bottom-center' : 'top-left'}` }), _jsx("div", { className: "ff-dropdown-header", children: _jsx("div", { className: "ff-dropdown-header-content", children: secondaryHeader && tabsData && activeTabId ? (_jsxs(_Fragment, { children: [_jsx(Tabs, { tabsData: tabsData, activeTabId: activeTabId, onTabClick: handleTabClick }), showActionIcons && renderHeaderIcons()] })) : secondaryHeader && showActionIcons ? (_jsxs("div", { className: "ff-dropdown-header-dual", children: [_jsxs("div", { className: `ff-dropdown-header-item ${activeTab === 'primary' ? 'active' : ''}`, onClick: onPrimaryTabClick, children: [_jsx(Typography, { fontWeight: "semi-bold", className: "ff-dropdown-text", children: header }), primaryCount && (_jsx("span", { className: "ff-dropdown-count", children: primaryCount }))] }), _jsxs("div", { className: `ff-dropdown-header-item ${activeTab === 'secondary' ? 'active' : ''}`, onClick: onSecondaryTabClick, children: [_jsx(Typography, { fontWeight: "semi-bold", className: "ff-dropdown-text", children: secondaryHeader }), secondaryCount && (_jsx("span", { className: "ff-dropdown-count", children: secondaryCount }))] }), renderHeaderIcons()] })) : secondaryHeader ? (_jsxs("div", { className: "ff-dropdown-header-dual", children: [_jsxs("div", { className: `ff-dropdown-header-item ${activeTab === 'primary' ? 'active' : ''}`, onClick: onPrimaryTabClick, children: [_jsx(Typography, { fontWeight: "semi-bold", className: "ff-dropdown-text", children: header }), primaryCount && (_jsx("span", { className: "ff-dropdown-count", children: primaryCount }))] }), _jsxs("div", { className: `ff-dropdown-header-item ${activeTab === 'secondary' ? 'active' : ''}`, onClick: onSecondaryTabClick, children: [_jsx(Typography, { fontWeight: "semi-bold", className: "ff-dropdown-text", children: secondaryHeader }), secondaryCount && (_jsx("span", { className: "ff-dropdown-count", children: secondaryCount }))] })] })) : (_jsx(Typography, { fontSize: 16, fontWeight: "semi-bold", children: header })) }) }), _jsx("ul", { className: "ff-dropdown-list", children: itemsToDisplay?.map((item, index) => (_jsx("li", { className: "ff-dropdown-item", children: item }, index))) })] }));
};
export default SessionDropdown;
//# sourceMappingURL=SessionDropdown.js.map