<?php

use App\Http\Controllers\Auth\DashboardController;
use App\Http\Controllers\Client\AboutController;
use App\Http\Controllers\Client\FaqController;
use App\Http\Controllers\Client\HomeController;
use App\Http\Controllers\client\ProductController;
use App\Http\Controllers\Client\TestimonialController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

Route::get('/', [HomeController::class, 'home'])->name('home');
Route::get('/about-us', [AboutController::class, 'index'])->name('about');
Route::get('/art-of-weaving', [HomeController::class, 'art'])->name('artOfWeaving');
Route::get('/contact', [HomeController::class, 'contact'])->name('contact');
Route::get('/faq', [HomeController::class, 'faq'])->name('faq');
Route::get('/product', [HomeController::class, 'product'])->name('index.product');
Route::get('/gallery', [HomeController::class, 'gallery'])->name('gallery');
Route::get('/bespoke', [HomeController::class, 'bespoke'])->name('bespoke');

Route::post('/locale', function (Request $request) {
    $request->validate([
        'locale' => 'required|in:en,cn'
    ]);

    $locale = $request->input('locale');

    Session::put('locale', $locale);
    // App::setLocale($locale);

    return redirect()->back();
})->name('locale.change');

Route::get('/testimonial', [TestimonialController::class, 'index'])->name('testimonial.index');
Route::post('/testimonial', [TestimonialController::class, 'store'])->name('testimonial.store');


Route::middleware(['auth', 'verified'])->name("dashboard.")->group(function () {
    Route::get('/dashboard', [DashboardController::class, 'index'])->name('index');

    Route::get('/faq/show', [FaqController::class, 'index'])->name('faq.show');
    Route::get('/faq/add', [FaqController::class, 'add'])->name('faq.add');
    Route::post('/faq/add', [FaqController::class, 'addFaq'])->name('faq.addFaq');


    Route::get('/product/dashboard', [ProductController::class, 'index'])->name('product.index');
    Route::get('/product/add', [ProductController::class, 'productAdd'])->name('product.add');
    Route::post('/product/add', [ProductController::class, 'productAddPost'])->name('product.add.post');

    Route::get('/carousel', [DashboardController::class, 'carousel'])->name('carousel.index');
    Route::get('/carousel/add', [DashboardController::class, 'carouselAdd'])->name('carousel.add');
    Route::post('/carousel', [DashboardController::class, 'carouselStore'])->name('carousel.store');
});

require __DIR__ . '/settings.php';
require __DIR__ . '/auth.php';
