<?php

/**
 * 트리거 감사 로그 API 라우트 (v1)
 *
 * - DB 트리거 기반 변경 추적 로그 조회
 * - 특정 레코드 변경 이력
 * - 롤백 미리보기 및 실행
 */

use App\Http\Controllers\Api\V1\Audit\TriggerAuditLogController;
use Illuminate\Support\Facades\Route;

Route::prefix('trigger-audit-logs')->group(function () {
    Route::get('', [TriggerAuditLogController::class, 'index'])->name('v1.trigger-audit-logs.index');
    Route::get('/stats', [TriggerAuditLogController::class, 'stats'])->name('v1.trigger-audit-logs.stats');
    Route::get('/{id}', [TriggerAuditLogController::class, 'show'])->whereNumber('id')->name('v1.trigger-audit-logs.show');
    Route::get('/{id}/rollback-preview', [TriggerAuditLogController::class, 'rollbackPreview'])->whereNumber('id')->name('v1.trigger-audit-logs.rollback-preview');
    Route::post('/{id}/rollback', [TriggerAuditLogController::class, 'rollbackExecute'])->whereNumber('id')->name('v1.trigger-audit-logs.rollback');
    Route::get('/{tableName}/{rowId}/history', [TriggerAuditLogController::class, 'recordHistory'])->name('v1.trigger-audit-logs.record-history');
});
