-- Script to insert 3 sample news articles into the website_news table
-- To be executed on the web database

-- Check if the website_news table exists
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[website_news]') AND type in (N'U'))
BEGIN
    -- 1. News of type "info" - General announcement
    INSERT INTO website_news (
        title, 
        subtitle, 
        content, 
        image_url, 
        category, 
        created_at, 
        updated_at, 
        is_published
    )
    VALUES (
        N'Welcome to our new website',
        N'A new design for a better experience',
        N'<p>We are excited to introduce our brand new website, designed to offer you an even more immersive and enjoyable experience.</p>
        <p>Among the new features, you will discover:</p>
        <ul>
            <li>A redesigned and intuitive navigation</li>
            <li>More detailed information about the game</li>
            <li>Simplified access to your account</li>
            <li>And much more!</li>
        </ul>
        <p>We hope you will enjoy these improvements and we remain open to your suggestions to make your experience even better.</p>',
        N'https://picsum.photos/800/400',
        N'info',
        GETDATE(),
        GETDATE(),
        1
    );

    -- 2. News of type "maj" - Game update
    INSERT INTO website_news (
        title, 
        subtitle, 
        content, 
        image_url, 
        category, 
        created_at, 
        updated_at, 
        is_published
    )
    VALUES (
        N'Update 3.5: New equipment and zones',
        N'A major update is coming soon to our servers',
        N'<h3>Get ready for adventure!</h3>
        <p>Update 3.5 will be deployed on April 28, 2025 and will bring many changes:</p>
        <h4>New content:</h4>
        <ul>
            <li><strong>New zone:</strong> The Ethereal Abyss - explore a realm between dimensions with unique monsters</li>
            <li><strong>New armor:</strong> Legendary set "Echo of the Ancients" with unique bonuses</li>
            <li><strong>New weapons:</strong> Collection of ancestral weapons with stunning visual effects</li>
        </ul>
        <h4>Balance adjustments:</h4>
        <ul>
            <li>Revision of Cleric and Sorcerer class abilities</li>
            <li>Adjustments to experience points required between levels 45 and 55</li>
        </ul>
        <p>Servers will be under maintenance on April 28 from 2 AM to 10 AM for the installation of this update.</p>',
        N'https://picsum.photos/800/450',
        N'maj',
        DATEADD(day, -2, GETDATE()),
        DATEADD(day, -2, GETDATE()),
        1
    );

    -- 3. News of type "event" - Special event
    INSERT INTO website_news (
        title, 
        subtitle, 
        content, 
        image_url, 
        category, 
        created_at, 
        updated_at, 
        is_published
    )
    VALUES (
        N'Eternal Spring Festival',
        N'Celebrate with us and earn exclusive rewards',
        N'<h3>The Eternal Spring Festival begins!</h3>
        <p>From May 1 to May 15, 2025, join us to celebrate the Eternal Spring Festival, an annual event filled with joy and rewards!</p>
        <h4>Special activities:</h4>
        <ul>
            <li><strong>Daily quests:</strong> Complete missions each day to earn special tokens</li>
            <li><strong>Crystal egg hunt:</strong> Find hidden eggs throughout the world to earn bonus points</li>
            <li><strong>Event boss:</strong> The "Spring Guardian" will appear every 3 hours in major cities</li>
        </ul>
        <h4>Exclusive rewards:</h4>
        <ul>
            <li>"Floral Pegasus" mount (permanent)</li>
            <li>"Spring Bloom" cosmetic set</li>
            <li>Temporary transformations into fairy creatures</li>
            <li>And much more!</li>
        </ul>
        <p>Don''t miss this unique event and its rewards that won''t return until next year!</p>',
        N'https://picsum.photos/800/500',
        N'event',
        DATEADD(day, -5, GETDATE()),
        DATEADD(day, -5, GETDATE()),
        1
    );

    PRINT 'Three sample news articles have been successfully inserted';
END
ELSE
BEGIN
    PRINT 'The website_news table does not exist. Please first execute the create_website_news_table.sql script';
END