{#
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2025 The Linux Foundation
#}

{#- Section: Features (HTML) -#}
{#- Renders the features section with repository feature matrix -#}
{#-
    Context required:
        - features (dict): Feature detection data and matrix
        - config (dict): Configuration options

    This section displays:
        - Repository feature matrix showing which features are detected
        - Matches production format: Gerrit Project | Type | Dependabot | Pre-commit | ReadTheDocs | .gitreview | G2G | Status
-#}

{% if config.include_sections.features and features.has_features %}
<section id="features" class="report-section features-section">
    <h2>🔧 Gerrit Project Feature Matrix</h2>

    <table class="dt-enabled dt-no-search dt-no-pagination feature-matrix-table">
        <thead>
            <tr>
                <th>Gerrit Project</th>
                <th>Primary Type</th>
                <th>Other Types</th>
                <th>Dependabot</th>
                <th>Pre-commit</th>
                <th>ReadTheDocs</th>
                <th>.gitreview</th>
                <th>G2G</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            {% for repo_data in features.matrix %}
            <tr>
                <td>{{ repo_data.repo_name }}</td>
                <td>{{ repo_data.primary_type | default('N/A') }}</td>
                <td>{% if repo_data.other_types %}{{ repo_data.other_types | join('<br>') | safe }}{% endif %}</td>
                <td>{{ '✅' if repo_data.features.get('dependabot', False) else '❌' }}</td>
                <td>{{ '✅' if repo_data.features.get('pre_commit', False) else '❌' }}</td>
                <td>{{ '✅' if repo_data.features.get('readthedocs', False) else '❌' }}</td>
                <td>{{ '✅' if repo_data.features.get('gitreview', False) else '❌' }}</td>
                <td>{{ '✅' if repo_data.features.get('g2g', False) else '❌' }}</td>
                <td>{{ repo_data.status | default('✅') }}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

</section>
{% endif %}
