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

const BudgetLinesView = () => (
  <EntityRecordViewPage
    singularLabel="Budget Line"
    pluralLabel="Budget Lines"
    stateKey="budget_lines"
    recordKey="budget_lines"
    fetchRecord={fetch}
    listHref="/budget_lines/budget_lines-list"
    editHref={(id) => `/budget_lines/budget_lines-edit/?id=${id ?? ''}`}
  />
);

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

export default BudgetLinesView;
