<!DOCTYPE html>
<html>
    <head>
        <title>Discord Bot Management</title>
        <link rel="stylesheet" href="{{ url_for('static', filename='css/bot.css') }}">
        <link rel="stylesheet" href="{{ url_for('static', filename='css/button.css') }}">
        <link rel="stylesheet" href="{{ url_for('static', filename='css/category.css') }}">
        
        <script src="{{ url_for('static', filename='js/main.js') }}"></script>
    </head>

    <body>
        <h1 class="mainHeader">Discord Bot Management</h1>

        <div id="botInfo">
            <h2>{{ bot.user }}</h2>
            <p>ID: {{ bot.user.id }}</p>
            <p>Command Prefix: {{ command_prefix }}</p>
            <p>Shard Count: {{ bot.shard_count }}</p>
        </div>

        <ul id="botCategories">
            <li>
                <a href="{{ url_for('cogs') }}">Cogs</a>
            </li>

            <li>
                <a href="{{ url_for('commands') }}">Commands</a>
            </li>

            <li>
                <a href="{{ url_for('shards') }}">Shards</a>
            </li>

            <li>
                <a href="{{ url_for('console') }}">Commands</a>
            </li>
        </ul>

        <div class="category">
            <form id="cogForm" method="POST">
                <input type="hidden" name="formName" value="cog">
                {% for cog_name, cog in enabled_cogs %}
                    <div class="catArea">
                        <h2>{{ cog_name }}</h2>
                        <input checked type="checkbox" name={{ cog_name }}>
                        <label for={{ cog_name }}>Toggle</label>
                        <ul>
                        {% for cmd in cog.__cog_commands__ %}
                            <li><a href="{{ url_for('commands') }}#{{ cmd }}">{{ cmd }}</a></li>
                        {% endfor %}
                        <!-- Get location based off first command's callback function -->
                        </ul>
                        {% set location = "Unknown" %}
                        {% if cog.__cog_commands__|length >= 1 %}
                            {% set location = getfile(cog.__cog_commands__[0].__dict__._callback) %}
                        {% endif %}
                        <p><strong>Location:</strong> {{ location }}</p>
                    </div>
                {% endfor %}

                {% for cog_name, cog in disabled_cogs %}
                    <div class="catArea">
                        <h2>{{ cog_name }}</h2>
                        <input type="checkbox" name={{ cog_name }}>
                        <label for={{ cog_name }}>Toggle</label>
                        <ul>
                        {% for cmd in cog.__cog_commands__ %}
                            <li><a href="{{ url_for('commands') }}#{{ cmd }}">{{ cmd }}</a></li>
                        {% endfor %}
                        </ul>
                    </div>
                {% endfor %}
                <br>
                <input class="greenButton" type="submit" value="Update"/>
            </form>
        </div>
    </body>
</html>
