import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { AccessCodeKeyIcon } from '../../../../lib/icons/AccessCodeKey.js';
import { ExclamationCircleOutlineIcon } from '../../../../lib/icons/ExclamationCircleOutline.js';
import { TriangleWarningOutlineIcon } from '../../../../lib/icons/TriangleWarningOutline.js';
import { AccessCodeMenu } from '../../../../lib/seam/components/AccessCodeTable/AccessCodeMenu.js';
import { CodeDetails } from '../../../../lib/seam/components/AccessCodeTable/CodeDetails.js';
import { TableCell } from '../../../../lib/ui/Table/TableCell.js';
import { TableRow } from '../../../../lib/ui/Table/TableRow.js';
import { Title } from '../../../../lib/ui/typography/Title.js';
export function AccessCodeRow({ onClick, accessCode, onEdit, disableEditAccessCode, disableDeleteAccessCode, }) {
    const errorCount = accessCode.errors.length;
    const warningCount = accessCode.warnings.length;
    const isPlural = errorCount === 0 || errorCount > 1;
    const errorIconTitle = isPlural
        ? `${errorCount} ${t.codeIssues}`
        : `${errorCount} ${t.codeIssue}`;
    const warningIconTitle = isPlural
        ? `${warningCount} ${t.codeIssues}`
        : `${warningCount} ${t.codeIssue}`;
    return (_jsxs(TableRow, { onClick: onClick, children: [_jsx(TableCell, { className: 'seam-icon-cell', children: _jsx("div", { children: _jsx(AccessCodeKeyIcon, {}) }) }), _jsxs(TableCell, { className: 'seam-name-cell', children: [_jsx(Title, { className: 'seam-truncated-text', children: accessCode.name }), _jsx(CodeDetails, { accessCode: accessCode })] }), _jsxs(TableCell, { className: 'seam-action-cell', children: [errorCount > 0 && (_jsx("div", { className: 'seam-issue-icon-wrap', title: errorIconTitle, children: _jsx(ExclamationCircleOutlineIcon, {}) })), errorCount === 0 && warningCount > 0 && (_jsx("div", { className: 'seam-issue-icon-wrap', title: warningIconTitle, children: _jsx(TriangleWarningOutlineIcon, {}) })), _jsx(AccessCodeMenu, { accessCode: accessCode, onEdit: onEdit, onViewDetails: onClick, disableDeleteAccessCode: disableDeleteAccessCode, disableEditAccessCode: disableEditAccessCode })] })] }));
}
const t = {
    codeIssue: 'code issue',
    codeIssues: 'code issues',
};
//# sourceMappingURL=AccessCodeRow.js.map