// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

const vowels = ['a', 'e', 'i', 'o', 'u'];
const consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'];
const getRandomValue = array => {
  const index = Math.floor(Math.random() * array.length);
  return array[index];
};
const getRandomLetter = letters => getRandomValue(letters);
const getRandomNumber = (min, max) => min + Math.floor(Math.random() * (max - min + 1));
const getRandomWord = () => {
  let result = '';
  const length = getRandomNumber(5, 8);
  let consonant = Math.random() > 0.2;
  while (result.length < length) {
    result += getRandomLetter(consonant ? consonants : vowels);
    consonant = !consonant;
  }
  return result;
};
const getRandomSuffix = () => getRandomValue(['.com', '.net', '.org', '.edu']);
const getRandomDomain = () => getRandomWord() + getRandomSuffix();
const getRandomMarks = () => ['Debug', 'Maintenance mode', 'Have issues', 'Broken', 'Quarantined', 'Update available', 'Have security issues'].filter(() => Math.random() > 0.95);
const data = [];
for (let i = 0; i < 120; i++) {
  data.push({
    key: String(i + 1),
    domain: getRandomDomain(),
    marks: getRandomMarks()
  });
}
module.exports = data;