<?php

use App\Http\Controllers\ProfileController;

use App\Http\Controllers\ClasseController;
use App\Http\Controllers\EleveController;
use App\Http\Controllers\MatiereController;
use App\Http\Controllers\ParentControllers;
use App\Http\Controllers\BulletinController;
use App\Http\Controllers\AnneeController;
use App\Http\Controllers\ProfController;
use App\Http\Controllers\StudentGradeController;







use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::middleware('auth')->group(function () {

                            //  Profile

    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');

                            // Classe

    Route::post('/classestore', [ClasseController::class, 'store'])->name('classes.store');
    Route::get('/classes', [ClasseController::class, 'index'])->name('classes.index');
    Route::get('/classes/{id}', [ClasseController::class, 'show'])->name('classes.show');
    Route::delete('/classes/{classe}', [ClasseController::class, 'destroy'])->name('classes.destroy');
    Route::put('/classes/{classe}', [ClasseController::class, 'update'])->name('classes.update');
    
Route::put('/dispenser/{id}/{idc}', [StudentGradeController::class, 'dispenser'])->name('semestres.dispenser');

                            // Eleve

    Route::post('/elevestore', [EleveController::class, 'store'])->name('eleves.store');
    Route::get('/eleves', [EleveController::class, 'index'])->name('eleves.index');
    Route::delete('/eleves/{eleve}', [EleveController::class, 'destroy'])->name('eleves.destroy');
    Route::put('/eleves/{eleve}', [EleveController::class, 'update'])->name('eleves.update');

                            // Bulletin

    Route::get('/bulletin/create', [BulletinController::class, 'create'])->name('bulletin.create');
    
                            // Matiere

    Route::get('/matieres', [MatiereController::class, 'index'])->name('matieres.index');
    Route::delete('/matieres/{matiere}', [MatiereController::class, 'destroy'])->name('matieres.destroy');
    Route::post('/matierestore', [MatiereController::class, 'store'])->name('matieres.store');
    Route::put('/matieres/{matiere}', [MatiereController::class, 'update'])->name('matieres.update');

                            // Annee

    Route::get('/annees', [AnneeController::class, 'index'])->name('annees.index');
    Route::delete('/annees/{annee}', [AnneeController::class, 'destroy'])->name('annees.destroy');
    Route::post('/anneestore', [AnneeController::class, 'store'])->name('annees.store');
    Route::put('/annees/{annee}', [AnneeController::class, 'update'])->name('annees.update');

                                // Prof

    Route::post('/profstore', [ProfController::class, 'store'])->name('profs.store');
    Route::get('/profs', [ProfController::class, 'index'])->name('profs.index');
    Route::get('/profs/{id}', [ProfController::class, 'show'])->name('profs.show');
    Route::delete('/profs/{prof}', [ProfController::class, 'destroy'])->name('profs.destroy');
    Route::put('/profs/{prof}', [ProfController::class, 'update'])->name('profs.update');
    
                                // Note

    Route::get('/score/{ids}/prof/{idp}/classe/{idc}/students', [ClasseController::class, 'showStudents'])->name('classes.students');
    Route::post('/gradestore', [StudentGradeController::class, 'store'])->name('grades.store');
    Route::put('/grades/{grade}', [StudentGradeController::class, 'update'])->name('grades.update');
    Route::get('/data/{ids}/prof/{idp}/classe/{idc}/matiere/{idm}', [StudentGradeController::class, 'getData'])->name('classes.data');
    Route::get('/score/{ids}/eleve/{ide}/classe/{idc}/bulletin', [StudentGradeController::class, 'getBulletin'])->name('classes.bulletin');
    Route::get('/eleve/{ide}/classe/{idc}/dossier', [StudentGradeController::class, 'getDossier'])->name('classes.dossier');

    Route::delete('/grades/{grade}', [StudentGradeController::class, 'destroy'])->name('grades.destroy');

});

require __DIR__.'/auth.php';
