<?php

use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;
use App\Models\OnlineResources;

use Illuminate\Support\Facades\Artisan;




Route::get('/link',function(){
    Artisan::call('storage:link');
 });
Route::get('/optimize',function(){
    Artisan::call('optimize:clear');
 });
Route::get('/cache',function(){
    Artisan::call('cache:clear');
 });
Route::controller(App\Http\Controllers\HomeController::class)->group(function () {
    Route::get('/', 'index')->name('home');
    Route::get('/about', 'about')->name('about');
    Route::get('/academic', 'academic')->name('academic');
    Route::get('/apply-now-info', 'applynowInfo')->name('applynowInfo');
    Route::get('/faculties', 'facility')->name('facility');
    Route::get('/student-life', 'studentLife')->name('studentLife');
    Route::get('/gallery', 'gallery')->name('gallery');
    Route::get('/news', 'news')->name('news');
    Route::get('/alumni', 'alumni')->name('alumni');
    Route::get('/club', 'club')->name('club');
    Route::get('/library', 'library')->name('library');
    Route::get('/request-info', 'requestinfo')->name('requestinfo');
    Route::get('/search', 'search')->name('search');
    Route::get('/news/{id}', 'IndividualNews')->name('individualNews');
    Route::get('/game/{id}', 'IndividualGame')->name('individualGame');
    Route::get('/zone/{id}', 'IndividualZone')->name('individualZone');
    Route::get('/program/{id}', 'Program')->name('program');

    // Search and filter online resources
    Route::get('/search-online-resources', 'searchOnlineResources')->name('search.online.resources');

    // Download online resource and increment download count
    Route::get('/download-online-resource/{id}', 'downloadOnlineResource')->name('download.online.resource');
});

// Form submission routes
Route::controller(App\Http\Controllers\FormController::class)->group(function () {
    Route::post('/apply-now', 'applynow')->name('applynowForm');
    Route::post('/join-team', 'joinTeamSubmission')->name('jointeamForm');
    Route::post('/request', 'requestInfoSubmission')->name('requestinfoForm');
});

Route::get('/api/online-resource-count/{id}', [App\Http\Controllers\HomeController::class, 'getOnlineResourceCount']);

Route::middleware([
    'auth:sanctum',
    config('jetstream.auth_session'),
    'verified',
])->group(function () {
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');
});
