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

const TendersView = () => (
  <EntityRecordViewPage
    singularLabel="Tender"
    pluralLabel="Tenders"
    stateKey="tenders"
    recordKey="tenders"
    fetchRecord={fetch}
    listHref="/tenders/tenders-list"
    editHref={(id) => `/tenders/tenders-edit/?id=${id ?? ''}`}
  />
);

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

export default TendersView;
