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

const BidsView = () => (
  <EntityRecordViewPage
    singularLabel="Bid"
    pluralLabel="Bids"
    stateKey="bids"
    recordKey="bids"
    fetchRecord={fetch}
    listHref="/bids/bids-list"
    editHref={(id) => `/bids/bids-edit/?id=${id ?? ''}`}
  />
);

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

export default BidsView;
