import React, { useMemo } from 'react';
import { AmbientList } from '../../../../UI';
import { PDFIcon, WordDocumentIcon, FileImageIcon } from '@fluentui/react-icons';
const AttachmentTransactionAttachmentList = (props) => {
    const { attachments, setSelectedAttachment } = props;
    const formattedAttachments = useMemo(() => {
        return attachments.map((attachment) => ({
            attachmentName: attachment.fileName,
            extension: attachment.extension,
            transactionAttachmentId: attachment.transactionAttachmentId
        }));
    }, [attachments]);
    const getFileIcon = (item) => {
        if (item.attachmentName.includes('.pdf')) {
            return PDFIcon;
        }
        else if (item.attachmentName.includes('.docx')) {
            return WordDocumentIcon;
        }
        else if (item.attachmentName.includes('.')) {
            return FileImageIcon;
        }
    };
    return (React.createElement(React.Fragment, null, React.createElement(AmbientList, { data: formattedAttachments, useAvatar: false, fieldConfig: {
            primaryText: 'attachmentName',
            secondaryText: 'description'
        }, onItemClick: (item) => {
            setSelectedAttachment(item);
        }, getItemIcon: (item) => {
            return getFileIcon(item);
        }, listHeight: 'calc(100vh - 105px)', maxHeight: 'calc(100vh - 105px)' })));
};
export default AttachmentTransactionAttachmentList;
//# sourceMappingURL=AttachmentTransactionAttachmentList.js.map