{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template aiprovider_datacurso/report_page

    Summary dashboard with token metrics and charts.

    Example context (json):
    {
        "services": []
    }
}}

<div class="container-fluid">
    <!-- Summary Cards -->
    <div class="report-summary-cards mb-4">
        <div class="row">
            <div class="col-md-6 col-12 mb-3">
                <div class="card h-100">
                    <div class="card-body text-center">
                        <h4 class="card-title">{{#str}}tokens_available, aiprovider_datacurso{{/str}}</h4>
                        <p id="tokens-available" class="card-text display-4 text-primary font-weight-bold">--</p>
                    </div>
                </div>
            </div>
            <div class="col-md-6 col-12 mb-3">
                <div class="card h-100">
                    <div class="card-body text-center">
                        <h4 class="card-title">{{#str}}total_consumed, aiprovider_datacurso{{/str}}</h4>
                        <p id="tokens-consumed" class="card-text display-4 text-success font-weight-bold">--</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Charts Section -->
    <div class="report-charts">
        <div class="row">
            <div class="col-lg-6 col-12 mb-4">
                <div class="card h-100">
                    <div class="card-header d-flex flex-column flex-sm-row justify-content-between align-items-start align-items-sm-center">
                        <h4 class="card-title mb-2 mb-sm-0">{{#str}}chart_tokens_by_month, aiprovider_datacurso{{/str}}</h4>
                        <select id="filter-service-bar" class="form-control form-control-sm w-auto mt-2 mt-sm-0">
                            <option value="">{{#str}}all, aiprovider_datacurso{{/str}}</option>
                        </select>
                    </div>
                    <div class="card-body">
                        <div class="chart-container" style="position: relative; height: 400px;">
                            <canvas id="chart-tokens-by-month"></canvas>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-6 col-12 mb-4">
                <div class="card h-100">
                    <div class="card-header d-flex flex-column flex-sm-row justify-content-between align-items-start align-items-sm-center">
                        <h4 class="card-title mb-2 mb-sm-0">{{#str}}chart_actions, aiprovider_datacurso{{/str}}</h4>
                        <select id="filter-service-pie" class="form-control form-control-sm w-auto mt-2 mt-sm-0">
                            <option value="">{{#str}}all, aiprovider_datacurso{{/str}}</option>
                        </select>
                    </div>
                    <div class="card-body">
                        <div class="chart-container" style="position: relative; height: 400px;">
                            <canvas id="chart-actions"></canvas>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-12 mb-4">
                <div class="card h-100">
                    <div class="card-header d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center">
                        <h4 class="card-title mb-2 mb-md-0">{{#str}}chart_tokens_by_day, aiprovider_datacurso{{/str}}</h4>
                        <div class="d-flex flex-column flex-sm-row gap-2 w-100 w-md-auto mt-2 mt-md-0">
                            <input type="date" id="filter-start-date" class="form-control form-control-sm">
                            <input type="date" id="filter-end-date" class="form-control form-control-sm">
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="chart-container" style="position: relative; height: 400px;">
                            <canvas id="chart-tokens-by-day"></canvas>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
