<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\IndexController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\CartController;
use App\Http\Controllers\AuthController;
Route::get(
    '/',
    [IndexController::class, 'index']
)->name('index');
// web.php


Route::get('/otp-login', function () {
    return view('otp');
});

Route::get('/{slug}', [ProductController::class, 'index'])->name('products');

Route::post('/logout', [AuthController::class, 'logout'])->name('logout');

Route::get('/filter/products', [ProductController::class, 'filter'])->name('filter-products');
Route::get('/product/{slug}', [ProductController::class, 'product'])->name('product');

Route::prefix('cart')->group(function () {

    Route::post('/calculate', [CartController::class, 'calculate']);
    Route::post('/add', [CartController::class, 'addToCart']);
    Route::post('/update-quantity', [CartController::class, 'updateQuantity']);
    Route::get('/', [CartController::class, 'getCart']);
    Route::delete('/remove/{id}', [CartController::class, 'removeCart']);

    Route::get('/coupons', [CartController::class, 'coupons']);
    Route::post('/apply-coupon', [CartController::class, 'applyCoupon']);
    Route::post('/remove-coupon', [CartController::class, 'removeCoupon']);

});