<?php

declare(strict_types=1);

use App\Http\Controllers\Api\ApiController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 对外 API（小程序 / 第三方平台）
| 框架已为 api.php 自动添加 /api 前缀
| 文档：GET /docs/api（Scramble 自动生成 OpenAPI）
|--------------------------------------------------------------------------
*/

Route::get('/site', [ApiController::class, 'site'])->name('api.site');
Route::get('/posts', [ApiController::class, 'posts'])->name('api.posts');
Route::get('/posts/{slug}', [ApiController::class, 'post'])->name('api.post');
Route::get('/categories', [ApiController::class, 'categories'])->name('api.categories');
Route::get('/tags', [ApiController::class, 'tags'])->name('api.tags');
Route::post('/comments', [ApiController::class, 'storeComment'])->name('api.comments.store');

Route::middleware('auth:sanctum')->group(function () {
    Route::get('/me', [ApiController::class, 'me'])->name('api.me');
});
