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

const ApprovalWorkflowsView = () => (
  <EntityRecordViewPage
    singularLabel="Approval Workflow"
    pluralLabel="Approval Workflows"
    stateKey="approval_workflows"
    recordKey="approval_workflows"
    fetchRecord={fetch}
    listHref="/approval_workflows/approval_workflows-list"
    editHref={(id) => `/approval_workflows/approval_workflows-edit/?id=${id ?? ''}`}
  />
);

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

export default ApprovalWorkflowsView;
