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

const ContractAmendmentsView = () => (
  <EntityRecordViewPage
    singularLabel="Contract Amendment"
    pluralLabel="Contract Amendments"
    stateKey="contract_amendments"
    recordKey="contract_amendments"
    fetchRecord={fetch}
    listHref="/contract_amendments/contract_amendments-list"
    editHref={(id) => `/contract_amendments/contract_amendments-edit/?id=${id ?? ''}`}
  />
);

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

export default ContractAmendmentsView;
