"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useMdmSearchProviderData = exports.useMdmSearchNavigationData = exports.useMdmDataTenantsWithIdBuilder = exports.useMdmDataTenants = exports.useMdmEnvironment = exports.useMdmTenantName = exports.useMdmTenant = exports.useMdmTenantObject = exports.useMdmUserRoles = exports.useMdmUsername = exports.useMdmUser = exports.useMdmMetadata = exports.useMdmDependentLookups = exports.useMdmLookups = exports.useMdmProfileLastLoadedTime = exports.useMdmHistoryEvent = exports.useMdmHistorySlice = exports.useMdmHistoryMode = exports.useMdmHistoryDiff = exports.useMdmIsEditableMode = exports.useMdmIsViewMode = exports.useMdmMode = exports.useMdmEntityUriWithDataTenant = exports.useMdmEntityWithDiff = exports.useMdmEntityUri = exports.useMdmEntity = exports.useMdmModifiedEntities = exports.useMdmLookupAutocomplete = exports.useMdmAttributesSortingStrategy = exports.useMdmMaxValuesInResponse = exports.useMdmAttributesPresentation = exports.useMdmDateTimeMask = exports.useMdmDateMask = exports.useMdmPivotingAttributes = exports.useMdmShowEntityId = exports.useMdmImageAttributesFieldsOrder = exports.useMdmCollaborationPath = exports.useMdmImagePath = exports.useMdmApiPath = exports.useMdmReltioPath = exports.useMdmImageServicePath = exports.useMdmWorkflowPath = exports.useMdmServicesPath = exports.useMdmDtssPath = exports.useMdmUiPath = exports.useMdmAbsoluteImagePath = exports.useMdmExportPath = exports.useMdmWorkflowEnvironmentUrl = exports.useMdmUiError = exports.useMdmAutoCloseInterval = void 0;
exports.useMdmDisableTimestampLocalization = exports.useMdmCanUserMakeExport = exports.useMdmDcrReviewValidation = exports.useMdmDcrReviewAllowAddAttributes = exports.useMdmReviewDCREnabled = exports.useMdmShowMasking = exports.useMdmControlAttributes = exports.useMdmHiddenAttributes = exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmRelationsDrafts = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmIsSourcesScreenEnabled = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = exports.useMdmIsCollaborationEnabled = void 0;
var react_context_selector_1 = require("@fluentui/react-context-selector");
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var context_1 = require("./context");
var dependentLookupEditorContext_1 = require("./selectors/dependentLookupEditorContext");
var entity_1 = require("./selectors/entity");
var useMdmModuleActionsContext = function (selector) {
    return (0, react_context_selector_1.useContextSelector)(context_1.MdmModuleActionsContext, selector);
};
var useMdmModuleValuesContext = function (selector) {
    return (0, react_context_selector_1.useContextSelector)(context_1.MdmModuleValuesContext, selector);
};
var useMdmModuleListenersContext = function (selector) {
    return (0, react_context_selector_1.useContextSelector)(context_1.MdmModuleListenersContext, selector);
};
var useMdmAutoCloseInterval = function () { return useMdmModuleValuesContext(function (context) { return context.autoCloseInterval; }); };
exports.useMdmAutoCloseInterval = useMdmAutoCloseInterval;
var useMdmUiError = function () { return useMdmModuleValuesContext(function (context) { return context.uiError; }); };
exports.useMdmUiError = useMdmUiError;
var useMdmWorkflowEnvironmentUrl = function () {
    return useMdmModuleValuesContext(function (context) { return context.workflowEnvironmentUrl; });
};
exports.useMdmWorkflowEnvironmentUrl = useMdmWorkflowEnvironmentUrl;
var useMdmExportPath = function () { return useMdmModuleValuesContext(function (context) { return context.exportPath; }); };
exports.useMdmExportPath = useMdmExportPath;
var useMdmAbsoluteImagePath = function () { return useMdmModuleValuesContext(function (context) { return context.absoluteImagePath; }); };
exports.useMdmAbsoluteImagePath = useMdmAbsoluteImagePath;
var useMdmUiPath = function () { return useMdmModuleValuesContext(function (context) { return context.uiPath; }); };
exports.useMdmUiPath = useMdmUiPath;
var useMdmDtssPath = function () { return useMdmModuleValuesContext(function (context) { return context.dtssPath; }); };
exports.useMdmDtssPath = useMdmDtssPath;
var useMdmServicesPath = function () { return useMdmModuleValuesContext(function (context) { return context.servicesPath; }); };
exports.useMdmServicesPath = useMdmServicesPath;
var useMdmWorkflowPath = function () { return useMdmModuleValuesContext(function (context) { return context.workflowPath; }); };
exports.useMdmWorkflowPath = useMdmWorkflowPath;
var useMdmImageServicePath = function () { return useMdmModuleValuesContext(function (context) { return context.imageServicePath; }); };
exports.useMdmImageServicePath = useMdmImageServicePath;
var useMdmReltioPath = function () { return useMdmModuleValuesContext(function (context) { return context.reltioPath; }); };
exports.useMdmReltioPath = useMdmReltioPath;
var useMdmApiPath = function () { return useMdmModuleValuesContext(function (context) { return context.apiPath; }); };
exports.useMdmApiPath = useMdmApiPath;
var useMdmImagePath = function () { return useMdmModuleValuesContext(function (context) { return context.imagePath; }); };
exports.useMdmImagePath = useMdmImagePath;
var useMdmCollaborationPath = function () { return useMdmModuleValuesContext(function (context) { return context.collaborationPath; }); };
exports.useMdmCollaborationPath = useMdmCollaborationPath;
var useMdmImageAttributesFieldsOrder = function () {
    return useMdmModuleValuesContext(function (context) { return context.imageAttributesFieldsOrder; });
};
exports.useMdmImageAttributesFieldsOrder = useMdmImageAttributesFieldsOrder;
var useMdmShowEntityId = function () { return useMdmModuleValuesContext(function (context) { return context.showEntityId; }); };
exports.useMdmShowEntityId = useMdmShowEntityId;
var useMdmPivotingAttributes = function () { return useMdmModuleValuesContext(function (context) { return context.pivotingAttributes; }); };
exports.useMdmPivotingAttributes = useMdmPivotingAttributes;
var useMdmDateMask = function () { return useMdmModuleValuesContext(function (context) { return context.dateMask; }); };
exports.useMdmDateMask = useMdmDateMask;
var useMdmDateTimeMask = function () { return useMdmModuleValuesContext(function (context) { return context.dateTimeMask; }); };
exports.useMdmDateTimeMask = useMdmDateTimeMask;
var useMdmAttributesPresentation = function () {
    return useMdmModuleValuesContext(function (context) { return context.attributesPresentation; });
};
exports.useMdmAttributesPresentation = useMdmAttributesPresentation;
var useMdmMaxValuesInResponse = function () { return useMdmModuleValuesContext(function (context) { return context.maxValuesInResponse; }); };
exports.useMdmMaxValuesInResponse = useMdmMaxValuesInResponse;
var useMdmAttributesSortingStrategy = function () {
    return useMdmModuleValuesContext(function (context) { return context.attributesSortingStrategy; });
};
exports.useMdmAttributesSortingStrategy = useMdmAttributesSortingStrategy;
var useMdmLookupAutocomplete = function () { return useMdmModuleValuesContext(function (context) { return context.lookupAutocomplete; }); };
exports.useMdmLookupAutocomplete = useMdmLookupAutocomplete;
var useMdmModifiedEntities = function () { return useMdmModuleValuesContext(function (context) { return context.modifiedEntities; }); };
exports.useMdmModifiedEntities = useMdmModifiedEntities;
var useMdmEntity = function () { return useMdmModuleValuesContext(function (context) { return context.entity; }); };
exports.useMdmEntity = useMdmEntity;
var useMdmEntityUri = function () { return useMdmModuleValuesContext(function (context) { var _a; return (_a = context.entity) === null || _a === void 0 ? void 0 : _a.uri; }); };
exports.useMdmEntityUri = useMdmEntityUri;
var useMdmEntityWithDiff = function () { return useMdmModuleValuesContext(function (context) { return context.entityWithDiff; }); };
exports.useMdmEntityWithDiff = useMdmEntityWithDiff;
var useMdmEntityUriWithDataTenant = function () {
    return useMdmModuleValuesContext(function (context) { return context.entityUriWithDataTenant; });
};
exports.useMdmEntityUriWithDataTenant = useMdmEntityUriWithDataTenant;
var useMdmMode = function () { return useMdmModuleValuesContext(function (context) { return context.mode; }); };
exports.useMdmMode = useMdmMode;
var useMdmIsViewMode = function () { return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.isViewMode)(context.mode); }); };
exports.useMdmIsViewMode = useMdmIsViewMode;
var useMdmIsEditableMode = function () { return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.isEditableMode)(context.mode); }); };
exports.useMdmIsEditableMode = useMdmIsEditableMode;
var useMdmHistoryDiff = function () { return useMdmModuleValuesContext(function (context) { return context.historyDiff; }); };
exports.useMdmHistoryDiff = useMdmHistoryDiff;
var useMdmHistoryMode = function () { return useMdmModuleValuesContext(function (context) { return context.historyMode; }); };
exports.useMdmHistoryMode = useMdmHistoryMode;
var useMdmHistorySlice = function () { return useMdmModuleValuesContext(function (context) { return context.historySlice; }); };
exports.useMdmHistorySlice = useMdmHistorySlice;
var useMdmHistoryEvent = function () { return useMdmModuleValuesContext(function (context) { return context.historyEvent; }); };
exports.useMdmHistoryEvent = useMdmHistoryEvent;
var useMdmProfileLastLoadedTime = function () { return useMdmModuleValuesContext(function (context) { return context.profileLastLoadedTime; }); };
exports.useMdmProfileLastLoadedTime = useMdmProfileLastLoadedTime;
var useMdmLookups = function () { return useMdmModuleValuesContext(function (context) { return context.lookups; }); };
exports.useMdmLookups = useMdmLookups;
var useMdmDependentLookups = function () { return useMdmModuleValuesContext(function (context) { return context.dependentLookups; }); };
exports.useMdmDependentLookups = useMdmDependentLookups;
var useMdmMetadata = function () { return useMdmModuleValuesContext(function (context) { return context.metadata; }); };
exports.useMdmMetadata = useMdmMetadata;
var useMdmUser = function () { return useMdmModuleValuesContext(function (context) { return context.user; }); };
exports.useMdmUser = useMdmUser;
var useMdmUsername = function () { return useMdmModuleValuesContext(function (context) { var _a; return (_a = context.user) === null || _a === void 0 ? void 0 : _a.username; }); };
exports.useMdmUsername = useMdmUsername;
var useMdmUserRoles = function () { return useMdmModuleValuesContext(function (context) { var _a; return (_a = context.user) === null || _a === void 0 ? void 0 : _a.roles; }); };
exports.useMdmUserRoles = useMdmUserRoles;
var useMdmTenantObject = function () { return useMdmModuleValuesContext(function (context) { return context.tenant; }); };
exports.useMdmTenantObject = useMdmTenantObject;
var useMdmTenant = function () { return useMdmModuleValuesContext(function (context) { var _a; return (_a = context.tenant) === null || _a === void 0 ? void 0 : _a.id; }); };
exports.useMdmTenant = useMdmTenant;
var useMdmTenantName = function () { return useMdmModuleValuesContext(function (context) { var _a; return (_a = context.tenant) === null || _a === void 0 ? void 0 : _a.name; }); };
exports.useMdmTenantName = useMdmTenantName;
var useMdmEnvironment = function () { return useMdmModuleValuesContext(function (context) { return context.environment; }); };
exports.useMdmEnvironment = useMdmEnvironment;
var useMdmDataTenants = function () { return useMdmModuleValuesContext(function (context) { return context.dataTenants; }); };
exports.useMdmDataTenants = useMdmDataTenants;
var useMdmDataTenantsWithIdBuilder = function () {
    return useMdmModuleValuesContext(function (context) { return context.dataTenantsWithIdBuilder; });
};
exports.useMdmDataTenantsWithIdBuilder = useMdmDataTenantsWithIdBuilder;
var useMdmSearchNavigationData = function () { return useMdmModuleValuesContext(function (context) { return context.searchNavigationData; }); };
exports.useMdmSearchNavigationData = useMdmSearchNavigationData;
var useMdmSearchProviderData = function () { return useMdmModuleValuesContext(function (context) { return context.searchProviderData; }); };
exports.useMdmSearchProviderData = useMdmSearchProviderData;
var useMdmIsCollaborationEnabled = function () {
    return useMdmModuleValuesContext(function (context) { return context.isCollaborationEnabled; });
};
exports.useMdmIsCollaborationEnabled = useMdmIsCollaborationEnabled;
var useMdmIsWorkflowEnabled = function () { return useMdmModuleValuesContext(function (context) { return context.isWorkflowEnabled; }); };
exports.useMdmIsWorkflowEnabled = useMdmIsWorkflowEnabled;
var useMdmProfileErrors = function () { return useMdmModuleValuesContext(function (context) { return context.profileErrors; }); };
exports.useMdmProfileErrors = useMdmProfileErrors;
var useMdmIsSourcesScreenEnabled = function (entityTypeUri) {
    return useMdmModuleValuesContext(function (context) {
        return (0, mdm_sdk_1.checkProfileScreenIsEnabled)(context.uiConfigProfile, mdm_sdk_1.ScreenType.Sources, entityTypeUri);
    });
};
exports.useMdmIsSourcesScreenEnabled = useMdmIsSourcesScreenEnabled;
var useMdmModifiedEntityDefaultProfilePic = function (entityUri) {
    return useMdmModuleValuesContext(function (context) {
        return (0, entity_1.getModifiedEntityDefaultProfilePic)(context.modifiedEntities, entityUri);
    });
};
exports.useMdmModifiedEntityDefaultProfilePic = useMdmModifiedEntityDefaultProfilePic;
var useMdmModifiedEntity = function (entityUri) {
    return useMdmModuleValuesContext(function (context) { return (0, entity_1.getModifiedEntity)(context.modifiedEntities, entityUri); });
};
exports.useMdmModifiedEntity = useMdmModifiedEntity;
var useMdmInitialConnectionTempEntity = function (viewId, relationUri) {
    return useMdmModuleValuesContext(function (context) {
        return (0, mdm_sdk_1.getInitialConnectionTempEntity)(context.relations, viewId, relationUri);
    });
};
exports.useMdmInitialConnectionTempEntity = useMdmInitialConnectionTempEntity;
var useMdmInitialConnection = function (viewId, relationUri) {
    return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.getInitialConnection)(context.relations, viewId, relationUri); });
};
exports.useMdmInitialConnection = useMdmInitialConnection;
var useMdmDependentLookupEditorState = function (valueUri) {
    return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.getDependentLookupEditorState)(context.dependentLookups, valueUri); });
};
exports.useMdmDependentLookupEditorState = useMdmDependentLookupEditorState;
var useMdmActiveErrorsForAttributesPager = function (parentUri, attributeType) {
    return useMdmModuleValuesContext(function (context) {
        return (0, mdm_sdk_1.getCachedActiveErrorsForAttributesPager)(context.profileErrors, parentUri, attributeType);
    });
};
exports.useMdmActiveErrorsForAttributesPager = useMdmActiveErrorsForAttributesPager;
var useMdmDependentLookupsStructureNode = function (attributeTypeUri) {
    return useMdmModuleValuesContext(function (context) {
        return (0, mdm_sdk_1.getDependentLookupsStructureNode)(context.dependentLookups, attributeTypeUri);
    });
};
exports.useMdmDependentLookupsStructureNode = useMdmDependentLookupsStructureNode;
var useMdmAllRelationsToAddAndEdit = function (viewIds) {
    return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.getAllRelationsToAddAndEdit)(context.relations, viewIds); });
};
exports.useMdmAllRelationsToAddAndEdit = useMdmAllRelationsToAddAndEdit;
var useMdmRelationsDrafts = function (viewId) {
    return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.getDraftsByViewId)(context.relations, viewId); });
};
exports.useMdmRelationsDrafts = useMdmRelationsDrafts;
var useMdmDependentLookupEditorContext = function (attributeValue, attributeType) {
    var value = useMdmModuleValuesContext(function (context) {
        var _a, _b, _c;
        return (0, dependentLookupEditorContext_1.getDependentLookupEditorContext)({
            dependentLookups: context.dependentLookups,
            metadata: context.metadata,
            relations: context.relations,
            modifiedEntities: context.modifiedEntities,
            entityUri: (_a = context.entity) === null || _a === void 0 ? void 0 : _a.uri,
            attributeValue: attributeValue,
            attributeType: attributeType,
            hiddenAttributes: (_b = context.hiddenAttributes) === null || _b === void 0 ? void 0 : _b[(_c = context.entity) === null || _c === void 0 ? void 0 : _c.uri]
        });
    });
    return value;
};
exports.useMdmDependentLookupEditorContext = useMdmDependentLookupEditorContext;
var useMdmGlobalSearchRequestOptions = function (omittingFields) {
    return useMdmModuleValuesContext(function (context) {
        return (0, mdm_sdk_1.getGlobalSearchRequestOptions)({
            activityFilter: context.activityFilter,
            globalFilter: context.globalFilter,
            searchOptions: context.searchOptions
        }, omittingFields);
    });
};
exports.useMdmGlobalSearchRequestOptions = useMdmGlobalSearchRequestOptions;
var useMdmAuthoringItemsByEntityType = function (entityTypeUri) {
    return useMdmModuleValuesContext(function (context) {
        return (0, mdm_sdk_1.getAuthoringItemsFromLayoutByEntityType)(context.uiConfigProfile, entityTypeUri);
    });
};
exports.useMdmAuthoringItemsByEntityType = useMdmAuthoringItemsByEntityType;
var useMdmAction = function (action) {
    return useMdmModuleActionsContext(function (context) { return context[action]; });
};
exports.useMdmAction = useMdmAction;
var useMdmListener = function (listener) {
    return useMdmModuleListenersContext(function (context) { return context[listener]; });
};
exports.useMdmListener = useMdmListener;
var emptyHiddenAttributesObject = {};
var useMdmHiddenAttributes = function () {
    return useMdmModuleValuesContext(function (context) { return context.hiddenAttributes || emptyHiddenAttributesObject; });
};
exports.useMdmHiddenAttributes = useMdmHiddenAttributes;
var emptyControlAttributes = [];
var useMdmControlAttributes = function () {
    return useMdmModuleValuesContext(function (context) { return context.controlAttributes || emptyControlAttributes; });
};
exports.useMdmControlAttributes = useMdmControlAttributes;
var useMdmShowMasking = function () { return useMdmModuleValuesContext(function (context) { return context.showMasking; }); };
exports.useMdmShowMasking = useMdmShowMasking;
var useMdmReviewDCREnabled = function () { return useMdmModuleValuesContext(function (context) { return context.reviewDCREnabled; }); };
exports.useMdmReviewDCREnabled = useMdmReviewDCREnabled;
var useMdmDcrReviewAllowAddAttributes = function () {
    return useMdmModuleValuesContext(function (context) { return context.dcrReviewAllowAddAttributes; });
};
exports.useMdmDcrReviewAllowAddAttributes = useMdmDcrReviewAllowAddAttributes;
var useMdmDcrReviewValidation = function () { return useMdmModuleValuesContext(function (context) { return context.dcrReviewValidation; }); };
exports.useMdmDcrReviewValidation = useMdmDcrReviewValidation;
var useMdmCanUserMakeExport = function () { return useMdmModuleValuesContext(function (context) { return context.canUserMakeExport; }); };
exports.useMdmCanUserMakeExport = useMdmCanUserMakeExport;
var useMdmDisableTimestampLocalization = function () {
    return useMdmModuleValuesContext(function (context) { var _a; return (_a = context.disableTimestampLocalization) !== null && _a !== void 0 ? _a : false; });
};
exports.useMdmDisableTimestampLocalization = useMdmDisableTimestampLocalization;
