<!DOCTYPE html>
<html lang="en">
    <%- include('../../../public/layouts/head') %>
    <body>
        <%- include('../../../public/layouts/aside.ejs') %>
        <h1>MY GAMES</h1>
        <article class="favoriteArticle">
            <% games.forEach((game) => { %>
                <section class="favoriteSection">
                    <h1 class="game_title"><%= game.title %></h1>
                    <img src = "<%= game.image_url %>">
                    <div class="favorites">
                        <form action="/gamepage" method="POST">
                            <fieldset>
                                <input type="hidden" name="title" value="<%= game.title %>" required>
                                <input type="hidden" name="image_url" value="<%= game.image_url %>" required>
                                <input type="hidden" name="rating" value="<%= game.rating %>" required>
                                <input type="hidden" name="ratingCount" value="<%= game.ratingCount %>" required>
                                <input type="hidden" name="platforms" value="<%= game.platforms %>" required>
                                <input type="hidden" name="parent_platforms" value="<%= game.parent_platforms %>" required>
                                <input type="hidden" name="genres" value="<%= game.genres %>" required>
                                <input type="hidden" name="trailer" value="<%= game.trailer %>" required>
                                <input type="hidden" name="preview" value="<%= game.preview %>" required>
                                <input type="hidden" name="filters" value="<%= game.filters %>" required>
                                <input type="hidden" name="description" value="<%= game.description %>" required>
                                <input type="hidden" name="gameID" value="<%= game.gameID %>" required>
                                <input type="hidden" name="slug" value="<%= game.slug %>" required>
                                <button class= "favoritesButton" type="submit"> MORE DETAILS </button>
                            </fieldset>
                        </form>
                        <form action="/suggest" method="post">
                            <input type="hidden" name="slug" value="<%= game.slug %>"/>
                            <button class="favoritesButton" type="submit">GET SUGGESTIONS</button>
                        </form>
                        <form action="/favorites?_method=DELETE" method="post">
                            <input type="hidden" name="remove_target" value="<%= game.slug %>"/>
                            <button class="favoritesButton" type="submit"><i class="fas fa fa-trash"></i></button>
                        </form>
                    </div>
                </section >
            <% }) %>
        </article>
        <%- include('../../../public/layouts/footer') %>
    </body>
</html>