<?php

use Illuminate\Support\Facades\Route;

use App\Http\Controllers\HomeController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\PageController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\VideoController;
use App\Http\Controllers\DemoController;
use App\Http\Controllers\SitemapController;
use App\Http\Controllers\CollectionController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/demo', [DemoController::class, 'index'])->name('demo');


// 主页
Route::get('/', [HomeController::class, 'index'])->name('home');

// 产品路由
Route::prefix('products')->group(function () {
    Route::get('/', [ProductController::class, 'index'])->name('products.index');
    Route::get('/{id}', [ProductController::class, 'detail'])->name('products.detail');
    Route::get('/categories/{categoryId}', [ProductController::class, 'category'])->name('products.category');
});

// 视频路由
Route::prefix('videos')->group(function () {
    Route::get('/', [VideoController::class, 'index'])->name('videos.index');
    Route::get('/{id}', [VideoController::class, 'detail'])->name('videos.detail');
    Route::get('/categories/{categoryId}', [VideoController::class, 'category'])->name('videos.category');
});

// 文章路由
Route::prefix('pages')->group(function () {
    Route::get('/', [PageController::class, 'list'])->name('page.list'); // 页面列表页
    Route::get('/{slug}', [PageController::class, 'detail'])->name('page.detail'); // 页面详情页
});

////专题路由，于用文章
//Route::get('/collections/{slug}', [CollectionController::class, 'show'])->name('collections.show');
//

// 询盘路由
Route::prefix('contact')->group(function () {
    Route::get('/', [ContactController::class, 'create'])->name('contact.create');
    Route::post('/', [ContactController::class, 'store'])->name('contact.store');
});

Route::prefix('collections')->group(function () {
    Route::get('/{slug}', [CollectionController::class, 'detail'])->name('collection.detail');
});

// Sitemap 路由
Route::get('/sitemap.xml', [SitemapController::class, 'index'])->name('sitemap.index');
