export const STATUS_CRITICAL = 'critical';
export const STATUS_WARNING = 'warning';
export const STATUS_NONE = 'none';
export const STATUS_HEALTH = 'healthy';
export const STATUS_UNKNOWN = 'unknown';
// some common customized sortTypes
export function compareHealth(status1, status2) {
    if (![STATUS_WARNING, STATUS_CRITICAL, STATUS_NONE, STATUS_HEALTH].includes(status1) ||
        ![STATUS_WARNING, STATUS_CRITICAL, STATUS_NONE, STATUS_HEALTH].includes(status2)) {
        console.error('Invalid health status');
        return;
    }
    const weights = {};
    weights[STATUS_CRITICAL] = 3;
    weights[STATUS_WARNING] = 2;
    weights[STATUS_NONE] = 1;
    weights[STATUS_HEALTH] = 0;
    return weights[status1] === weights[status2]
        ? 0
        : weights[status1] > weights[status2]
            ? 1
            : -1;
}
export function convertRemToPixels(rem) {
    return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
}
// in rem unit
export const tableRowHeight = {
    h32: '2.286', //1 line
    h40: '2.858', //2 line
    h48: '3.428', //2 line
    h64: '4.572', //3 line
};
export const translatedMessages = (type, entityName, locale) => {
    var _a, _b, _c;
    if (type === 'error') {
        if (locale === 'fr') {
            return `Erreur lors du chargement des ${((_a = entityName === null || entityName === void 0 ? void 0 : entityName.fr) === null || _a === void 0 ? void 0 : _a.plural) || 'données'}, veuillez rafraîchir la page.`;
        }
        return `An error occurred while loading ${entityName ? `the ${entityName.en.plural}` : 'data'}, please refresh the
    page.`;
    }
    if (type === 'loading' || type === 'idle') {
        if (locale === 'fr') {
            return `Chargement des ${((_b = entityName === null || entityName === void 0 ? void 0 : entityName.fr) === null || _b === void 0 ? void 0 : _b.plural) || 'données'}...`;
        }
        return `Loading ${(entityName === null || entityName === void 0 ? void 0 : entityName.en.plural) || 'data'}...`;
    }
    if (type === 'noResult') {
        if (locale === 'fr') {
            return `Aucun ${((_c = entityName === null || entityName === void 0 ? void 0 : entityName.fr) === null || _c === void 0 ? void 0 : _c.singular) || 'résultat'} trouvé`;
        }
        return `No ${(entityName === null || entityName === void 0 ? void 0 : entityName.en.plural) || 'results'} found`;
    }
    return '';
};
