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

{#- Section: Summary Statistics (HTML) -#}
{#- Renders the summary section with global repository statistics -#}
{#-
    Context required:
        - summary (dict): Summary statistics
        - config (dict): Configuration options

    This section displays:
        - Global statistics table
        - Repository counts by activity status
        - Lines of code metrics
-#}

{% if config.include_sections.summary %}
<section id="summary" class="report-section summary-section">
    <h2>📈 Global Summary</h2>

    <p><strong>✅ Current</strong> commits within last 365 days</p>
    <p><strong>☑️ Active</strong> commits between 365-1095 days</p>
    <p><strong>🛑 Inactive</strong> no commits in 1095+ days</p>

    <table class="no-search no-pagination">
        <thead>
            <tr>
                <th>Metric</th>
                <th>Count</th>
                <th>Percentage</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Total {{ project.terminology.repositories }}</td>
                <td>{{ summary.repositories_analyzed }}</td>
                <td>100%</td>
            </tr>
            <tr>
                <td>Current {{ project.terminology.repositories }}</td>
                <td>{{ summary.current_count }}</td>
                <td>{{ (summary.current_percentage | default(0) | round(1)) }}%</td>
            </tr>
            <tr>
                <td>Active {{ project.terminology.repositories }}</td>
                <td>{{ summary.active_count }}</td>
                <td>{{ (summary.active_percentage | default(0) | round(1)) }}%</td>
            </tr>
            <tr>
                <td>Inactive {{ project.terminology.repositories }}</td>
                <td>{{ summary.inactive_count }}</td>
                <td>{{ (summary.inactive_percentage | default(0) | round(1)) }}%</td>
            </tr>
            <tr>
                <td>No Apparent Commits</td>
                <td>{{ summary.no_commit_count }}</td>
                <td>{{ (summary.no_commit_percentage | default(0) | round(1)) }}%</td>
            </tr>
            <tr>
                <td>Total Commits</td>
                <td>{{ summary.total_commits_formatted }}</td>
                <td>-</td>
            </tr>
            <tr>
                <td>Total Lines of Code</td>
                <td>{{ summary.net_lines_formatted }}</td>
                <td>-</td>
            </tr>
        </tbody>
    </table>

</section>
{% endif %}
