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

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

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

export default RolesView;
