<?php

use App\Http\Controllers\AboutController;
use App\Http\Controllers\Admin\ClassPackController;
use App\Http\Controllers\Admin\ClassSessionController;
use App\Http\Controllers\Admin\ClassTypeController;
use App\Http\Controllers\Admin\CoachController;
use App\Http\Controllers\Admin\ContactSubmissionController;
use App\Http\Controllers\Admin\ContentBlockController;
use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\FaqController;
use App\Http\Controllers\Admin\GalleryImageController;
use App\Http\Controllers\Admin\GallerySectionController;
use App\Http\Controllers\Admin\MembershipTierController;
use App\Http\Controllers\Admin\ScheduleSettingController;
use App\Http\Controllers\Admin\TestimonialController;
use App\Http\Controllers\BrandController;
use App\Http\Controllers\ClassesController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\GalleryController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\MembershipController;
use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route;

Route::get('/', [HomeController::class, 'index'])->name('home');
Route::get('/about', [AboutController::class, 'index'])->name('about');
Route::get('/classes', [ClassesController::class, 'index'])->name('classes');
Route::get('/membership', [MembershipController::class, 'index'])->name('membership');
Route::get('/gallery', [GalleryController::class, 'index'])->name('gallery');
Route::get('/contact', [ContactController::class, 'index'])->name('contact');
Route::get('/brand', [BrandController::class, 'index'])->name('brand');

// Route::get('/about', function () {
//     return view('pages.about');
// });


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

Route::middleware('auth')->group(function () {
    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');
});

Route::prefix('admin')->middleware(['auth', 'admin'])->name('admin.')->group(function () {
    Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
    Route::resource('class-types', ClassTypeController::class)->except(['show']);
    Route::resource('coaches', CoachController::class)->except(['show']);
    Route::resource('class-sessions', ClassSessionController::class)->except(['show']);
    Route::resource('membership-tiers', MembershipTierController::class)->except(['show']);
    Route::resource('class-packs', ClassPackController::class)->except(['show']);
    Route::resource('testimonials', TestimonialController::class)->except(['show']);
    Route::resource('gallery-sections', GallerySectionController::class)->except(['show']);
    Route::resource('gallery-images', GalleryImageController::class)->except(['show']);
    Route::resource('faqs', FaqController::class)->except(['show']);
    Route::resource('content-blocks', ContentBlockController::class)->except(['show']);
    Route::resource('contact-submissions', ContactSubmissionController::class)->only(['index', 'show', 'destroy']);
    Route::get('schedule-settings/edit', [ScheduleSettingController::class, 'edit'])->name('schedule-settings.edit');
    Route::put('schedule-settings', [ScheduleSettingController::class, 'update'])->name('schedule-settings.update');
});

require __DIR__.'/auth.php';
