import type { TCurrentUser } from '@tria-plc/api-common/modules/auth/types/current-user.type'; /** * Human-readable actor label for audit stamps (`performed_by` / `moved_by`). * Prefers a display name, then username/email, so the activity log shows a * person rather than a UUID. Returns undefined when there is no authenticated * user (internal/cron calls), letting callers fall back to their prior value. */ export function actorLabel(user?: TCurrentUser | null): string | undefined { if (!user) return undefined; const name = user.name?.en?.trim() || user.name?.am?.trim(); return name || user.username || user.email || user.id || undefined; }