import { words } from './word';
import { HOSTS } from './host';

const EMAIL_DOMAINS = Object.entries(HOSTS).reduce<string[]>(
  (acc, [key, val]) => {
    acc.push(key);
    return acc;
  },
  []
);

export default function email() {
  const idx = Math.floor(Math.random() * (EMAIL_DOMAINS.length - 1));
  return `${words(2).join(".")}@${EMAIL_DOMAINS[idx]}`;
}
