const casual = [
    "hey what's up", "brb grabbing coffee", "morning everyone", "good night y'all",
    "anyone here?", "just got back", "what did i miss", "i'm so bored",
    "how's everyone doing", "yo", "sup", "what's good", "nothing much hbu",
    "just vibing", "back from lunch", "heading out soon", "gotta go eat",
    "anyone wanna chat", "i'm back", "sorry was afk", "ok i'm here now",
    "what are we talking about", "oh i see", "makes sense", "gotcha",
    "fair enough", "alright", "cool cool", "same here", "felt that",
];

const reactions = [
    "lmao that's hilarious", "wait really??", "no way", "bruh moment",
    "that's crazy", "i can't believe that", "omg", "lmaooo",
    "that's wild", "are you serious", "no shot", "actually?",
    "wait what", "hold up", "nah that's insane", "you're joking right",
    "bro what", "that's so funny", "i'm dying", "💀💀💀",
    "literally crying", "stop it lmao", "that's messed up", "yooo",
    "i'm screaming", "LMAO", "that sent me",
];

const short = [
    "lol", "nice", "gg", "rip", "true", "based", "fr", "ong",
    "bet", "yep", "nah", "ye", "ok", "k", "wow", "damn",
    "sheesh", "facts", "cap", "W",
];

const techQuestions = [
    "what's the best way to handle state in react?",
    "anyone know how to fix cors errors?",
    "is typescript worth learning?",
    "how do you center a div lol",
    "what's the difference between let and const?",
    "should i use redux or context api?",
    "how do websockets work exactly?",
    "anyone used rust before?",
    "what ide do you guys use?",
    "is python good for backend?",
    "how do i deploy to vercel?",
    "what's a good database for small projects?",
    "anyone know regex well?",
    "how do promises work?",
    "what's the deal with docker?",
    "is graphql better than rest?",
    "how do i get started with linux?",
    "what's a good git workflow?",
    "anyone know how to fix npm errors?",
    "what framework should i learn next?",
    "how do you debug css layout issues?",
    "is svelte actually better than react?",
    "what's the point of kubernetes?",
    "how do you handle auth properly?",
    "anyone used convex before? it's pretty cool",
    "what's a good way to learn algorithms?",
    "how do you structure a monorepo?",
    "should i use tailwind or regular css?",
    "what's the best terminal emulator?",
    "how do environment variables work?",
];

const techAnswers = [
    "you should try using useReducer for that",
    "just add the cors headers on the backend",
    "typescript is 100% worth it, saves so much debugging time",
    "flexbox is your friend, just use display flex and justify-content center",
    "const is for things that don't change, let is for things that do",
    "context api is fine for most cases honestly",
    "websockets keep a persistent connection between client and server",
    "rust is amazing but the learning curve is steep",
    "vscode is the goat, fight me",
    "python is great for backend, especially with fastapi",
    "vercel makes deployment super easy, just connect your github",
    "sqlite is perfect for small projects",
    "regex101.com is a lifesaver for testing regex",
    "promises are just a way to handle async operations",
    "docker lets you containerize your apps so they run the same everywhere",
    "graphql is better when you need flexible queries",
    "just install ubuntu and start using the terminal",
    "git flow is overkill, just use trunk-based development",
    "try deleting node_modules and running npm install again",
    "next.js is probably the safest bet right now",
    "use the browser devtools, inspect element is your best friend",
    "svelte is great for small projects but react has more ecosystem",
    "kubernetes is for orchestrating containers at scale",
    "use jwt tokens with refresh tokens for auth",
    "convex is great for real-time apps, the reactive queries are awesome",
];

const codeSnippets = [
    "just do `const x = arr.filter(Boolean)`",
    "try `Object.entries(obj).map(([k,v]) => ...)`",
    "use `arr.reduce((a, b) => a + b, 0)` for sum",
    "`?.` optional chaining saved my life so many times",
    "just use `structuredClone(obj)` for deep copies now",
    "`Promise.all()` is way faster than awaiting in a loop",
    "you can do `const { data } = await fetch(url).then(r => r.json())`",
    "`Array.from({ length: n }, (_, i) => i)` for range",
    "use `Set` for unique values: `[...new Set(arr)]`",
    "template literals are so much cleaner than string concat",
    "`console.table()` is underrated for debugging arrays",
    "destructuring assignment makes everything cleaner",
    "`??` nullish coalescing is better than `||` for defaults",
    "use `at(-1)` instead of `arr[arr.length - 1]`",
    "async generators are pretty neat for streaming data",
];

const gaming = [
    "anyone want to play some valorant later?",
    "just hit diamond finally let's gooo",
    "that game was so close",
    "i keep getting destroyed in ranked",
    "new update is actually fire",
    "the servers are lagging again",
    "who's online tonight?",
    "gg wp everyone",
    "i need to touch grass honestly",
    "my aim is so bad today",
    "anyone else hyped for the new season?",
    "that clutch was insane",
    "i'm taking a break from competitive",
    "the new character is broken lmao",
    "how do you have so many hours in that game",
    "just one more game... said 3 hours ago",
    "the matchmaking is so bad",
    "rage quit incoming",
    "carried the whole team ngl",
    "that was the worst game of my life",
];

const observations = [
    "i can't believe it's already february",
    "why does time go so fast",
    "the weather is terrible today",
    "i should really go to sleep",
    "my cat just knocked everything off my desk",
    "i've been coding for 8 hours straight",
    "i forgot to eat lunch again",
    "my internet is so slow today",
    "i really need a second monitor",
    "it's so quiet in here",
    "does anyone else stay up way too late",
    "i just realized i've been in the wrong channel",
    "my keyboard is so loud my roommate hates me",
    "i need more coffee",
    "the sun is already setting what",
    "i should probably go outside at some point",
    "how is it midnight already",
    "my phone is at 2% as usual",
    "i've had this tab open for 3 days",
    "just spent 2 hours debugging a typo",
];

const humor = [
    "my code worked first try, something is definitely wrong",
    "git commit -m 'fixed it (for real this time)'",
    "99 bugs in the code, take one down patch it around, 127 bugs in the code",
    "it works on my machine ¯\\_(ツ)_/¯",
    "the real bug was the friends we made along the way",
    "who needs sleep when you have bugs to fix",
    "stackoverflow is my copilot",
    "me: writes 10 lines of code. debugger: and i took that personally",
    "css: where everything is made up and the points don't matter",
    "there are 10 types of people: those who understand binary and those who don't",
    "a sql query walks into a bar, sees two tables, and asks: can i join you?",
    "!false — it's funny because it's true",
    "i don't always test my code but when i do i do it in production",
    "my code doesn't have bugs, it has surprise features",
    "the best error message is the one that never shows up",
];

const emoji = [
    "let's gooooo 🎉", "pain 😭", "this is fine 🔥", "vibes ✨",
    "crying rn 😂", "big brain move 🧠", "W take 👑", "sadge 😔",
    "sheeeesh 🥶", "lowkey scary 😳", "that's a vibe 💯", "mood 😴",
    "nailed it 💪", "oof 😬", "poggies 🐸",
];

const allMessages = [
    ...casual, ...reactions, ...short, ...techQuestions, ...techAnswers,
    ...codeSnippets, ...gaming, ...observations, ...humor, ...emoji,
];

const prefixes = ["oh ", "honestly ", "ngl ", "lowkey ", "wait ", "yo ", "bro ", "dude ", "hmm ", "ah "];
const suffixes = [" tbh", " lol", " lmao", " fr", " honestly", " though", " ngl", " imo", " haha", " bruh"];

export function generateUniqueMessage(index) {
    if (index < allMessages.length) {
        return allMessages[index];
    }

    const baseIndex = index % allMessages.length;
    const variation = Math.floor(index / allMessages.length);
    let msg = allMessages[baseIndex];

    if (variation % 3 === 1) {
        msg = prefixes[variation % prefixes.length] + msg;
    } else if (variation % 3 === 2) {
        msg = msg + suffixes[variation % suffixes.length];
    } else {
        msg = prefixes[(variation + 3) % prefixes.length] + msg + suffixes[(variation + 5) % suffixes.length];
    }

    return msg;
}
