<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\NotificationController;
use App\Http\Controllers\MenuVisibilityController;
use App\Http\Controllers\ImportStreamController;

Route::get('/', function () {
    return redirect()->route('filament.admin.pages.dashboard');
});

Route::get('/test-math', function() { return view('test-math'); });
Route::get('/test-case', function() { return view('test-case'); });
Route::view('/knowledge-mindmap-public', 'public.knowledge-mindmap');
Route::get('/admin/intelligent-exam/pdf/{paper_id}', [\App\Http\Controllers\ExamPdfController::class, 'show'])->name('filament.admin.auth.intelligent-exam.pdf');
Route::get('/admin/intelligent-exam/grading/{paper_id}', [\App\Http\Controllers\ExamPdfController::class, 'showGrading'])->name('filament.admin.auth.intelligent-exam.grading');
Route::get('/admin/exam-analysis/pdf', [\App\Http\Controllers\ExamAnalysisPdfController::class, 'show'])->name('filament.admin.auth.exam-analysis.pdf');

// 检查通知的路由
Route::get('/admin/question-management/check-notifications', [NotificationController::class, 'checkNotifications']);

// 菜单可见性切换路由
Route::post('/admin/toggle-menu-visibility', [MenuVisibilityController::class, 'toggle'])
    ->name('filament.admin.auth.toggle-menu-visibility');

// Livewire测试路由
Route::get('/test-livewire', function() {
    return view('test-livewire');
})->name('test.livewire');

// 教材删除路由 - 通过URL参数传递ID，完全绕过Filament的$record传递问题
// 使用GET方法避免CSRF问题
Route::get('/admin/textbooks/{id}/delete', [\App\Http\Controllers\TextbookController::class, 'delete'])
    ->name('filament.admin.resources.textbooks.delete');

Route::get('/admin/markdown-imports/stream', [ImportStreamController::class, 'stream'])
    ->name('filament.admin.markdown-imports.stream');
