<?php

declare(strict_types=1);

use Illuminate\Support\Facades\Route;
use Kylin\SensitiveWord\Http\Controllers\SensitiveWordController;

/**
 * 敏感词管理 API 路由
 *
 * 依据《网络安全法》第四十七条，内容管理接口需配合权限控制和审计日志
 */

Route::prefix('api/kylin/sensitive-words')->group(function () {
    // 敏感词 CRUD
    Route::get('/', [SensitiveWordController::class, 'index']);
    Route::post('/', [SensitiveWordController::class, 'store']);
    Route::put('/{id}', [SensitiveWordController::class, 'update']);
    Route::delete('/{id}', [SensitiveWordController::class, 'destroy']);

    // 批量操作
    Route::post('/import', [SensitiveWordController::class, 'import']);
    Route::get('/sync', [SensitiveWordController::class, 'sync']);

    // 分类管理
    Route::get('/categories', [SensitiveWordController::class, 'categories']);
    Route::post('/categories/init', [SensitiveWordController::class, 'initCategories']);

    // 检测与过滤
    Route::post('/detect', [SensitiveWordController::class, 'detect']);
    Route::post('/filter', [SensitiveWordController::class, 'filterText']);

    // 统计
    Route::get('/statistics', [SensitiveWordController::class, 'statistics']);
});
