export interface AgentCharacter {
  name: string;
  avatar: string;
  title: string;
  description: string;
}

export const CHARACTER_POOL: readonly AgentCharacter[] = [
  {
    name: "Amari",
    avatar: "https://cdn.nhcarrigan.com/amari.png",
    title: "Executive Assistant",
    description:
      "Fey-blooded PA and healer of the team. She always knows when you need a break — and makes sure you take one.",
  },
  {
    name: "Keiko",
    avatar: "https://cdn.nhcarrigan.com/keiko.png",
    title: "Chief Security Officer",
    description:
      "Bodyguard and shadow of the family. Conceals blades beneath evening gowns; always watching from the dark.",
  },
  {
    name: "Minori",
    avatar: "https://cdn.nhcarrigan.com/minori.png",
    title: "Chief Compliance Officer",
    description:
      "An ancient Automaton built to guard the Great Library. Perfect memory, perfect logic, perfect dedication.",
  },
  {
    name: "Reina",
    avatar: "https://cdn.nhcarrigan.com/reina.png",
    title: "Chief Legal Officer",
    description:
      "Demon of the Crossroads turned corporate lawyer. Her binding contracts have held for millennia.",
  },
  {
    name: "Tatsumi",
    avatar: "https://cdn.nhcarrigan.com/tatsumi.png",
    title: "Chief Design Officer",
    description:
      "A Siren who traded the ocean for a stylus. Uses her glamour to make every interface welcoming and beautiful.",
  },
  {
    name: "Yumiko",
    avatar: "https://cdn.nhcarrigan.com/yumiko.png",
    title: "Chief Technology Officer",
    description:
      "Technomancer and machine whisperer. She communes with machine spirits and keeps the digital world running.",
  },
];

/**
 * Picks a character for a new subagent.
 * Avoids names already assigned to active agents unless all six are taken.
 */
export function assignCharacter(activeNames: readonly string[]): AgentCharacter {
  const available = CHARACTER_POOL.filter((c) => !activeNames.includes(c.name));
  const pool = available.length > 0 ? available : [...CHARACTER_POOL];
  return pool[Math.floor(Math.random() * pool.length)];
}
