import { useTranslation } from "react-i18next";
import { DEFAULT_DATA_SOURCE_KEY } from "../../../data-source/data-source/DataSourceManager.mjs";
import { useCurrentUserContext } from "../../../user/index.mjs";
import { useBaseVariable } from "./useBaseVariable.mjs";
const useUserVariable = (param)=>{
    let { collectionField, uiSchema, noDisabled, targetFieldSchema, maxDepth = 3 } = param;
    const { t } = useTranslation();
    const result = useBaseVariable({
        collectionField,
        uiSchema,
        maxDepth,
        name: '$user',
        title: t('Current user'),
        collectionName: 'users',
        dataSource: DEFAULT_DATA_SOURCE_KEY,
        noDisabled,
        targetFieldSchema
    });
    return result;
};
const useCurrentUserVariable = function() {
    let { collectionField, uiSchema, noDisabled, targetFieldSchema, maxDepth = 3 } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    var _data_data;
    const { t } = useTranslation();
    const data = useCurrentUserContext();
    const currentUserSettings = useBaseVariable({
        collectionField,
        uiSchema,
        maxDepth,
        name: '$user',
        title: t('Current user'),
        collectionName: 'users',
        noDisabled,
        targetFieldSchema
    });
    return {
        currentUserSettings,
        currentUserCtx: null == data ? void 0 : null == (_data_data = data.data) ? void 0 : _data_data.data
    };
};
export { useCurrentUserVariable, useUserVariable };
