<?php

use App\Http\Controllers\Chat\ChatController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| این بلوک را جداگانه به routes/web.php اضافه کنید (نه داخل پیشوند coach/
| یا athlete/، چون هر دو نقش از همین Controller استفاده می‌کنند — Authorization
| با CoachRequestPolicy::chat انجام می‌شود، دقیقاً مثل الگوی photos/documents):
|--------------------------------------------------------------------------
*/
Route::middleware(['auth', 'active.account'])->group(function () {
    Route::get('/coach-requests/{coachRequest}/chat', [ChatController::class, 'show'])->name('chat.show');
    Route::post('/coach-requests/{coachRequest}/chat/messages', [ChatController::class, 'store'])
        ->name('chat.messages.store')
        ->middleware('throttle:chat-message');
    Route::get('/coach-requests/{coachRequest}/chat/messages', [ChatController::class, 'poll'])->name('chat.messages.poll');
});
