<?php
// 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.

/**
 * External function declarations for local_kid.
 *
 * @package    local_kid
 */

defined('MOODLE_INTERNAL') || die();

$functions = [
    'local_kid_get_grid_student_view' => [
        'classname'   => 'local_kid\external\get_grid_student_view',
        'methodname'  => 'execute',
        'description' => 'Re-renders the student-mode fragment of the evaluations/stages/capp screen for another student (AJAX student switch).',
        'type'        => 'read',
        'ajax'        => true,
        'capabilities' => 'local/kid:view',
    ],
    'local_kid_get_courses_for_category' => [
        'classname'   => 'local_kid\external\get_courses_for_category',
        'methodname'  => 'execute',
        'description' => 'Returns the visible courses directly in a course category, for the cascading Devoir Moodle picker on the évaluation form.',
        'type'        => 'read',
        'ajax'        => true,
        'capabilities' => 'local/kid:manage_evaluation',
    ],
    'local_kid_get_assigns_for_course' => [
        'classname'   => 'local_kid\external\get_assigns_for_course',
        'methodname'  => 'execute',
        'description' => 'Returns the visible mod_assign instances in a course, for the cascading Devoir Moodle picker on the évaluation form.',
        'type'        => 'read',
        'ajax'        => true,
        'capabilities' => 'local/kid:manage_evaluation',
    ],
    'local_kid_get_competences_admin_view' => [
        'classname'   => 'local_kid\external\get_competences_admin_view',
        'methodname'  => 'execute',
        'description' => 'Switches which promotion is being configured in Administration > Compétences (sélecteur B) and re-renders that tab\'s competencies fragment — never touches the plugin-wide displayed promotion (sélecteur A).',
        'type'        => 'write',
        'ajax'        => true,
        'capabilities' => 'local/kid:manage',
    ],
    'local_kid_bulk_publish_action' => [
        'classname'   => 'local_kid\external\bulk_publish_action',
        'methodname'  => 'execute',
        'description' => 'Publie ou masque en masse les dossiers sélectionnés dans le récapitulatif Évaluations/Stages/CAPP (barre d\'actions groupées).',
        'type'        => 'write',
        'ajax'        => true,
        'capabilities' => 'local/kid:publish_evaluation, local/kid:publish_stage, local/kid:publish_capp',
    ],
    'local_kid_get_comparateur_results' => [
        'classname'   => 'local_kid\external\get_comparateur_results',
        'methodname'  => 'execute',
        'description' => 'Re-renders the Comparateur de bilans\' results area (toolbar + student cards) for a given filter set (live filtering, no "Filtrer" click needed).',
        'type'        => 'read',
        'ajax'        => true,
        'capabilities' => 'local/kid:view',
    ],
    'local_kid_dashboard_favori_create' => [
        'classname'   => 'local_kid\external\dashboard_favori_create',
        'methodname'  => 'execute',
        'description' => 'Enregistre les filtres actuels du Comparateur de bilans comme un tableau de bord favori nommé.',
        'type'        => 'write',
        'ajax'        => true,
        'capabilities' => 'local/kid:managedashboardfavourites',
    ],
    'local_kid_dashboard_favori_rename' => [
        'classname'   => 'local_kid\external\dashboard_favori_rename',
        'methodname'  => 'execute',
        'description' => 'Renomme un tableau de bord favori appartenant à l\'utilisateur courant.',
        'type'        => 'write',
        'ajax'        => true,
        'capabilities' => 'local/kid:managedashboardfavourites',
    ],
    'local_kid_dashboard_favori_delete' => [
        'classname'   => 'local_kid\external\dashboard_favori_delete',
        'methodname'  => 'execute',
        'description' => 'Supprime un tableau de bord favori appartenant à l\'utilisateur courant.',
        'type'        => 'write',
        'ajax'        => true,
        'capabilities' => 'local/kid:managedashboardfavourites',
    ],
];
