"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GalleryView = void 0;
var react_1 = __importDefault(require("react"));
var Box_1 = __importDefault(require("@mui/material/Box"));
var Grid_1 = __importDefault(require("@mui/material/Grid"));
var Image_1 = require("../../../Image");
var ImageActionsOverlay_1 = require("../../../ImageActionsOverlay");
var styles_1 = require("./styles");
var GalleryView = function (_a) {
    var items = _a.items, selectedItems = _a.selectedItems, onSelectImage = _a.onSelectImage, onDeselectImage = _a.onDeselectImage, onShareLink = _a.onShareLink, onSetAsDefault = _a.onSetAsDefault, onDownload = _a.onDownload, onClickImage = _a.onClickImage, onDelete = _a.onDelete;
    var styles = (0, styles_1.useStyles)();
    var renderImageActionsOverlay = function (id) {
        return (react_1.default.createElement(ImageActionsOverlay_1.ImageActionsOverlay, { id: id, selected: selectedItems.includes(id), selectionMode: selectedItems.length !== 0, onSelect: function () { return onSelectImage(id); }, onDeselect: function () { return onDeselectImage(id); }, onShareLink: function () { return onShareLink(id); }, onSetAsDefault: function () { return onSetAsDefault(id); }, onDownload: function () { return onDownload(id); }, onClick: function () { return onClickImage(id); }, onDelete: onDelete ? function () { return onDelete(id); } : undefined, canBeSelected: true }));
    };
    return (react_1.default.createElement(Box_1.default, { className: styles.root },
        react_1.default.createElement(Grid_1.default, { container: true }, items.map(function (_a) {
            var id = _a.id, src = _a.src;
            return (react_1.default.createElement(Grid_1.default, { key: id, classes: { item: styles.item }, item: true },
                react_1.default.createElement(Image_1.Image, { size: Image_1.ImageSizesStyles.LARGE, onClick: function () { return onClickImage(id); }, src: src, overlay: renderImageActionsOverlay(id) })));
        }))));
};
exports.GalleryView = GalleryView;
