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

const BudgetProgramsView = () => (
  <EntityRecordViewPage
    singularLabel="Budget Program"
    pluralLabel="Budget Programs"
    stateKey="budget_programs"
    recordKey="budget_programs"
    fetchRecord={fetch}
    listHref="/budget_programs/budget_programs-list"
    editHref={(id) => `/budget_programs/budget_programs-edit/?id=${id ?? ''}`}
  />
);

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

export default BudgetProgramsView;
