<?php

use App\Http\Controllers\ContactController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\PublicController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\DashboardController;

Route::get('/', [PublicController::class, 'index'])->name('index');
// Route::get('/cart', [PublicController::class, 'cart'])->name('cart');
Route::get('/public/about-us', [PublicController::class, 'about'])->name('public-about-us');
Route::get('/public/contact-us', [PublicController::class, 'contact'])->name('public-contact-us');
Route::get('/public/features', [PublicController::class, 'features'])->name('public-features');
Route::get('/public/catagory', [PublicController::class, 'catagory'])->name('public-catagory');
Route::get('/public/popular', [PublicController::class, 'popular'])->name('public-popular');
Route::get('/public/book/offers', [PublicController::class, 'bookOffers'])->name('public-book-offers');
Route::get('/public/latest/articles', [PublicController::class, 'latestArticles'])->name('public-latest-articles');
Route::get('/public/memoirs/personals', [PublicController::class, 'memoirsPersonals'])->name('public-memoirs-personals');
Route::get('/public/author', [PublicController::class, 'author'])->name('public-author');
Route::get('/public/books/author', [PublicController::class, 'booksAuthor'])->name('public-books-author');



Route::post('/contact-store', [ContactController::class,'store'])->name('contact.store');



Route::middleware('auth')->group(function () {

    Route::get('/dashboard', [PublicController::class, 'master'])
        ->middleware('auth')
        ->name('dashboard');

    Route::resource('features', \App\Http\Controllers\FeaturedController::class);
    Route::resource('catagory', \App\Http\Controllers\CatagoryController::class);
    Route::resource('popular', \App\Http\Controllers\PopularController::class);
    Route::resource('bestsellers', \App\Http\Controllers\BestsellersController::class);
    Route::resource('sliders', \App\Http\Controllers\SliderController::class);
    Route::resource('quotation', \App\Http\Controllers\BestsellersController::class);
    Route::resource('about', \App\Http\Controllers\AboutController::class);
    Route::resource('book-offers', \App\Http\Controllers\BookOffersController::class);
    Route::resource('latest-articles', \App\Http\Controllers\LatestArticlesController::class);
    Route::resource('settings', \App\Http\Controllers\SettingController::class);
    Route::resource('memoirs-personals', \App\Http\Controllers\MemoirsPersonalController::class);

    Route::get('/admin/dashboard', [DashboardController::class,'index'])->name('admin.dashboard');


    // Admin contacts list
Route::get('contacts', [App\Http\Controllers\ContactController::class, 'index'])
    ->middleware(['auth'])
    ->name('contacts.index');

// Delete contact
Route::delete('contacts/{contact}', [App\Http\Controllers\ContactController::class, 'destroy'])
    ->middleware(['auth'])
    ->name('contacts.destroy');



    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');
});

require __DIR__.'/auth.php';
