<?php

use LaraBB\Admin\Middleware\CheckAdmin;
use LaraBB\Category\UI\Web\Handlers\Admin\CreateHandler;
use LaraBB\Category\UI\Web\Handlers\Admin\DestroyHandler;
use LaraBB\Category\UI\Web\Handlers\Admin\EditHandler;
use LaraBB\Category\UI\Web\Handlers\Admin\StoreHandler;
use LaraBB\Category\UI\Web\Handlers\Admin\UpdateHandler;
use LaraBB\Category\UI\Web\Handlers\IndexHandler;
use LaraBB\Category\UI\Web\Handlers\Admin\IndexHandler as AdminIndexHandler;
use LaraBB\Category\UI\Web\Handlers\ShowHandler;

Route::group([], function() {
    Route::get('/', IndexHandler::class)->name('index');
    Route::get('category/{slug}', ShowHandler::class)->name('category');
});

Route::group([
    'middleware' => [
        'auth',
        CheckAdmin::class
    ],
    'prefix' => 'admin/forums'
], function() {
    Route::get('/', AdminIndexHandler::class)->name('admin.forums');
    Route::group([
        'prefix' => 'categories'
    ], function() {
        Route::get('create', CreateHandler::class)->name('admin.forums.category.create');
        Route::post('store', StoreHandler::class)->name('admin.forums.category.store');
        Route::get('edit/{uuid}', EditHandler::class)->name('admin.forums.category.edit');
        Route::post('update', UpdateHandler::class)->name('admin.forums.category.update');
        Route::post('destroy', DestroyHandler::class)->name('admin.forums.category.destroy');
    });
});
