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

const ContractMilestonesView = () => (
  <EntityRecordViewPage
    singularLabel="Contract Milestone"
    pluralLabel="Contract Milestones"
    stateKey="contract_milestones"
    recordKey="contract_milestones"
    fetchRecord={fetch}
    listHref="/contract_milestones/contract_milestones-list"
    editHref={(id) => `/contract_milestones/contract_milestones-edit/?id=${id ?? ''}`}
  />
);

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

export default ContractMilestonesView;
