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

const RolePermissionsView = () => (
  <EntityRecordViewPage
    singularLabel="Role Permission"
    pluralLabel="Role Permissions"
    stateKey="role_permissions"
    recordKey="role_permissions"
    fetchRecord={fetch}
    listHref="/role_permissions/role_permissions-list"
    editHref={(id) => `/role_permissions/role_permissions-edit/?id=${id ?? ''}`}
  />
);

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

export default RolePermissionsView;
