// src/utils/templates.js
// HTML templates for user-facing success and error pages

const baseHtml = (title, content) => `
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>${title} - Firefrost Gaming</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@1/css/pico.min.css">
</head>
<body>
    <main class="container" style="text-align: center; margin-top: 10vh;">
        <article>
            ${content}
        </article>
    </main>
</body>
</html>`;

const getSuccessPage = () => baseHtml('Success', `
    <h1>🔥 Account Linked Successfully! ❄️</h1>
    <p>Your Discord account has been connected and your roles are assigned.</p>
    <p>You can close this window and head back to Discord to see your new channels!</p>
`);

const getExpiredPage = () => baseHtml('Link Expired', `
    <h2 style="color: #ffb703;">⏳ This Link Has Expired</h2>
    <p>For security, linking URLs expire after 24 hours.</p>
    <p>Please log in to the website to request a new Discord linking email, or contact support.</p>
`);

const getInvalidPage = () => baseHtml('Invalid Link', `
    <h2 style="color: #e63946;">❌ Invalid Link</h2>
    <p>We couldn't recognize this secure token. The URL might be malformed or incomplete.</p>
    <p>Please make sure you copied the entire link from your email.</p>
`);

const getUsedPage = () => baseHtml('Already Linked', `
    <h2 style="color: #8eca91;">✅ Already Linked</h2>
    <p>This specific token has already been used to link an account.</p>
    <p>If you do not see your roles in Discord, please open a support ticket.</p>
`);

const getServerErrPage = () => baseHtml('System Error', `
    <h2 style="color: #e63946;">⚠️ System Error</h2>
    <p>Something went wrong communicating with the Discord or CMS servers.</p>
    <p>Please try clicking the link in your email again in a few minutes.</p>
`);

const getNotInServerPage = () => baseHtml('Join Server First', `
    <h2 style="color: #ffb703;">👋 One Quick Thing...</h2>
    <p>It looks like you aren't in our Discord server yet!</p>
    <p>Please <a href="https://firefrostgaming.com/discord">click here to join the server</a>, then click the secure link in your email again to receive your roles.</p>
`);

module.exports = { 
    getSuccessPage,
    getExpiredPage, 
    getInvalidPage, 
    getUsedPage, 
    getServerErrPage, 
    getNotInServerPage 
};
