{{!
    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 local_unifiedgrader/assessment_criteria_modal

    Modal body for viewing assessment criteria (rubric or marking guide).
    Rendered client-side via core/templates.render() with grading definition data.

    Context variables required:
    * method - string: 'rubric' or 'guide'
    * name - string: name of the grading form
    * description - string: description of the grading form
    * criteria - array: list of criteria objects
      For rubric:
        * description - string: criterion description
        * levels - array of {definition, scoreDisplay}
      For guide:
        * shortname - string: criterion short name
        * description - string: criterion description
        * scoreDisplay - string: e.g. "– / 5"

    @package local_unifiedgrader
    @copyright 2026 South African Theological Seminary
    @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

    Example context (json):
    {
        "description": "Assessment criteria for this activity.",
        "isRubric": true,
        "isGuide": false,
        "criteria": [
            {
                "description": "Content quality",
                "shortname": "Content",
                "scoreDisplay": "0 / 5",
                "levels": [
                    {
                        "definition": "Excellent understanding",
                        "scoreDisplay": "5"
                    }
                ]
            }
        ]
    }
}}
{{#description}}
<p class="text-muted mb-3">{{{description}}}</p>
{{/description}}

{{#isRubric}}
{{#criteria}}
<div class="card mb-3">
    <div class="card-header fw-bold">
        {{{description}}}
    </div>
    <div class="card-body p-0">
        <table class="table table-bordered mb-0">
            <tbody>
                <tr>
                    {{#levels}}
                    <td class="bg-light p-2" style="vertical-align: top;">
                        <div class="small">{{{definition}}}</div>
                        <div class="text-muted small mt-1 fw-bold">{{scoreDisplay}}</div>
                    </td>
                    {{/levels}}
                </tr>
            </tbody>
        </table>
    </div>
</div>
{{/criteria}}
{{/isRubric}}

{{#isGuide}}
{{#criteria}}
<div class="card mb-3">
    <div class="card-header d-flex justify-content-between align-items-center">
        <span class="fw-bold">{{shortname}}</span>
        <span class="badge bg-secondary">{{scoreDisplay}}</span>
    </div>
    {{#description}}
    <div class="card-body">
        <div class="small">{{{description}}}</div>
    </div>
    {{/description}}
</div>
{{/criteria}}
{{/isGuide}}
