<?php

declare(strict_types=1);

use App\Http\Controllers\Api\V1\ArticleController;
use App\Http\Controllers\Api\V1\CategoryController;
use App\Http\Controllers\Api\V1\MetaController;
use App\Http\Controllers\Api\V1\TagController;
use Illuminate\Support\Facades\Route;

/*
| JSON API for mini-programs / third-party clients.
| Spec: docs/api/openapi.yaml
*/
Route::prefix('v1')->group(function (): void {
    Route::get('/meta', [MetaController::class, 'show']);
    Route::get('/articles', [ArticleController::class, 'index']);
    Route::get('/articles/{id}', [ArticleController::class, 'show'])->whereNumber('id');
    Route::get('/categories', [CategoryController::class, 'index']);
    Route::get('/categories/{id}/articles', [CategoryController::class, 'articles'])->whereNumber('id');
    Route::get('/tags', [TagController::class, 'index']);
    Route::get('/tags/{name}/articles', [TagController::class, 'articles']);
});
