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

const VendorComplianceDocumentsView = () => (
  <EntityRecordViewPage
    singularLabel="Vendor Compliance Document"
    pluralLabel="Vendor Compliance Documents"
    stateKey="vendor_compliance_documents"
    recordKey="vendor_compliance_documents"
    fetchRecord={fetch}
    listHref="/vendor_compliance_documents/vendor_compliance_documents-list"
    editHref={(id) => `/vendor_compliance_documents/vendor_compliance_documents-edit/?id=${id ?? ''}`}
  />
);

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

export default VendorComplianceDocumentsView;
