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

const AwardsView = () => (
  <EntityRecordViewPage
    singularLabel="Award"
    pluralLabel="Awards"
    stateKey="awards"
    recordKey="awards"
    fetchRecord={fetch}
    listHref="/awards/awards-list"
    editHref={(id) => `/awards/awards-edit/?id=${id ?? ''}`}
  />
);

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

export default AwardsView;
