import React, { ReactElement } from 'react';
import LayoutAuthenticated from '../../layouts/Authenticated';
import { fetch } from '../../stores/notifications/notificationsSlice';
import EntityRecordViewPage from '../../components/EntityPage/EntityRecordViewPage';

const NotificationsView = () => (
  <EntityRecordViewPage
    singularLabel="Notification"
    pluralLabel="Notifications"
    stateKey="notifications"
    recordKey="notifications"
    fetchRecord={fetch}
    listHref="/notifications/notifications-list"
    editHref={(id) => `/notifications/notifications-edit/?id=${id ?? ''}`}
  />
);

NotificationsView.getLayout = function getLayout(page: ReactElement) {
  return <LayoutAuthenticated permission={'READ_NOTIFICATIONS'}>{page}</LayoutAuthenticated>;
};

export default NotificationsView;
