<?php

use App\Http\Controllers\ReviewController;
use Illuminate\Support\Facades\Route;

Route::prefix('reviews')->group(function () {
    Route::get('/',                           [ReviewController::class, 'index'])->middleware('permission:config.review,view');
    Route::get('/schedule/{scheduleId}',      [ReviewController::class, 'indexBySchedule'])->middleware('permission:config.review,view');
    Route::get('/client/{clientId}/sent',     [ReviewController::class, 'clientSent'])->middleware('permission:config.review,view');
    Route::get('/client/{clientId}/received', [ReviewController::class, 'clientReceived'])->middleware('permission:config.review,view');
    Route::get('/provider/{providerId}/sent', [ReviewController::class, 'providerSent'])->middleware('permission:config.review,view');

    Route::get('/provider/{providerId}/received', [ReviewController::class, 'providerReceived'])
        ->middleware('permission:config.review,view');

    Route::get('/{origin}/{originId}', [ReviewController::class, 'indexByOrigin'])
        ->middleware('permission:config.review,view');

    Route::post('/', [ReviewController::class, 'store'])
        ->middleware('permission:config.review,add');

    Route::put('/{id}', [ReviewController::class, 'update'])
        ->middleware('permission:config.review,edit');

    Route::delete('/{id}', [ReviewController::class, 'destroy'])
        ->middleware('permission:config.review,delete');
});