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

const FiscalYearsView = () => (
  <EntityRecordViewPage
    singularLabel="Fiscal Year"
    pluralLabel="Fiscal Years"
    stateKey="fiscal_years"
    recordKey="fiscal_years"
    fetchRecord={fetch}
    listHref="/fiscal_years/fiscal_years-list"
    editHref={(id) => `/fiscal_years/fiscal_years-edit/?id=${id ?? ''}`}
  />
);

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

export default FiscalYearsView;
