// Pure resolution of the per-game unread dot's kind, kept out of the .svelte components so it can
// be unit-tested. A game's dot is shown when anything is unread; its colour distinguishes a real
// chat message (the regular danger colour) from nudge-only unread (a softer nudge colour).

/** BadgeKind is the unread dot to show for a game, or null when nothing is unread. */
export type BadgeKind = 'message' | 'nudge' | null;

/**
 * badgeKind picks the unread dot for a game from its two per-viewer flags: null when nothing is
 * unread, 'message' when an unread real chat message is present (the regular colour), else 'nudge'
 * when only nudges are unread (the softer colour). message implies unread, so a stray message=true
 * with unread=false still shows nothing.
 */
export function badgeKind(unread: boolean, message: boolean): BadgeKind {
  if (!unread) return null;
  return message ? 'message' : 'nudge';
}
