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

const ProcurementPlansView = () => (
  <EntityRecordViewPage
    singularLabel="Procurement Plan"
    pluralLabel="Procurement Plans"
    stateKey="procurement_plans"
    recordKey="procurement_plans"
    fetchRecord={fetch}
    listHref="/procurement_plans/procurement_plans-list"
    editHref={(id) => `/procurement_plans/procurement_plans-edit/?id=${id ?? ''}`}
  />
);

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

export default ProcurementPlansView;
