import rawWordList from 'word-list-json/words.json';

export const WORDS_BY_LENGTH: Record<number, string[]> = {
  4: [
    'able', 'acid', 'aged', 'ally', 'arch', 'bake', 'bane', 'beam', 'bold', 'brim',
    'cair', 'cave', 'clay', 'coil', 'cove', 'dare', 'dawn', 'dusk', 'echo', 'emir',
    'fang', 'fate', 'fern', 'fizz', 'gale', 'gilt', 'glow', 'grim', 'haze', 'helm',
    'hewn', 'howl', 'iron', 'jolt', 'keen', 'knot', 'lair', 'lurk', 'maze', 'mire',
    'moon', 'nail', 'omen', 'onyx', 'pale', 'pier', 'pyre', 'rake', 'rift', 'rook',
    'ruin', 'scar', 'shad', 'silt', 'sink', 'smog', 'snag', 'spit', 'thud', 'void',
  ],
  5: [
    'adore', 'aisle', 'altar', 'amber', 'ashen', 'atone', 'basil', 'bleak', 'blitz',
    'brave', 'cabal', 'caper', 'charm', 'cider', 'coven', 'crane', 'crown', 'crypt',
    'demon', 'dirge', 'dread', 'dwell', 'eerie', 'ember', 'fable', 'fiend', 'flint',
    'forge', 'ghost', 'glare', 'gloom', 'grace', 'haunt', 'ivory', 'knife', 'leech',
    'mirth', 'mourn', 'noble', 'olive', 'piety', 'prism', 'quirk', 'raven', 'reign',
    'rhyme', 'rivet', 'shade', 'shard', 'shrew', 'siren', 'skulk', 'slate', 'smite',
    'spare', 'spice', 'spite', 'stare', 'sting', 'stone', 'taunt', 'thorn', 'trace',
    'twine', 'vapor', 'venom', 'vigil', 'viper', 'waltz', 'wight', 'witch', 'wrath',
  ],
  6: [
    'absent', 'arcane', 'balefy', 'beacon', 'bitter', 'candle', 'chisel', 'cinder',
    'coffin', 'cursed', 'dagger', 'dismal', 'dragon', 'embers', 'enigma', 'falter',
    'famine', 'fierce', 'goblet', 'gothic', 'guilty', 'harrow', 'hazard', 'hollow',
    'impish', 'jagged', 'lament', 'legacy', 'malice', 'meteor', 'mirror', 'mortal',
    'mystic', 'nebula', 'oracle', 'plague', 'poison', 'quartz', 'quiver', 'rancor',
    'reaper', 'ritual', 'runics', 'savage', 'shadow', 'shriek', 'silver', 'sorrow',
    'spider', 'spirit', 'talons', 'thorns', 'tombed', 'unholy', 'velvet', 'wicked',
  ],
  7: [
    'abyssal', 'ancient', 'banshee', 'betrayl', 'brimful', 'cadence', 'caldera',
    'chalice', 'chimera', 'cloaked', 'crimson', 'cruelty', 'demonic', 'dragons',
    'eclipse', 'emerald', 'fangirl', 'fateful', 'gallows', 'glimmer', 'grimace',
    'harvest', 'haunted', 'hexagon', 'inferno', 'lantern', 'malison', 'midnite',
    'monster', 'mystery', 'nightly', 'onyxian', 'ominous', 'phantom', 'puzzled',
    'revenge', 'riddles', 'scarlet', 'serpent', 'shadows', 'shatter', 'specter',
    'spitefu', 'torment', 'twisted', 'vampire', 'vengean', 'warlock', 'whisper',
  ],
  10: [
    'apparition', 'blackthorn', 'candlewick', 'cataclysmn', 'cryptogram', 'darkmatter',
    'enchanting', 'ghastliest', 'graveyardx', 'shadowcast', 'nightshade', 'phantasmal',
  ],
  11: [
    'abomination', 'bloodcurdle', 'conjuration', 'dreadnought', 'maleficence', 'netherworld',
    'spellbinder', 'thunderbolt', 'witchfinder', 'shadowlands',
  ],
  12: [
    'bewilderment', 'clairvoyance', 'consternated', 'disquietedly', 'horrifically',
    'labyrinthine', 'maledictions', 'spectaculars', 'transylvania',
  ],
  13: [
    'bloodlettings', 'catastrophics', 'claustrophobe', 'phantasmagory', 'supernaturals',
    'unpredictable',
  ],
  14: [
    'disenchantings', 'incomprehenses', 'misdirectionzz', 'overcomplicate', 'unforgivinglys',
  ],
  15: [
    'counterintuitiv', 'inconsequential', 'misinterpretate', 'overdramtically',
    'uncharacterized',
  ],
};

export const ALL_WORDS = Object.values(WORDS_BY_LENGTH).flat();

const packageWords = rawWordList.words
  .map((word) => word.toLowerCase())
  .filter((word) => /^[a-z]+$/.test(word) && word.length >= 4 && word.length <= 15);

export const VALID_GUESSES = new Set([...ALL_WORDS, ...packageWords]);
