<?php

use App\Http\Controllers\IndexController;
use App\Http\Controllers\ProductController;
use Illuminate\Support\Facades\Route;

Route::get('/', [IndexController::class, 'index']);
Route::get('detail-{brand}-{category}-{jian}-model-{sku}', [ProductController::class, 'detail'])->where(['brand' => '.*', 'category' => '(battery|adapter)', 'jian' => '.*', 'sku' => '.*'])->name('detail');
Route::resource('carts', \App\Http\Controllers\CartsController::class)->only(['index', 'create', 'store']);
Route::get('categories',[\App\Http\Controllers\CategoriesController::class,'index']);
Route::get('category-item/{category}/{id}', [\App\Http\Controllers\CategoriesController::class, 'category'])->where(['category' => '.*', 'id' => '\d+'])->name('category');
Route::get('category-brand/{brand}/{id}', [\App\Http\Controllers\CategoriesController::class, 'brand'])->where(['brand' => '.*', 'id' => '\d+'])->name('brand');
Route::get('nuevo',[\App\Http\Controllers\CategoriesController::class,'new'])->name('new');
Route::get('mas_popular',[\App\Http\Controllers\CategoriesController::class,'hot'])->name('hot');
Route::get('search',[\App\Http\Controllers\SearchController::class,'index']);
Route::post('api/carts',[\App\Http\Controllers\CartsController::class,'index']);
Route::post('api/create-order',[\App\Http\Controllers\PaypalController::class,'create']);
Route::post('api/capture-order',[\App\Http\Controllers\PaypalController::class,'capture']);
Route::any('paypal/success',[\App\Http\Controllers\PaypalController::class,'success'])->name('success');
Route::get('paypal/fail',[\App\Http\Controllers\PaypalController::class,'fail'])->name('fail');
Route::get('paypal/checkout',[\App\Http\Controllers\PaypalController::class,'checkout']);
Route::get('faq',[\App\Http\Controllers\StaticController::class,'page'])->name('faq');
Route::get('nosotros',[\App\Http\Controllers\StaticController::class,'page'])->name('about');
Route::get('devoluciones',[\App\Http\Controllers\StaticController::class,'page'])->name('return');
Route::get('formas_de_pago_y_envio',[\App\Http\Controllers\StaticController::class,'page'])->name('shipping');
Route::get('politica',[\App\Http\Controllers\StaticController::class,'page'])->name('privacy');
