import React from 'react';
import { useWorkflowDefinitions } from '../../features/workflow/hooks/useWorkflowDefinitions';
import { useWorkflowCheckPermission } from '../../features/workflow/hooks/useWorkflowCheckPermission';
import { useMdmIsWorkflowEnabled } from '../MdmModuleContext';
export var WorkflowDefinitionsContext = React.createContext({
    definitions: [],
    loading: false
});
WorkflowDefinitionsContext.displayName = 'WorkflowDefinitionsContext';
export var WorkflowDefinitionsProvider = function (_a) {
    var children = _a.children;
    var isWorkflowEnabled = useMdmIsWorkflowEnabled();
    var checkWorkflowPermission = useWorkflowCheckPermission();
    var canViewProcessDefinitions = checkWorkflowPermission('VIEW_PROCESS_DEFINITIONS');
    var canViewDefinitions = isWorkflowEnabled && canViewProcessDefinitions;
    var workflowDefinitions = useWorkflowDefinitions({ all: true, canViewDefinitions: canViewDefinitions });
    return (React.createElement(WorkflowDefinitionsContext.Provider, { value: workflowDefinitions }, children));
};
