import type { AppPlayer } from '../types';

/** Игроки + члены выбранных команд, без дублей. */
export function resolveLaunchPlayerIds(
  players: readonly AppPlayer[],
  selectedPlayerIds: ReadonlySet<string>,
  selectedTeamIds: ReadonlySet<string>,
): string[] {
  const out = new Set<string>();
  for (const id of selectedPlayerIds) out.add(id);
  for (const p of players) {
    if (p.teamId && selectedTeamIds.has(String(p.teamId))) out.add(String(p.id));
  }
  return [...out];
}
