<?php

use App\Http\Controllers\AuthController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\NoticeController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeBannerController;
use App\Http\Controllers\AboutUsController;
use App\Http\Controllers\FrontendController;
use App\Http\Controllers\ExperienceController;
use App\Http\Controllers\ProjectController;
use App\Http\Controllers\TechnologyController;
use App\Http\Controllers\VisitorsController;
use App\Http\Controllers\ChatbotController;
use App\Http\Controllers\ResumeAnalysisController;
use App\Http\Controllers\SkillController;

Route::get('/', [FrontendController::class, 'index'])->name('home');    //previously Route::view('/', 'frontend.index')->name('home');
Route::view('/blog', 'frontend.blog_details')->name('blogs');

Route::get('/admin/login', [AuthController::class, 'showLogin'])->name('login');
Route::post('/login', [AuthController::class, 'login']);
Route::get('/logout', function () {
    return redirect()->route('login');
});
Route::post('/logout', [AuthController::class, 'logout'])->name('logout');

Route::post('/visitors-messages', [VisitorsController::class, 'store'])->name('visitors');

Route::middleware(['auth'])->group(function () {
    Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
    Route::resource('notices', NoticeController::class)->except(['show']);
    Route::resource('home-banners', HomeBannerController::class);
    Route::resource('about-us', AboutUsController::class);
    Route::resource('experiences', ExperienceController::class);
    Route::resource('projects', ProjectController::class);
    Route::resource('technologies', TechnologyController::class)->only(['store', 'destroy']);
    Route::resource('chatbot', ChatbotController::class)->except(['show']);
    Route::resource('resume-analysis', ResumeAnalysisController::class);
    Route::resource('visitors-messages', VisitorsController::class)->only(['index', 'show', 'destroy']);
    Route::resource('skills', SkillController::class);
});

Route::redirect('/home', '/');


