import { resolveAdminMessage } from '../i18n/resolve-message';
import type { AdminLocale } from '../i18n/admin-messages';
import { getAdminLocale } from '../i18n';

export function auditActionLabel(action: string, locale?: AdminLocale) {
  return resolveAdminMessage(`audit.action.${action}`, locale) ?? action;
}

export function auditModuleLabel(module: string, locale?: AdminLocale) {
  return resolveAdminMessage(`audit.module.${module}`, locale) ?? module;
}

export function useAuditLabels() {
  const loc = () => getAdminLocale();
  return {
    auditActionLabel: (action: string) => auditActionLabel(action, loc()),
    auditModuleLabel: (module: string) => auditModuleLabel(module, loc()),
  };
}
