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

const PaymentsView = () => (
  <EntityRecordViewPage
    singularLabel="Payment"
    pluralLabel="Payments"
    stateKey="payments"
    recordKey="payments"
    fetchRecord={fetch}
    listHref="/payments/payments-list"
    editHref={(id) => `/payments/payments-edit/?id=${id ?? ''}`}
  />
);

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

export default PaymentsView;
