<?php

use Illuminate\Support\Facades\Route;
use ViartasCore\Comments\Controllers\Accounting\CommentController;

/*
|--------------------------------------------------------------------------
| Comments Admin Routes
|--------------------------------------------------------------------------
*/

Route::prefix(config('comments.admin_prefix', 'comments'))
    ->middleware(config('comments.admin_middleware', ['web', 'auth']))
    ->group(function () {

        Route::prefix('{model_type}/{model_id}')->group(function () {
            Route::get('/', [CommentController::class, 'index'])->name('comments.index');
            Route::post('/', [CommentController::class, 'store'])->name('comments.store');
            Route::post('/bulk', [CommentController::class, 'bulk'])->name('comments.bulk');

            Route::get('/{id}', [CommentController::class, 'show'])->name('comments.show');
            Route::match(['post', 'put', 'patch'], '/{id}/update', [CommentController::class, 'update'])->name('comments.update');
            Route::post('/{id}/approve', [CommentController::class, 'approve'])->name('comments.approve');
            Route::post('/{id}/reject', [CommentController::class, 'reject'])->name('comments.reject');
            Route::post('/{id}/spam', [CommentController::class, 'spam'])->name('comments.spam');
            Route::match(['post', 'delete'], '/{id}/destroy', [CommentController::class, 'destroy'])->name('comments.destroy');
        });
    });
