<?php

use Illuminate\Support\Facades\Route;
use Modules\Feedback\Http\Controllers\FeedbackController;

// Public feedback submission (no authentication required)
Route::post('/v1/feedback', [FeedbackController::class, 'store'])->name('feedback.store');

// Authenticated feedback routes
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
    Route::get('/feedback', [FeedbackController::class, 'index'])->name('feedback.index');
    Route::get('/feedback/{id}', [FeedbackController::class, 'show'])->name('feedback.show');
    Route::put('/feedback/{id}', [FeedbackController::class, 'update'])->name('feedback.update');
    Route::patch('/feedback/{id}', [FeedbackController::class, 'update'])->name('feedback.patch');
    Route::delete('/feedback/{id}', [FeedbackController::class, 'destroy'])->name('feedback.destroy');
    Route::get('/feedback-statistics', [FeedbackController::class, 'statistics'])->name('feedback.statistics');
    Route::get('/my-feedback', [FeedbackController::class, 'myFeedback'])->name('feedback.my');
    Route::get('/feedback/{id}/documents/{documentId}/download', [FeedbackController::class, 'serveDocument'])
        ->name('feedback.download-document');
});