<?php

/**
 * Academic Module Routes
 *
 * This file is automatically loaded by ModuleLoader.
 * Define your academic management routes here.
 *
 * @var \CodeIgniter\Router\RouteCollection $routes
 */

$routes->group('api/academic', [
    'namespace' => 'App\Modules\Academic\Controllers',
    'filter'    => 'admin_only',
], function ($routes) {
    $routes->get('lesson-slots', 'LessonSlotController::index');
    $routes->post('lesson-slots', 'LessonSlotController::create');
    $routes->put('lesson-slots/(:num)', 'LessonSlotController::update/$1');
    $routes->delete('lesson-slots/(:num)', 'LessonSlotController::delete/$1');

    $routes->get('schedules/class/(:num)', 'ScheduleManagementController::getByClass/$1');
    $routes->post('schedules/bulk-save', 'ScheduleManagementController::bulkSave');

    $routes->get('teachers', 'TeacherController::index');
    $routes->get('teacher-subjects/(:num)', 'TeacherSubjectController::getByTeacher/$1');
    $routes->put('teacher-subjects/(:num)', 'TeacherSubjectController::updateForTeacher/$1');
    $routes->get('teacher-subjects/map', 'TeacherSubjectController::map');
    $routes->get('subjects', 'SubjectController::index');
    $routes->post('subjects', 'SubjectController::create');
    $routes->put('subjects/(:num)', 'SubjectController::update/$1');
    $routes->delete('subjects/(:num)', 'SubjectController::delete/$1');
    $routes->get('classes', 'ClassController::index');
    $routes->post('classes', 'ClassController::create');
    $routes->put('classes/(:num)', 'ClassController::update/$1');
    $routes->delete('classes/(:num)', 'ClassController::delete/$1');
    $routes->get('students', 'StudentController::index');
    $routes->post('students', 'StudentController::create');
    $routes->put('students/(:num)', 'StudentController::update/$1');
    $routes->delete('students/(:num)', 'StudentController::delete/$1');

    $routes->post('dapodik/sync/students', 'DapodikSyncController::syncStudents');
    $routes->get('dapodik/sync/status/(:num)', 'DapodikSyncController::status/$1');
    $routes->get('dapodik/rombels', 'DapodikSyncController::rombels');
    $routes->put('dapodik/rombels/(:num)', 'DapodikSyncController::updateRombel/$1');
});
