import React, { memo, useMemo } from 'react';
import classnames from 'classnames';
import { CollaborationObjectTypes, createRelatedObjectUris, getEntityUriForLink, getProfileBandObjectIdsForCollaboration } from '@reltio/mdm-sdk';
import { ProfileBand } from '../ProfileBand';
import { ProfileBandNavigation } from '../ProfileBandNavigation';
import { CommentsContainer } from '../CommentsContainer';
import { CollaborationContextProvider } from '../contexts/CollaborationContext';
import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../constants';
import { useCollaboration } from '../hooks/useCollaboration';
import { ProfileBandHistory } from '../features/history';
import { useStyles } from './styles';
export var ScreenProfileBand = memo(function (_a) {
    var entity = _a.entity, className = _a.className, historySlice = _a.historySlice;
    var styles = useStyles();
    var objectIds = useMemo(function () { return getProfileBandObjectIdsForCollaboration(entity); }, [entity]);
    var collaboration = useCollaboration({ objectIds: objectIds });
    var entityUri = getEntityUriForLink(entity);
    return (React.createElement(CollaborationContextProvider, { collaboration: collaboration },
        React.createElement(ProfileBand, { className: classnames(className, COMMENTS_CONTAINER_VISIBILITY_AREA), entity: (historySlice === null || historySlice === void 0 ? void 0 : historySlice.aEntity) || entity }, historySlice ? (React.createElement(ProfileBandHistory, null)) : (React.createElement(React.Fragment, null,
            React.createElement(ProfileBandNavigation, { className: styles.profileBandNavigation }),
            React.createElement(CommentsContainer, { className: styles.comments, uri: entityUri, relatedObjectUris: createRelatedObjectUris(CollaborationObjectTypes.ENTITY, {
                    entityUri: entityUri
                }), objectType: CollaborationObjectTypes.ENTITY }))))));
});
ScreenProfileBand.displayName = 'ScreenProfileBand';
