function generateRandomUsername(usedAdjectives, usedNouns) {
  const adjectives = [
    'Round',
    'Square',
    'Tall',
    'Wide',
    'Small',
    'Large',
    'Flat',
    'Smooth',
    'Long',
    'Short',
    'Straight',
    'Curved',
    'Solid',
    'Hollow',
    'Dense',
    'Light',
    'Deep',
    'Broad',
    'Thin',
    'Thick',
  ];
  const nouns = [
    'Table',
    'Chair',
    'Lamp',
    'Spoon',
    'Book',
    'Door',
    'Window',
    'Pencil',
    'Paper',
    'Bowl',
    'Plate',
    'Cup',
    'Box',
    'Shelf',
    'Frame',
    'Desk',
    'Mirror',
    'Basket',
    'Button',
    'Bottle',
  ];

  let randomAdjective;
  do {
    randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
  } while (usedAdjectives.has(randomAdjective));

  let randomNoun;
  do {
    randomNoun = nouns[Math.floor(Math.random() * nouns.length)];
  } while (usedNouns.has(randomNoun));

  usedAdjectives.add(randomAdjective);
  usedNouns.add(randomNoun);

  const randomInt = Math.floor(Math.random() * 100);

  return randomAdjective + randomNoun + randomInt;
}

function generateUniqueUsernames(count) {
  const usernames = new Set();
  const usedAdjectives = new Set();
  const usedNouns = new Set();

  while (usernames.size < count) {
    usernames.add(generateRandomUsername(usedAdjectives, usedNouns));
  }

  return Array.from(usernames);
}

export default generateUniqueUsernames;
