"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.logDeprecationInternal = exports.logDeprecationExternal = exports.logDeprecation = void 0;
const doOnceFlags = {};
/**
 * If the key was passed before, then do NOT execute the func
 */
const doOnce = (func, key) => {
    if (doOnceFlags[key]) {
        return;
    }
    func();
    doOnceFlags[key] = true;
};
const logDeprecation = (logger, typeName, oldProp, newProp, message) => {
    const newPropMsg = newProp ? `Please use '${typeName}.${newProp}()' instead. ` : '';
    doOnce(() => logger.consoleWarn(`${typeName}.${oldProp}() is deprecated. ${newPropMsg}${message ?? ''}`), `Deprecated_${oldProp}`);
};
exports.logDeprecation = logDeprecation;
const logDeprecationExternal = (logger, oldTypeName, oldProp, newTypeName, newProp, message) => {
    const newPropMsg = newProp ? `Please use '${newTypeName}.${newProp}()' instead. ` : '';
    doOnce(() => logger.consoleWarn(`${oldTypeName}.${oldProp}() is deprecated. ${newPropMsg}${message ?? ''}`), `Deprecated_${oldProp}`);
};
exports.logDeprecationExternal = logDeprecationExternal;
const logDeprecationInternal = (logger, typeName, oldProp) => {
    doOnce(() => logger.consoleWarn(`${typeName}.${oldProp}() is deprecated and will be removed in the next major release. Contact support if you need this functionality.`), `Deprecated_${oldProp}`);
};
exports.logDeprecationInternal = logDeprecationInternal;
