"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useConfigPermissions = void 0;
var react_1 = require("react");
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var MdmModuleContext_1 = require("../../contexts/MdmModuleContext");
var emptyArray = [];
var useConfigPermissions = function () {
    var userRoles = (0, MdmModuleContext_1.useMdmUserRoles)() || emptyArray;
    return {
        canCreate: (0, react_1.useCallback)((0, mdm_sdk_1.checkConfigPermission)(mdm_sdk_1.ConfigPermissions.CREATE, userRoles), [userRoles]),
        canRead: (0, react_1.useCallback)((0, mdm_sdk_1.checkConfigPermission)(mdm_sdk_1.ConfigPermissions.READ, userRoles), [userRoles]),
        canUpdate: (0, react_1.useCallback)((0, mdm_sdk_1.checkConfigPermission)(mdm_sdk_1.ConfigPermissions.UPDATE, userRoles), [userRoles]),
        canDelete: (0, react_1.useCallback)((0, mdm_sdk_1.checkConfigPermission)(mdm_sdk_1.ConfigPermissions.DELETE, userRoles), [userRoles])
    };
};
exports.useConfigPermissions = useConfigPermissions;
