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

const AuditLogsView = () => (
  <EntityRecordViewPage
    singularLabel="Audit Log"
    pluralLabel="Audit Logs"
    stateKey="audit_logs"
    recordKey="audit_logs"
    fetchRecord={fetch}
    listHref="/audit_logs/audit_logs-list"
    editHref={(id) => `/audit_logs/audit_logs-edit/?id=${id ?? ''}`}
  />
);

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

export default AuditLogsView;
