<?php

use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\Admin\SiswaController;
use App\Http\Controllers\Api\Admin\JurusanController;
use App\Http\Controllers\Api\Admin\GuruController;
use App\Http\Controllers\Api\Admin\AlumniController;
use App\Http\Controllers\Api\Admin\DashboardAdminController;
use App\Http\Controllers\Api\Admin\RiwayatController;
use App\Http\Controllers\Api\Admin\ProspekKerjaController;
use App\Http\Controllers\Api\Student\RecommendationApiController;
use App\Http\Controllers\Api\Student\DashboardStudentController;
use Illuminate\Support\Facades\Route;

Route::post('/login', [AuthController::class, 'login']);

Route::middleware('auth:sanctum')->group(function () {
    Route::middleware('role:admin')->prefix('admin')->group(function () {
        Route::apiResource('siswa', SiswaController::class);
        Route::apiResource('jurusan', JurusanController::class);
        Route::apiResource('guru', GuruController::class);
        Route::apiResource('alumni', AlumniController::class);
        Route::apiResource('prospek-kerja', ProspekKerjaController::class);
        Route::get('/dashboard-stats', [DashboardAdminController::class, 'index']);
        Route::get('/riwayat', [RiwayatController::class, 'index']);
        Route::get('/riwayat/{id}', [RiwayatController::class, 'show']);
    });

    Route::middleware('role:siswa')->prefix('student')->group(function () {
        Route::get('/dashboard-stats', [DashboardStudentController::class, 'index']);
        Route::post('/proses-rekomendasi', [RecommendationApiController::class, 'hitungPrediksi']);
        Route::get('/hasil-rekomendasi/{id}', [RecommendationApiController::class, 'getHasilRekomendasi']);
    });

    Route::post('/logout', [AuthController::class, 'logout']);
});