// STUB — @/DMS is not migrated into this backoffice. These placeholders exist
// only so record-management's document components resolve; the DMS feature is
// inert here. Replace with the real @/DMS module if DMS is ever brought over.

export function formatBytes(bytes?: number | null): string {
  if (!bytes || bytes <= 0) return "0 B";
  const units = ["B", "KB", "MB", "GB", "TB"];
  const i = Math.floor(Math.log(bytes) / Math.log(1024));
  return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${units[i] ?? "B"}`;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function resolveOwnerName(owner?: any): string {
  return owner?.name ?? owner?.username ?? owner?.email ?? "";
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function pickName(item?: any): string {
  return item?.name ?? item?.title ?? item?.fileName ?? "";
}
